diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/data/rgb2ycrcb.mdd b/XilinxProcessorIPLib/drivers/rgb2ycrcb/data/rgb2ycrcb.mdd index 3be24b4c..e5eb8442 100755 --- a/XilinxProcessorIPLib/drivers/rgb2ycrcb/data/rgb2ycrcb.mdd +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/data/rgb2ycrcb.mdd @@ -1,9 +1,9 @@ -############################################################################### +############################################################################## # # Copyright (C) 2011 - 2014 Xilinx, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal +# of this software and associated documentation files (the "Software"),to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is @@ -27,7 +27,6 @@ # Except as contained in this notice, the name of the Xilinx shall not be used # in advertising or otherwise to promote the sale, use or other dealings in # this Software without prior written authorization from Xilinx. -# ############################################################################### OPTION psf_version = 2.1; diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/data/rgb2ycrcb.tcl b/XilinxProcessorIPLib/drivers/rgb2ycrcb/data/rgb2ycrcb.tcl index 5c3d624e..e2382233 100755 --- a/XilinxProcessorIPLib/drivers/rgb2ycrcb/data/rgb2ycrcb.tcl +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/data/rgb2ycrcb.tcl @@ -1,9 +1,9 @@ -############################################################################### +############################################################################## # # Copyright (C) 2011 - 2014 Xilinx, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal +# of this software and associated documentation files (the "Software"),to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is @@ -27,16 +27,12 @@ # Except as contained in this notice, the name of the Xilinx shall not be used # in advertising or otherwise to promote the sale, use or other dealings in # this Software without prior written authorization from Xilinx. -# ############################################################################### -# -# MODIFICATION HISTORY: -# Ver Who Date Changes -# -------- ------ -------- ------------------------------------ -# 6.0 adk 12/10/13 Updated as per the New Tcl API's -################################################################## proc generate {drv_handle} { - xdefine_include_file $drv_handle "xparameters.h" "RGB2YCRCB" "NUM_INSTANCES" "C_BASEADDR" "C_HIGHADDR" "DEVICE_ID" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_S_AXIS_VIDEO_FORMAT" "C_S_AXIS_VIDEO_TDATA_WIDTH" "C_M_AXIS_VIDEO_DATA_WIDTH" "C_M_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_TDATA_WIDTH" "C_HAS_AXI4_LITE" "C_HAS_DEBUG" "C_HAS_INTC_IF" "C_MAX_COLS" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_HAS_CLIP" "C_HAS_CLAMP" "C_ACOEF" "C_BCOEF" "C_CCOEF" "C_DCOEF" "C_YOFFSET" "C_CBOFFSET" "C_CROFFSET" "C_YMAX" "C_YMIN" "C_CBMAX" "C_CBMIN" "C_CRMAX" "C_CRMIN" - xdefine_canonical_xpars $drv_handle "xparameters.h" "RGB2YCRCB" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_S_AXIS_VIDEO_FORMAT" "C_S_AXIS_VIDEO_TDATA_WIDTH" "C_M_AXIS_VIDEO_DATA_WIDTH" "C_M_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_TDATA_WIDTH" "C_HAS_AXI4_LITE" "C_HAS_DEBUG" "C_HAS_INTC_IF" "C_MAX_COLS" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_HAS_CLIP" "C_HAS_CLAMP" "C_ACOEF" "C_BCOEF" "C_CCOEF" "C_DCOEF" "C_YOFFSET" "C_CBOFFSET" "C_CROFFSET" "C_YMAX" "C_YMIN" "C_CBMAX" "C_CBMIN" "C_CRMAX" "C_CRMIN" + xdefine_include_file $drv_handle "xparameters.h" "RGB2YCRCB" "NUM_INSTANCES" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_S_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_FORMAT" "C_HAS_DEBUG" "C_HAS_INTC_IF" "C_MAX_COLS" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_HAS_CLIP" "C_HAS_CLAMP" "C_ACOEF" "C_BCOEF" "C_CCOEF" "C_DCOEF" "C_YOFFSET" "C_CBOFFSET" "C_CROFFSET" "C_YMAX" "C_YMIN" "C_CBMAX" "C_CBMIN" "C_CRMAX" "C_CRMIN" "C_S_AXI_CLK_FREQ_HZ" "C_STANDARD_SEL" "C_OUTPUT_RANGE" + + xdefine_config_file $drv_handle "xrgb2ycrcb_g.c" "XRgb2YCrCb" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_S_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_FORMAT" "C_HAS_DEBUG" "C_HAS_INTC_IF" "C_MAX_COLS" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_HAS_CLIP" "C_HAS_CLAMP" "C_ACOEF" "C_BCOEF" "C_CCOEF" "C_DCOEF" "C_YOFFSET" "C_CBOFFSET" "C_CROFFSET" "C_YMAX" "C_YMIN" "C_CBMAX" "C_CBMIN" "C_CRMAX" "C_CRMIN" "C_S_AXI_CLK_FREQ_HZ" "C_STANDARD_SEL" "C_OUTPUT_RANGE" + + xdefine_canonical_xpars $drv_handle "xparameters.h" "RGB2YCRCB" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_S_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_FORMAT" "C_HAS_DEBUG" "C_HAS_INTC_IF" "C_MAX_COLS" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_HAS_CLIP" "C_HAS_CLAMP" "C_ACOEF" "C_BCOEF" "C_CCOEF" "C_DCOEF" "C_YOFFSET" "C_CBOFFSET" "C_CROFFSET" "C_YMAX" "C_YMIN" "C_CBMAX" "C_CBMIN" "C_CRMAX" "C_CRMIN" "C_S_AXI_CLK_FREQ_HZ" "C_STANDARD_SEL" "C_OUTPUT_RANGE" } diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/annotated.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/annotated.html new file mode 100644 index 00000000..d3679ebd --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/annotated.html @@ -0,0 +1,30 @@ + +
+ +XRgb2YCrCb | |
XRgb2YCrCb_Coef_Inputs | |
XRgb2YCrCb_Coef_Outputs | |
XRgb2YCrCb_Config |
rgb2ycrcb.c |
xrgb2ycrcb.c | |
xrgb2ycrcb.h | |
xrgb2ycrcb_g.c | |
xrgb2ycrcb_hw.h | |
xrgb2ycrcb_intr.c | |
xrgb2ycrcb_selftest.c | |
xrgb2ycrcb_sinit.c |
+Here is a list of all class members with links to the classes they belong to: +
+
+ +
+
-
+
+ +
+
+
+
-
+
+
-This header file contains identifiers and register-level driver functions (or macros) that can be used to access the Xilinx RGB to YCrCb Color Space Converter (RGB2YCRCB) device.
-MODIFICATION HISTORY:
-Ver Who Date Changes ----- ---- -------- ------------------------------------------------------- 5.00a tb 02/27/12 Updated for RGB2YCRCB V5.00.a 5.01a bao 12/28/12 Converted from xio.h to xil_io.h, translating basic types, MB cache functions, exceptions and assertions to xil_io format 6.0 adk 19/12/13 Updated as per the New Tcl API's Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. +This header file contains identifiers and register-level driver functions (or macros), range macros, structure typedefs that can be used to access the Xilinx Rgb2YCrCb core instance.
+The RGB to YCrCb Color-Space Convertor core is a simplified 3x3 matrix multiplier converts three input color samples to three output samples in a single clock cycle. The core supports four common format conversions as well as a custom mode that allows for a user-defined transform. The core is capable of a maximum resolution of 7680 columns by 7680 rows with 8, 10, 12, or 16 bits per pixel.
+Initialization & Configuration
+The device driver enables higher layer software (e.g., an application) to communicate to the RGB2YCRCB core.
+XRgb2YCrCb_CfgInitialize() API is used to initialize the RGB2YCRCB core. The user needs to first call the XRgb2YCrCb_LookupConfig() API which returns the Configuration structure pointer which is passed as a parameter to the XRgb2YCrCb_CfgInitialize() API.
+ Interrupts
+The driver provides an interrupt handler XRgb2YCrCb_IntrHandler for handling the interrupt from the RGB2YCRCB core. The users of this driver have to register this handler with the interrupt system and provide the callback functions by using XRgb2YCrCb_SetCallBack API.
+ Virtual Memory
+This driver supports Virtual Memory. The RTOS is responsible for calculating the correct device base address in Virtual Memory space.
+ Threads
+This driver is not thread safe. Any needs for threads or thread mutual exclusion must be satisfied by the layer above this driver.
+ Asserts
+Asserts are used within all Xilinx drivers to enforce constraints on argument values. Asserts can be turned off on a system-wide basis by defining, at compile time, the NDEBUG identifier. By default, asserts are turned on and it is recommended that users leave asserts on during development.
+ Building the driver
+The XRgb2YCrCb driver is composed of several source files. This allows the user to build and link only those parts of the driver that are necessary.
+
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------ -------- ------------------------------------------------------- + 5.00a tb 02/27/12 Updated for RGB2YCRCB V5.00.a + 5.01a bao 12/28/12 Converted from xio.h to xil_io.h, translating basic + types, MB cache functions, exceptions and assertions + to xil_io format. + 6.0 adk 19/12/13 Updated as per the New Tcl API's. + 7.0 adk 01/07/14 Changed the file name from "rgb2ycrcb.h" to + "xrgb2ycrcb.h". + Moved register offsets and bit definitions from + rgb2ycrcb.h file to xrgb2ycrcb_hw.h file.
+
Removed RGB_TIMING_STATUS register offset because this + register is not present in latest product guide.
+
Removed following function macros: + RGB_Enable, RGB_Disable, RGB_RegUpdateEnable, + RGB_RegUpdateDisable, RGB_Reset, RGB_ClearReset, + RGB_AutoSyncReset.
+
Removed following functions: + RGB_select_standard, RGB_coefficient_translation, + RGB_set_coefficients, RGB_get_coefficients.
+
Added following handler types as enum: + XRGB_HANDLER_PROCSTART, XRGB_HANDLER_FRAMEDONE, + XRGB_HANDLER_ERROR.
+
Added following standard types as enum: + XRGB_STANDARD_ITU_601_SD, XRGB_STANDARD_ITU_709_NTSC, + XRGB_STANDARD_ITU_709_PAL, XRGB_STANDARD_YUV, + XRGB_STANDARD_CUSTOM.
+
Added following output ranges as enum: + XRGB_TV_16_TO_240, XRGB_STUDIO_16_TO_235, + XRGB_GRAPHICS_0_TO_255.
+
Added range macros for ActiveSize, YMAX, YMIN, YOFFSET, + CBMAX, CBMIN, CBOFFSET, CRMAX, CRMIN, CROFFSET + registers.
+
Added following function macros: + XRgb2YCrCb_IntrEnable, XRgb2YCrCb_SyncReset, + XRgb2YCrCb_IntrDisable, XRgb2YCrCb_StatusGetPending, + XRgb2YCrCb_IntrGetPending, XRgb2YCrCb_IntrClear, + XRgb2YCrCb_RegUpdateEnable, + XRgb2YCrCb_RegUpdateDisable, XRgb2YCrCb_Reset, + XRgb2YCrCb_Enable, XRgb2YCrCb_Disable, + XRgb2YCrCb_Start, XRgb2YCrCb_Stop.
+
Added core and configuration structure. + Renamed rgb_coef_inputs -> XRgb2YCrCb_Coef_Inputs and + rgb_coef_outputs - > XRgb2YCrCb_Coef_Outputs.
+
Added callback functions typedef.
+
Implemented XRgb2YCrCb_LookupConfig in + xrgb2ycrcb_sinit.c + Implemented XRgb2YCrCb_SelfTest in + xrgb2ycrcb_selftest.c + Implemented XRgb2YCrCb_IntrHandler, + XRgb2YCrCb_SetCallBack in xrgb2ycrcb_intr.c.
+
Implemented following functions in xrgb2ycrcb.c: + XRgb2YCrCb_CfgInitialize, XRgb2YCrCb_EnableDbgByPass, + XRgb2YCrCb_IsDbgByPassEnabled, + XRgb2YCrCb_DisableDbgBypass, + XRgb2YCrCb_EnableDbgTestPattern, + XRgb2YCrCb_IsDbgTestPatternEnabled, + XRgb2YCrCb_DisableDbgTestPattern, + XRgb2YCrCb_GetVersion, XRgb2YCrCb_GetDbgFrameCount, + XRgb2YCrCb_GetDbgLineCount, + XRgb2YCrCb_GetDbgPixelCount, XRgb2YCrCb_Setup, + XRgb2YCrCb_SetActiveSize, XRgb2YCrCb_GetActiveSize, + XRgb2YCrCb_SetYMax, XRgb2YCrCb_GetYMax, + XRgb2YCrCb_SetYMin, XRgb2YCrCb_GetYMin, + XRgb2YCrCb_SetCbMax, XRgb2YCrCb_GetCbMax, + XRgb2YCrCb_SetCbMin, XRgb2YCrCb_GetCbMin, + XRgb2YCrCb_SetCrMax, XRgb2YCrCb_GetCrMax, + XRgb2YCrCb_SetCrMin, XRgb2YCrCb_GetCrMin, + XRgb2YCrCb_SetYOffset, XRgb2YCrCb_GetYOffset, + XRgb2YCrCb_SetCbOffset, XRgb2YCrCb_GetCbOffset, + XRgb2YCrCb_SetCrOffset, XRgb2YCrCb_GetCrOffset, + XRgb2YCrCb_SetCoefs, XRgb2YCrCb_GetCoefs, + XRgb2YCrCb_Select_Standard, + XRgb2YCrCb_Coefficient_Translation, + XRgb2YCrCb_Select_OutputRange. +*Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/rgb2ycrcb_8c.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/rgb2ycrcb_8c.html deleted file mode 100755 index 3c64c20e..00000000 --- a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/rgb2ycrcb_8c.html +++ /dev/null @@ -1,248 +0,0 @@ - - - -
-MODIFICATION HISTORY:
-Ver Who Date Changes ----- ---- -------- ------------------------------------------------------- 5.00a tb 02/27/12 Updated for RGB2YCRCB v5.00.a -
-#include "rgb2ycrcb.h"
-#include "xenv.h"
-#include "stdio.h"
-
Functions | |
void | RGB_select_standard (u32 standard_sel, u32 input_range, u32 data_width, struct rgb_coef_inputs *coef_in) |
u32 | RGB_coefficient_translation (struct rgb_coef_inputs *coef_in, struct rgb_coef_outputs *coef_out, u32 data_width) |
void | RGB_set_coefficients (u32 BaseAddress, struct rgb_coef_outputs *coef_out) |
void | RGB_get_coefficients (u32 BaseAddress, struct rgb_coef_outputs *coef_out) |
-
-
|
-
- - | -
-
- -Translate input coefficients into coefficients that can be programmed into the RGB2YCrCb core. -
|
-
-
-
|
-
- - | -
-
- -Read the RGB2YCrCb coefficient/offset registers. -
|
-
-
-
|
-
- - | -
-
- -Select input coefficients for 4 supported Standards and 3 Input Ranges. -
|
-
-
-
|
-
- - | -
-
- -Program the RGB2YCrCb coefficient/offset registers. -
|
-
#include <xrgb2ycrcb.h>
++
Public Attributes | |
XRgb2YCrCb_Config | Config |
u32 | IsReady |
u16 | HSize |
u16 | VSize |
XRgb2YCrCb_CallBack | ProcStartCallBack |
void * | ProcStartRef |
XRgb2YCrCb_CallBack | FrameDoneCallBack |
void * | FrameDoneRef |
XRgb2YCrCb_ErrorCallBack | ErrCallBack |
void * | ErrRef |
u32 | StandardSelection |
u32 | OutputRange |
XRgb2YCrCb_Config XRgb2YCrCb::Config | +
+Hardware configuration +
XRgb2YCrCb_ErrorCallBack XRgb2YCrCb::ErrCallBack | +
+Callback for Error interrupt +
void* XRgb2YCrCb::ErrRef | +
+To be passed to the Error interrupt callback +
XRgb2YCrCb_CallBack XRgb2YCrCb::FrameDoneCallBack | +
+Callback for Frame Done interrupt +
void* XRgb2YCrCb::FrameDoneRef | +
+To be passed to the Frame done interrupt callback +
u16 XRgb2YCrCb::HSize | +
+Active Video Horizontal Size +
u32 XRgb2YCrCb::IsReady | +
+Core and driver instance are initialized +
u32 XRgb2YCrCb::OutputRange | +
+Output Range +
XRgb2YCrCb_CallBack XRgb2YCrCb::ProcStartCallBack | +
+Callback for Processing Start interrupt +
void* XRgb2YCrCb::ProcStartRef | +
+To be passed to Process start interrupt callback +
u32 XRgb2YCrCb::StandardSelection | +
+Standard Selection +
u16 XRgb2YCrCb::VSize | +
+Active Video Vertical Size +
+
#include <xrgb2ycrcb.h>
++
Public Attributes | |
double | ACoef |
double | BCoef |
double | CCoef |
double | DCoef |
u32 | YOffset |
u32 | CbOffset |
u32 | CrOffset |
u32 | YMax |
u32 | YMin |
u32 | CbMax |
u32 | CbMin |
u32 | CrMax |
u32 | CrMin |
double XRgb2YCrCb_Coef_Inputs::ACoef | +
+[ 0.0 - 1.0 ] 0.0 < ACOEFF + BCOEFF < 1.0 +
double XRgb2YCrCb_Coef_Inputs::BCoef | +
+[ 0.0 - 1.0 ] 0.0 < ACOEFF + BCOEFF < 1.0 +
u32 XRgb2YCrCb_Coef_Inputs::CbMax | +
+Cb Clipping +
u32 XRgb2YCrCb_Coef_Inputs::CbMin | +
+Cb Clamping +
u32 XRgb2YCrCb_Coef_Inputs::CbOffset | +
+Offset for the Chrominance Channels +
double XRgb2YCrCb_Coef_Inputs::CCoef | +
+[ 0.0 - 0.9 ] +
u32 XRgb2YCrCb_Coef_Inputs::CrMax | +
+Cr Clipping +
u32 XRgb2YCrCb_Coef_Inputs::CrMin | +
+Cr Clamping +
u32 XRgb2YCrCb_Coef_Inputs::CrOffset | +
+Offset for the Chrominance Channels +
double XRgb2YCrCb_Coef_Inputs::DCoef | +
+[ 0.0 - 0.9 ] +
u32 XRgb2YCrCb_Coef_Inputs::YMax | +
+Y Clipping +
u32 XRgb2YCrCb_Coef_Inputs::YMin | +
+Y Clamping +
u32 XRgb2YCrCb_Coef_Inputs::YOffset | +
+Offset for the Luminance Channel +
+
#include <xrgb2ycrcb.h>
++
Public Attributes | |
u32 | ACoef |
u32 | BCoef |
u32 | CCoef |
u32 | DCoef |
u32 | YOffset |
u32 | CbOffset |
u32 | CrOffset |
u32 | YMax |
u32 | YMin |
u32 | CbMax |
u32 | CbMin |
u32 | CrMax |
u32 | CrMin |
u32 XRgb2YCrCb_Coef_Outputs::ACoef | +
+Translated ACoef +
u32 XRgb2YCrCb_Coef_Outputs::BCoef | +
+Translated BCoef +
u32 XRgb2YCrCb_Coef_Outputs::CbMax | +
+Translated Cb Clipping +
u32 XRgb2YCrCb_Coef_Outputs::CbMin | +
+Translated Cb Clamping +
u32 XRgb2YCrCb_Coef_Outputs::CbOffset | +
+Translated Offset for the Chrominance Channels +
u32 XRgb2YCrCb_Coef_Outputs::CCoef | +
+Translated CCoef +
u32 XRgb2YCrCb_Coef_Outputs::CrMax | +
+Translated Cr Clipping +
u32 XRgb2YCrCb_Coef_Outputs::CrMin | +
+Translated Cr Clamping +
u32 XRgb2YCrCb_Coef_Outputs::CrOffset | +
+Translated Offset for the Chrominance Channels +
u32 XRgb2YCrCb_Coef_Outputs::DCoef | +
+Translated DCoef +
u32 XRgb2YCrCb_Coef_Outputs::YMax | +
+Translated Y Clipping +
u32 XRgb2YCrCb_Coef_Outputs::YMin | +
+Translated Y Clamping +
u32 XRgb2YCrCb_Coef_Outputs::YOffset | +
+Translated Offset for the Luminance Channel +
+
#include <xrgb2ycrcb.h>
++
Public Attributes | |
u16 | DeviceId |
u32 | BaseAddress |
u32 | SlaveAxisVideoFormat |
u32 | MasterAxisVideoFormat |
u16 | HasDebug |
u16 | HasIntcIf |
u32 | MaxCols |
u32 | ActiveCols |
u32 | ActiveRows |
u16 | HasClip |
u16 | HasClamp |
u32 | ACoef |
u32 | BCoef |
u32 | CCoef |
u32 | DCoef |
u32 | YOffset |
u32 | CbOffset |
u32 | CrOffset |
u32 | YMax |
u32 | YMin |
u32 | CbMax |
u32 | CbMin |
u32 | CrMax |
u32 | CrMin |
u32 | SlaveAxiClkFreqHz |
u32 | StandardSelection |
u32 | OutputRange |
u32 XRgb2YCrCb_Config::ACoef | +
+A coefficient +
u32 XRgb2YCrCb_Config::ActiveCols | +
+Number of active columns +
u32 XRgb2YCrCb_Config::ActiveRows | +
+Number of active rows +
u32 XRgb2YCrCb_Config::BaseAddress | +
+BaseAddress is the physical base address of the RGB2YCRCB core registers +
u32 XRgb2YCrCb_Config::BCoef | +
+B coefficient +
u32 XRgb2YCrCb_Config::CbMax | +
+Cb Max value +
u32 XRgb2YCrCb_Config::CbMin | +
+Cb Min value +
u32 XRgb2YCrCb_Config::CbOffset | +
+Cb Offset value +
u32 XRgb2YCrCb_Config::CCoef | +
+C coefficient +
u32 XRgb2YCrCb_Config::CrMax | +
+Cr Max value +
u32 XRgb2YCrCb_Config::CrMin | +
+Cr Min value +
u32 XRgb2YCrCb_Config::CrOffset | +
+Cr Offset value +
u32 XRgb2YCrCb_Config::DCoef | +
+D coefficient +
u16 XRgb2YCrCb_Config::DeviceId | +
+DeviceId is the unique ID of the RGB2YCRCB core +
u16 XRgb2YCrCb_Config::HasClamp | +
+To check support for clamping +
u16 XRgb2YCrCb_Config::HasClip | +
+To check support for clipping +
u16 XRgb2YCrCb_Config::HasDebug | +
+To check debug support +
u16 XRgb2YCrCb_Config::HasIntcIf | +
+To check Interrupt controller support +
u32 XRgb2YCrCb_Config::MasterAxisVideoFormat | +
+Master Axis Video Format +
u32 XRgb2YCrCb_Config::MaxCols | +
+Maximum number of columns +
u32 XRgb2YCrCb_Config::OutputRange | +
+To identify output range +
u32 XRgb2YCrCb_Config::SlaveAxiClkFreqHz | +
+Slave AXI Clock Frequency in Hz +
u32 XRgb2YCrCb_Config::SlaveAxisVideoFormat | +
+Slave Axis Video Format +
u32 XRgb2YCrCb_Config::StandardSelection | +
+To select standard +
u32 XRgb2YCrCb_Config::YMax | +
+Y Min value +
u32 XRgb2YCrCb_Config::YMin | +
+Y Max value +
u32 XRgb2YCrCb_Config::YOffset | +
+Y Offset value +
+
+
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------ -------- ------------------------------------------------------- + 5.00a tb 02/27/12 Updated for RGB2YCRCB v5.00.a. + 7.0 adk 01/07/14 Changed the file name from "rgb2ycrcb.c" to + "xrgb2ycrcb.c".
+
Implemented the following functions: + XRgb2YCrCb_CfgInitialize, XRgb2YCrCb_EnableDbgByPass, + XRgb2YCrCb_IsDbgByPassEnabled, + XRgb2YCrCb_DisableDbgBypass, + XRgb2YCrCb_EnableDbgTestPattern, + XRgb2YCrCb_IsDbgTestPatternEnabled, + XRgb2YCrCb_DisableDbgTestPattern, + XRgb2YCrCb_GetVersion, XRgb2YCrCb_GetDbgFrameCount, + XRgb2YCrCb_GetDbgLineCount, + XRgb2YCrCb_GetDbgPixelCount, XRgb2YCrCb_Setup, + XRgb2YCrCb_SetActiveSize, XRgb2YCrCb_GetActiveSize, + XRgb2YCrCb_SetYMax, XRgb2YCrCb_GetYMax, + XRgb2YCrCb_SetYMin, XRgb2YCrCb_GetYMin, + XRgb2YCrCb_SetCbMax, XRgb2YCrCb_GetCbMax, + XRgb2YCrCb_SetCbMin, XRgb2YCrCb_GetCbMin, + XRgb2YCrCb_SetCrMax, XRgb2YCrCb_GetCrMax, + XRgb2YCrCb_SetCrMin, XRgb2YCrCb_GetCrMin, + XRgb2YCrCb_SetYOffset, XRgb2YCrCb_GetYOffset, + XRgb2YCrCb_SetCbOffset, XRgb2YCrCb_GetCbOffset, + XRgb2YCrCb_SetCrOffset, XRgb2YCrCb_GetCrOffset, + XRgb2YCrCb_SetCoefs, XRgb2YCrCb_GetCoefs, + XRgb2YCrCb_Select_Standard, + XRgb2YCrCb_Coefficient_Translation, + XRgb2YCrCb_Select_OutputRange. ++
+#include "xrgb2ycrcb.h"
+
Functions | |
int | XRgb2YCrCb_CfgInitialize (XRgb2YCrCb *InstancePtr, XRgb2YCrCb_Config *CfgPtr, u32 EffectiveAddr) |
void | XRgb2YCrCb_EnableDbgByPass (XRgb2YCrCb *InstancePtr) |
int | XRgb2YCrCb_IsDbgByPassEnabled (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_DisableDbgBypass (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_EnableDbgTestPattern (XRgb2YCrCb *InstancePtr) |
int | XRgb2YCrCb_IsDbgTestPatternEnabled (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_DisableDbgTestPattern (XRgb2YCrCb *InstancePtr) |
u32 | XRgb2YCrCb_GetVersion (XRgb2YCrCb *InstancePtr) |
u32 | XRgb2YCrCb_GetDbgFrameCount (XRgb2YCrCb *InstancePtr) |
u32 | XRgb2YCrCb_GetDbgLineCount (XRgb2YCrCb *InstancePtr) |
u32 | XRgb2YCrCb_GetDbgPixelCount (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_Setup (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetActiveSize (XRgb2YCrCb *InstancePtr, u16 HSize, u16 VSize) |
void | XRgb2YCrCb_GetActiveSize (XRgb2YCrCb *InstancePtr, u16 *HSize, u16 *VSize) |
void | XRgb2YCrCb_SetYMax (XRgb2YCrCb *InstancePtr, u32 YMax) |
u32 | XRgb2YCrCb_GetYMax (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetYMin (XRgb2YCrCb *InstancePtr, u32 YMin) |
u32 | XRgb2YCrCb_GetYMin (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCbMax (XRgb2YCrCb *InstancePtr, u32 CbMax) |
u32 | XRgb2YCrCb_GetCbMax (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCbMin (XRgb2YCrCb *InstancePtr, u32 CbMin) |
u32 | XRgb2YCrCb_GetCbMin (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCrMax (XRgb2YCrCb *InstancePtr, u32 CrMax) |
u32 | XRgb2YCrCb_GetCrMax (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCrMin (XRgb2YCrCb *InstancePtr, u32 CrMin) |
u32 | XRgb2YCrCb_GetCrMin (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetYOffset (XRgb2YCrCb *InstancePtr, u32 YOffset) |
u32 | XRgb2YCrCb_GetYOffset (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCbOffset (XRgb2YCrCb *InstancePtr, u32 CbOffset) |
u32 | XRgb2YCrCb_GetCbOffset (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCrOffset (XRgb2YCrCb *InstancePtr, u32 CrOffset) |
u32 | XRgb2YCrCb_GetCrOffset (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCoefs (XRgb2YCrCb *InstancePtr, double ACoef, double BCoef, double CCoef, double DCoef) |
void | XRgb2YCrCb_GetCoefs (XRgb2YCrCb *InstancePtr, double *ACoef, double *BCoef, double *CCoef, double *DCoef) |
void | XRgb2YCrCb_Select_Standard (XRgb2YCrCb *InstancePtr, enum Standards StandardSel, enum OutputRanges InputRange, u32 DataWidth, struct XRgb2YCrCb_Coef_Inputs *CoefIn) |
u32 | XRgb2YCrCb_Coefficient_Translation (XRgb2YCrCb *InstancePtr, struct XRgb2YCrCb_Coef_Inputs *CoefIn, struct XRgb2YCrCb_Coef_Outputs *CoefOut, u32 DataWidth) |
void | XRgb2YCrCb_Select_OutputRange (XRgb2YCrCb *InstancePtr, enum OutputRanges Range) |
int XRgb2YCrCb_CfgInitialize | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | XRgb2YCrCb_Config * | +CfgPtr, | +|
+ | + | u32 | +EffectiveAddr | + |
+ | ) | ++ |
+This function initializes the Rgb2YCrCb core. This function must be called prior to using the Rgb2YCrCb core. Initialization of the Rgb2YCrCb includes setting up the instance data and ensuring the hardware is in a quiescent state.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CfgPtr | is a reference to a structure containing information about a specific XRgb2YCrCb 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. |
u32 XRgb2YCrCb_Coefficient_Translation | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | struct XRgb2YCrCb_Coef_Inputs * | +CoefIn, | +|
+ | + | struct XRgb2YCrCb_Coef_Outputs * | +CoefOut, | +|
+ | + | u32 | +DataWidth | + |
+ | ) | ++ |
+This function translates the XRgb2YCrCb_Coef_Inputs structure into the XRgb2YCrCb_Coef_Outputs structure that can be used to program the core's registers. The XRgb2YCrCb_Coef_Inputs structure uses the same values as the core's GUIs. The XRgb2YCrCb_Coef_Outputs structure uses the values that can be programmed into the core's registers.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CoefIn | specifies a pointer to a XRgb2YCrCb_Coef_Inputs structure to be translated. | |
CoefOut | specifies a pointer to a XRgb2YCrCb_Coef_Outputs structure with translated values. | |
DataWidth | specifies a valid range of [8,10,12,16] that needs to be set. |
void XRgb2YCrCb_DisableDbgBypass | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function disables Bypass mode.
+
InstancePtr | is a pointer to the XRgb2YCrCb core instance to be worked on. |
void XRgb2YCrCb_DisableDbgTestPattern | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function disables debug test pattern mode.
+
InstancePtr | is a pointer to the XRgb2YCrCb core instance to be worked on. |
void XRgb2YCrCb_EnableDbgByPass | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function sets the bypass bit of control register to switch the core to bypass mode if debug is enabled in the IP.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_EnableDbgTestPattern | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function switches the core to test-pattern generator mode if debug feature is enabled.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_GetActiveSize | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u16 * | +HSize, | +|
+ | + | u16 * | +VSize | + |
+ | ) | ++ |
+This function gets the active H/V sizes of the Rgb2YCrCb core from active size register.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
HSize | is a pointer to 16-bit variable in which the number of Active Pixels per scanline is returned within the range [32, 7680]. | |
VSize | is a pointer to 16-bit variable in which the number of Active Lines per frame is returned within the range [32, 7680]. |
u32 XRgb2YCrCb_GetCbMax | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the maximum value on the Cb Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetCbMin | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the minimum value on the Cb Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetCbOffset | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the offset compensation value for the Cb Chroma channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_GetCoefs | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | double * | +ACoef, | +|
+ | + | double * | +BCoef, | +|
+ | + | double * | +CCoef, | +|
+ | + | double * | +DCoef | + |
+ | ) | ++ |
+This function returns A, B, C and D coefficients.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
ACoef | is a pointer to double variable in which A coefficient is returned within the range [0.0 to 1.0]. | |
BCoef | is a pointer to double variable in which B coefficient is returned within the range [0.0 to 1.0]. | |
CCoef | is a pointer to double variable in which C coefficient is returned within the range [0.0 to 1.0]. | |
DCoef | is a pointer to double variable in which D coefficient is returned within the range [0.0 to 1.0]. |
u32 XRgb2YCrCb_GetCrMax | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the maximum value on the Cr Chroma channel of the output
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetCrMin | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the minimum value on the Cr Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetCrOffset | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the offset compensation value of the Cr Chroma channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetDbgFrameCount | +( | +XRgb2YCrCb * | +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.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetDbgLineCount | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns Line count, the number of lines processed since power-up. This is available only if the debugging feature is enabled.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetDbgPixelCount | +( | +XRgb2YCrCb * | +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.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetVersion | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function facilitates software identification of exact version of the RGB2YCrCb hardware (h/w).
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetYMax | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the maximum value of the Luma (Y) channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetYMin | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the minimum value of the Luma (Y) channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetYOffset | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the offset compensation value for the Luma (Y) channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
int XRgb2YCrCb_IsDbgByPassEnabled | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the current bypass mode of a core.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
int XRgb2YCrCb_IsDbgTestPatternEnabled | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the test-pattern generator mode (enabled or not), if debug feature is enabled.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_Select_OutputRange | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | enum OutputRanges | +Range | + |
+ | ) | ++ |
+This function governs the range of outputs Y, Cr and Cb by affecting the conversion coefficients as well as the clipping and clamping values.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
Range | needs to be set from the enum OutputRanges values as: 0 = XRGB_TV_16_TO_240, 1 = XRGB_STUDIO_16_TO_235, 2 = XRGB_GRAPHICS_0_TO_255. |
void XRgb2YCrCb_Select_Standard | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | enum Standards | +StandardSel, | +|
+ | + | enum OutputRanges | +InputRange, | +|
+ | + | u32 | +DataWidth, | +|
+ | + | struct XRgb2YCrCb_Coef_Inputs * | +CoefIn | + |
+ | ) | ++ |
+This function populates an XRgb2YCrCb_Coef_Inputs structure with the values from the selected video standard.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
StandardSel | needs to be set from enum Standards value as : 0 = XRGB_STANDARD_ITU_601_SD 1 = XRGB_STANDARD_ITU_709_NTSC 2 = XRGB_STANDARD_ITU_709_PAL 3 = XRGB_STANDARD_YUV. | |
InputRange | needs to be set from enum OutputRanges value as: 0 = XRGB_TV_16_TO_240, 1 = XRGB_STUDIO_16_TO_235, 2 = XRGB_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 XRgb2YCrCb_Coef_Inputs structure which is populated with the values from selected video standard. |
void XRgb2YCrCb_SetActiveSize | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u16 | +HSize, | +|
+ | + | u16 | +VSize | + |
+ | ) | ++ |
+This function sets active H/V sizes in the active size register.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
HSize | specifies the number of Active Pixels per scanline that needs to be set within the range [32, 7680]. | |
VSize | specifies the number of Active Lines per frame that needs to be set within the range [32, 7680]. |
void XRgb2YCrCb_SetCbMax | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CbMax | + |
+ | ) | ++ |
+This function sets the maximum value allowed on the Cb Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CbMax | specifies the maximum value within range [0, 255] of Cb Chroma channel that needs to be set. |
void XRgb2YCrCb_SetCbMin | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CbMin | + |
+ | ) | ++ |
+This function sets the minimum value allowed on the Cb Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CbMin | specifies the maximum value within range [0, 255] of Cb Chroma channel needs to set. |
void XRgb2YCrCb_SetCbOffset | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CbOffset | + |
+ | ) | ++ |
+This function sets the offset compensation value for the Cb Chroma channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CbOffset | specifies the compensation value within range [0, 255] of Cb Chroma channel that needs to be set. |
void XRgb2YCrCb_SetCoefs | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | double | +ACoef, | +|
+ | + | double | +BCoef, | +|
+ | + | double | +CCoef, | +|
+ | + | double | +DCoef | + |
+ | ) | ++ |
+This function sets A, B, C and D coefficients.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
ACoef | specifies the A coefficient value within the range [0.0 to 1.0] that needs to be set. | |
BCoef | specifies the B coefficient value within the range [0.0 to 1.0] that needs to be set. | |
CCoef | specifies the C coefficient value within the range [0.0 to 1.0] that needs to be set. | |
DCoef | specifies the D coefficient value within the range [0.0 to 1.0] that needs to be set. |
void XRgb2YCrCb_SetCrMax | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CrMax | + |
+ | ) | ++ |
+This function sets the maximum value allowed on the Cr Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CrMax | specifies the maximum value within range [0, 255] of Cr Chroma channel that needs to be set. |
void XRgb2YCrCb_SetCrMin | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CrMin | + |
+ | ) | ++ |
+This function sets the minimum value allowed on the Cr Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CrMin | specifies the minimum value within range [0, 255] of Cr Chroma channel that needs to be set. |
void XRgb2YCrCb_SetCrOffset | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CrOffset | + |
+ | ) | ++ |
+This function sets the offset compensation value for the Cr Chroma channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CrOffset | specifies the compensation value within range [0, 255] of Cr Chroma channel that needs to be set. |
void XRgb2YCrCb_Setup | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function sets up double buffered ACTIVE_SIZE register and enables the register update.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_SetYMax | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +YMax | + |
+ | ) | ++ |
+This function sets the maximum value allowed on the Luma (Y) channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
YMax | specifies the maximum value within range [0, 255] of Luma channel that needs to be set. |
void XRgb2YCrCb_SetYMin | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +YMin | + |
+ | ) | ++ |
+This function sets the minimum value allowed on the Luma (Y) channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
YMin | specifies the minimum value within range [0, 255] of Luma channel that needs to be set. |
void XRgb2YCrCb_SetYOffset | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +YOffset | + |
+ | ) | ++ |
+This function sets the offset compensation value for the Luma (Y) channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
YOffset | specifies the compensation value within range [0, 255] of Luma channel that needs to be set. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb_8h.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb_8h.html new file mode 100644 index 00000000..748f5d4e --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb_8h.html @@ -0,0 +1,2575 @@ + +
+ +
+#include "xrgb2ycrcb_hw.h"
+#include "xil_assert.h"
+#include "xstatus.h"
+
Classes | |
struct | XRgb2YCrCb_Config |
struct | XRgb2YCrCb |
struct | XRgb2YCrCb_Coef_Inputs |
struct | XRgb2YCrCb_Coef_Outputs |
Active size range macros | |
#define | XRGB_VSIZE_FIRST 32 |
#define | XRGB_VSIZE_LAST 7680 |
#define | XRGB_HSIZE_FIRST 32 |
#define | XRGB_HSIZE_LAST 7680 |
Ymax range macros | |
#define | XRGB_YMAX_FIRST 0 |
#define | XRGB_YMAX_LAST 255 |
Ymin range macros | |
#define | XRGB_YMIN_FIRST 0 |
#define | XRGB_YMIN_LAST 255 |
Yoffset range macros | |
#define | XRGB_YOFFSET_FIRST 0 |
#define | XRGB_YOFFSET_LAST 255 |
Cbmax range macros | |
#define | XRGB_CBMAX_FIRST 0 |
#define | XRGB_CBMAX_LAST 255 |
Cbmin range macros | |
#define | XRGB_CBMIN_FIRST 0 |
#define | XRGB_CBMIN_LAST 255 |
Cboffset range macros | |
#define | XRGB_CBOFFSET_FIRST 0 |
#define | XRGB_CBOFFSET_LAST 255 |
Crmax range macros | |
#define | XRGB_CRMAX_FIRST 0 |
#define | XRGB_CRMAX_LAST 255 |
Crmin range macros | |
#define | XRGB_CRMIN_FIRST 0 |
#define | XRGB_CRMIN_LAST 255 |
Croffset range macros | |
#define | XRGB_CROFFSET_FIRST 0 |
#define | XRGB_CROFFSET_LAST 255 |
Handler Types | |
enum | { XRGB_HANDLER_PROCSTART = 1, +XRGB_HANDLER_FRAMEDONE, +XRGB_HANDLER_ERROR + } |
Standard Types | |
enum | Standards { + XRGB_STANDARD_ITU_601_SD = 0, +XRGB_STANDARD_ITU_709_NTSC, +XRGB_STANDARD_ITU_709_PAL, +XRGB_STANDARD_YUV, + + XRGB_STANDARD_CUSTOM + + } |
Output Ranges | |
enum | OutputRanges { XRGB_TV_16_TO_240 = 0, +XRGB_STUDIO_16_TO_235, +XRGB_GRAPHICS_0_TO_255 + } |
Defines | |
#define | XRGB2YCRCB_H_ |
#define | XRgb2YCrCb_Enable(InstancePtr) |
#define | XRgb2YCrCb_Disable(InstancePtr) |
#define | XRgb2YCrCb_Start XRgb2YCrCb_Enable |
#define | XRgb2YCrCb_Stop XRgb2YCrCb_Disable |
#define | XRgb2YCrCb_RegUpdateEnable(InstancePtr) |
#define | XRgb2YCrCb_RegUpdateDisable(InstancePtr) |
#define | XRgb2YCrCb_SyncReset(InstancePtr) |
#define | XRgb2YCrCb_Reset(InstancePtr) |
#define | XRgb2YCrCb_IntrEnable(InstancePtr, IntrType) |
#define | XRgb2YCrCb_IntrDisable(InstancePtr, IntrType) |
#define | XRgb2YCrCb_StatusGetPending(InstancePtr) |
#define | XRgb2YCrCb_IntrGetPending(InstancePtr) |
#define | XRgb2YCrCb_IntrClear(InstancePtr, IntrType) |
Typedefs | |
typedef void(*) | XRgb2YCrCb_CallBack (void *CallBackRef) |
typedef void(*) | XRgb2YCrCb_ErrorCallBack (void *CallBackRef, u32 ErrorMask) |
Functions | |
XRgb2YCrCb_Config * | XRgb2YCrCb_LookupConfig (u16 DeviceId) |
int | XRgb2YCrCb_CfgInitialize (XRgb2YCrCb *InstancePtr, XRgb2YCrCb_Config *CfgPtr, u32 EffectiveAddr) |
void | XRgb2YCrCb_EnableDbgByPass (XRgb2YCrCb *InstancePtr) |
int | XRgb2YCrCb_IsDbgByPassEnabled (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_DisableDbgBypass (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_EnableDbgTestPattern (XRgb2YCrCb *InstancePtr) |
int | XRgb2YCrCb_IsDbgTestPatternEnabled (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_DisableDbgTestPattern (XRgb2YCrCb *InstancePtr) |
u32 | XRgb2YCrCb_GetVersion (XRgb2YCrCb *InstancePtr) |
u32 | XRgb2YCrCb_GetDbgFrameCount (XRgb2YCrCb *InstancePtr) |
u32 | XRgb2YCrCb_GetDbgLineCount (XRgb2YCrCb *InstancePtr) |
u32 | XRgb2YCrCb_GetDbgPixelCount (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_Setup (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetActiveSize (XRgb2YCrCb *InstancePtr, u16 HSize, u16 VSize) |
void | XRgb2YCrCb_GetActiveSize (XRgb2YCrCb *InstancePtr, u16 *HSize, u16 *VSize) |
void | XRgb2YCrCb_SetYMax (XRgb2YCrCb *InstancePtr, u32 YMax) |
u32 | XRgb2YCrCb_GetYMax (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetYMin (XRgb2YCrCb *InstancePtr, u32 YMin) |
u32 | XRgb2YCrCb_GetYMin (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCbMax (XRgb2YCrCb *InstancePtr, u32 CbMax) |
u32 | XRgb2YCrCb_GetCbMax (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCbMin (XRgb2YCrCb *InstancePtr, u32 CbMin) |
u32 | XRgb2YCrCb_GetCbMin (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCrMax (XRgb2YCrCb *InstancePtr, u32 CrMax) |
u32 | XRgb2YCrCb_GetCrMax (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCrMin (XRgb2YCrCb *InstancePtr, u32 CrMin) |
u32 | XRgb2YCrCb_GetCrMin (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetYOffset (XRgb2YCrCb *InstancePtr, u32 YOffset) |
u32 | XRgb2YCrCb_GetYOffset (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCbOffset (XRgb2YCrCb *InstancePtr, u32 CbOffset) |
u32 | XRgb2YCrCb_GetCbOffset (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCrOffset (XRgb2YCrCb *InstancePtr, u32 CrOffset) |
u32 | XRgb2YCrCb_GetCrOffset (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_SetCoefs (XRgb2YCrCb *InstancePtr, double ACoef, double BCoef, double CCoef, double DCoef) |
void | XRgb2YCrCb_GetCoefs (XRgb2YCrCb *InstancePtr, double *ACoef, double *BCoef, double *CCoef, double *DCoef) |
void | XRgb2YCrCb_Select_Standard (XRgb2YCrCb *InstancePtr, enum Standards StandardSel, enum OutputRanges InputRange, u32 DataWidth, struct XRgb2YCrCb_Coef_Inputs *CoefIn) |
u32 | XRgb2YCrCb_Coefficient_Translation (XRgb2YCrCb *InstancePtr, struct XRgb2YCrCb_Coef_Inputs *CoefIn, struct XRgb2YCrCb_Coef_Outputs *CoefOut, u32 Data_Width) |
void | XRgb2YCrCb_Select_OutputRange (XRgb2YCrCb *InstancePtr, enum OutputRanges Range) |
int | XRgb2YCrCb_SelfTest (XRgb2YCrCb *InstancePtr) |
void | XRgb2YCrCb_IntrHandler (void *InstancePtr) |
int | XRgb2YCrCb_SetCallBack (XRgb2YCrCb *InstancePtr, u32 HandlerType, void *CallBackFunc, void *CallBackRef) |
#define XRgb2YCrCb_Disable | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET))) & (~(XRGB_CTL_SW_EN_MASK)))) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. |
#define XRgb2YCrCb_Enable | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET))) | (XRGB_CTL_SW_EN_MASK))) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. |
#define XRGB2YCRCB_H_ | +
+Prevent circular inclusions by using protection macros +
#define XRgb2YCrCb_IntrClear | +( | +InstancePtr, | |||
+ | + | IntrType | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_STATUS_OFFSET), ((IntrType) & \ + (XRGB_IXR_ALLINTR_MASK))) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. | |
IntrType | is the pending interrupts to clear/acknowledge. Use OR'ing of XRGB_IXR_*_MASK constants defined in xrgb2ycrcb_hw.h to create this parameter value. |
#define XRgb2YCrCb_IntrDisable | +( | +InstancePtr, | |||
+ | + | IntrType | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET))) & ((~(IntrType)) & \ + (XRGB_IXR_ALLINTR_MASK)))) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. | |
IntrType | is the bit-mask of the interrupts to be disabled. Bit positions of 1 will be disabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XRGB_IXR_*_MASK bits defined in xrgb2ycrcb_hw.h. |
#define XRgb2YCrCb_IntrEnable | +( | +InstancePtr, | |||
+ | + | IntrType | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET), (((IntrType) & \ + (XRGB_IXR_ALLINTR_MASK)) | \ + (XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET))))) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. | |
IntrType | is the bit-mask of the interrupts to be enabled. Bit positions of 1 will be enabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XRGB_IXR_*_MASK bits defined in xrgb2ycrcb_hw.h. |
#define XRgb2YCrCb_IntrGetPending | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET)) & \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_STATUS_OFFSET))) & ((u32)(XRGB_IXR_ALLINTR_MASK))) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. |
#define XRgb2YCrCb_RegUpdateDisable | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET)))) & (~(XRGB_CTL_RUE_MASK))) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. |
#define XRgb2YCrCb_RegUpdateEnable | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET))) | (XRGB_CTL_RUE_MASK))) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. |
#define XRgb2YCrCb_Reset | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), (XRGB_CTL_RESET_MASK)) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. |
#define XRgb2YCrCb_Start XRgb2YCrCb_Enable | +
+This function macro enables/starts the Rgb2YCrCb core.
+
InstancePtr | is a pointer to the Rgb2YCrCb instance to be worked on |
#define XRgb2YCrCb_StatusGetPending | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_STATUS_OFFSET)) & (XRgb2YCrCb_IXR_ALLINTR_MASK) +
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. |
#define XRgb2YCrCb_Stop XRgb2YCrCb_Disable | +
+This function macro disables/stops the Rgb2YCrCb core.
+
InstancePtr | is a pointer to the Rgb2YCrCb instance to be worked on |
#define XRgb2YCrCb_SyncReset | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), (XRGB_CTL_AUTORESET_MASK)) +
+On the next rising-edge of VBlank_in following a call to XRgb2YCrCb_SyncReset(), all of the core's configuration registers and outputs will be reset, then the reset flag will be immediately released, allowing the core to immediately resume default operation.
+
InstancePtr | is a pointer to the Rgb2YCrCb core instance to be worked on. |
#define XRGB_CBMAX_FIRST 0 | +
+Cbmax starting value +
#define XRGB_CBMAX_LAST 255 | +
+Cbmax ending value +
#define XRGB_CBMIN_FIRST 0 | +
+Cbmin starting value +
#define XRGB_CBMIN_LAST 255 | +
+Cbmin ending value +
#define XRGB_CBOFFSET_FIRST 0 | +
+Cboffset starting value +
#define XRGB_CBOFFSET_LAST 255 | +
+Cboffset ending value +
#define XRGB_CRMAX_FIRST 0 | +
+Crmax starting value +
#define XRGB_CRMAX_LAST 255 | +
+Crmax ending value +
#define XRGB_CRMIN_FIRST 0 | +
+Crmin starting value +
#define XRGB_CRMIN_LAST 255 | +
+Crmin ending value +
#define XRGB_CROFFSET_FIRST 0 | +
+Croffset starting value +
#define XRGB_CROFFSET_LAST 255 | +
+Croffset ending value +
#define XRGB_HSIZE_FIRST 32 | +
+HSize starting value +
#define XRGB_HSIZE_LAST 7680 | +
+HSize ending value +
#define XRGB_VSIZE_FIRST 32 | +
+VSize starting value +
#define XRGB_VSIZE_LAST 7680 | +
+VSize ending value +
#define XRGB_YMAX_FIRST 0 | +
+Ymax starting value +
#define XRGB_YMAX_LAST 255 | +
+Ymax ending value +
#define XRGB_YMIN_FIRST 0 | +
+Ymin starting value +
#define XRGB_YMIN_LAST 255 | +
+Ymax ending value +
#define XRGB_YOFFSET_FIRST 0 | +
+Yoffset starting value +
#define XRGB_YOFFSET_LAST 255 | +
+Yoffset ending value +
+
typedef void(*) XRgb2YCrCb_CallBack(void *CallBackRef) | +
+Callback type for all interrupts except error interrupt.
+
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. |
typedef void(*) XRgb2YCrCb_ErrorCallBack(void *CallBackRef, u32 ErrorMask) | +
+This data type defines a handler that an application defines to communicate with interrupt system to retrieve error information while processing video frame.
+
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. | |
ErrorMask | is a bit mask indicating the cause of the error. Its value equals 'OR'ing one or more XRGB_IXR_*_MASK values defined in xrgb2ycrcb_hw.h. |
+
anonymous enum | +
+These constants specify different types of handler and used to differentiate interrupt requests from core.
+ +enum OutputRanges | +
+These constants specify different ranges used for studio equipment, television and computer graphics respectively.
+ +enum Standards | +
+These constants specify different types of standards used to represent standard color encoding.
+ ++
int XRgb2YCrCb_CfgInitialize | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | XRgb2YCrCb_Config * | +CfgPtr, | +|
+ | + | u32 | +EffectiveAddr | + |
+ | ) | ++ |
+This function initializes the Rgb2YCrCb core. This function must be called prior to using the Rgb2YCrCb core. Initialization of the Rgb2YCrCb includes setting up the instance data and ensuring the hardware is in a quiescent state.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CfgPtr | is a reference to a structure containing information about a specific XRgb2YCrCb 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. |
u32 XRgb2YCrCb_Coefficient_Translation | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | struct XRgb2YCrCb_Coef_Inputs * | +CoefIn, | +|
+ | + | struct XRgb2YCrCb_Coef_Outputs * | +CoefOut, | +|
+ | + | u32 | +DataWidth | + |
+ | ) | ++ |
+This function translates the XRgb2YCrCb_Coef_Inputs structure into the XRgb2YCrCb_Coef_Outputs structure that can be used to program the core's registers. The XRgb2YCrCb_Coef_Inputs structure uses the same values as the core's GUIs. The XRgb2YCrCb_Coef_Outputs structure uses the values that can be programmed into the core's registers.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CoefIn | specifies a pointer to a XRgb2YCrCb_Coef_Inputs structure to be translated. | |
CoefOut | specifies a pointer to a XRgb2YCrCb_Coef_Outputs structure with translated values. | |
DataWidth | specifies a valid range of [8,10,12,16] that needs to be set. |
void XRgb2YCrCb_DisableDbgBypass | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function disables Bypass mode.
+
InstancePtr | is a pointer to the XRgb2YCrCb core instance to be worked on. |
void XRgb2YCrCb_DisableDbgTestPattern | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function disables debug test pattern mode.
+
InstancePtr | is a pointer to the XRgb2YCrCb core instance to be worked on. |
void XRgb2YCrCb_EnableDbgByPass | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function sets the bypass bit of control register to switch the core to bypass mode if debug is enabled in the IP.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_EnableDbgTestPattern | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function switches the core to test-pattern generator mode if debug feature is enabled.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_GetActiveSize | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u16 * | +HSize, | +|
+ | + | u16 * | +VSize | + |
+ | ) | ++ |
+This function gets the active H/V sizes of the Rgb2YCrCb core from active size register.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
HSize | is a pointer to 16-bit variable in which the number of Active Pixels per scanline is returned within the range [32, 7680]. | |
VSize | is a pointer to 16-bit variable in which the number of Active Lines per frame is returned within the range [32, 7680]. |
u32 XRgb2YCrCb_GetCbMax | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the maximum value on the Cb Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetCbMin | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the minimum value on the Cb Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetCbOffset | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the offset compensation value for the Cb Chroma channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_GetCoefs | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | double * | +ACoef, | +|
+ | + | double * | +BCoef, | +|
+ | + | double * | +CCoef, | +|
+ | + | double * | +DCoef | + |
+ | ) | ++ |
+This function returns A, B, C and D coefficients.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
ACoef | is a pointer to double variable in which A coefficient is returned within the range [0.0 to 1.0]. | |
BCoef | is a pointer to double variable in which B coefficient is returned within the range [0.0 to 1.0]. | |
CCoef | is a pointer to double variable in which C coefficient is returned within the range [0.0 to 1.0]. | |
DCoef | is a pointer to double variable in which D coefficient is returned within the range [0.0 to 1.0]. |
u32 XRgb2YCrCb_GetCrMax | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the maximum value on the Cr Chroma channel of the output
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetCrMin | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the minimum value on the Cr Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetCrOffset | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the offset compensation value of the Cr Chroma channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetDbgFrameCount | +( | +XRgb2YCrCb * | +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.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetDbgLineCount | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns Line count, the number of lines processed since power-up. This is available only if the debugging feature is enabled.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetDbgPixelCount | +( | +XRgb2YCrCb * | +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.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetVersion | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function facilitates software identification of exact version of the RGB2YCrCb hardware (h/w).
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetYMax | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the maximum value of the Luma (Y) channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetYMin | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the minimum value of the Luma (Y) channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
u32 XRgb2YCrCb_GetYOffset | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the offset compensation value for the Luma (Y) channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_IntrHandler | +( | +void * | +InstancePtr | +) | ++ |
+This function is the interrupt handler for the RGB2YCRCB driver.
+This handler reads the pending interrupt from the IER(IRQ_ENABLE register) or ISR (STATUS register), determines the source of the interrupts, calls according callbacks, and finally clears the interrupts.
+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 XRgb2YCrCb_SetCallBack() during initialization phase.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance that just interrupted. |
int XRgb2YCrCb_IsDbgByPassEnabled | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the current bypass mode of a core.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
int XRgb2YCrCb_IsDbgTestPatternEnabled | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function returns the test-pattern generator mode (enabled or not), if debug feature is enabled.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
XRgb2YCrCb_Config* XRgb2YCrCb_LookupConfig | +( | +u16 | +DeviceId | +) | ++ |
+This function returns a reference to an XRgb2YCrCb_Config structure based on the unique core id, DeviceId. The return value will refer to an entry in the core configuration table defined in the xrgb2ycrcb_g.c file.
+
DeviceId | is the unique core ID of the core for the lookup operation. |
void XRgb2YCrCb_Select_OutputRange | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | enum OutputRanges | +Range | + |
+ | ) | ++ |
+This function governs the range of outputs Y, Cr and Cb by affecting the conversion coefficients as well as the clipping and clamping values.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
Range | needs to be set from the enum OutputRanges values as: 0 = XRGB_TV_16_TO_240, 1 = XRGB_STUDIO_16_TO_235, 2 = XRGB_GRAPHICS_0_TO_255. |
void XRgb2YCrCb_Select_Standard | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | enum Standards | +StandardSel, | +|
+ | + | enum OutputRanges | +InputRange, | +|
+ | + | u32 | +DataWidth, | +|
+ | + | struct XRgb2YCrCb_Coef_Inputs * | +CoefIn | + |
+ | ) | ++ |
+This function populates an XRgb2YCrCb_Coef_Inputs structure with the values from the selected video standard.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
StandardSel | needs to be set from enum Standards value as : 0 = XRGB_STANDARD_ITU_601_SD 1 = XRGB_STANDARD_ITU_709_NTSC 2 = XRGB_STANDARD_ITU_709_PAL 3 = XRGB_STANDARD_YUV. | |
InputRange | needs to be set from enum OutputRanges value as: 0 = XRGB_TV_16_TO_240, 1 = XRGB_STUDIO_16_TO_235, 2 = XRGB_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 XRgb2YCrCb_Coef_Inputs structure which is populated with the values from selected video standard. |
int XRgb2YCrCb_SelfTest | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function reads version register of RGB2YCRCB core and compares with zero as part of self test.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_SetActiveSize | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u16 | +HSize, | +|
+ | + | u16 | +VSize | + |
+ | ) | ++ |
+This function sets active H/V sizes in the active size register.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
HSize | specifies the number of Active Pixels per scanline that needs to be set within the range [32, 7680]. | |
VSize | specifies the number of Active Lines per frame that needs to be set within the range [32, 7680]. |
int XRgb2YCrCb_SetCallBack | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +HandlerType, | +|
+ | + | void * | +CallBackFunc, | +|
+ | + | void * | +CallBackRef | + |
+ | ) | ++ |
+This routine installs an asynchronous callback function for the given HandlerType:
+
+ HandlerType Callback Function Type + ----------------------- -------------------------------------------------- + XRGB_HANDLER_PROCSTART ProcStartCallBack + XRGB_HANDLER_FRAMEDONE FrameDoneCallBack + XRGB_HANDLER_ERROR ErrCallBack +
+
InstancePtr | is a pointer to the XRgb2YCrCb instance to be worked on. | |
HandlerType | specifies which callback is to be attached. | |
CallBackFunc | is the address of the callback function. | |
CallBackRef | is a user data item that will be passed to the callback function when it is invoked. |
void XRgb2YCrCb_SetCbMax | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CbMax | + |
+ | ) | ++ |
+This function sets the maximum value allowed on the Cb Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CbMax | specifies the maximum value within range [0, 255] of Cb Chroma channel that needs to be set. |
void XRgb2YCrCb_SetCbMin | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CbMin | + |
+ | ) | ++ |
+This function sets the minimum value allowed on the Cb Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CbMin | specifies the maximum value within range [0, 255] of Cb Chroma channel needs to set. |
void XRgb2YCrCb_SetCbOffset | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CbOffset | + |
+ | ) | ++ |
+This function sets the offset compensation value for the Cb Chroma channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CbOffset | specifies the compensation value within range [0, 255] of Cb Chroma channel that needs to be set. |
void XRgb2YCrCb_SetCoefs | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | double | +ACoef, | +|
+ | + | double | +BCoef, | +|
+ | + | double | +CCoef, | +|
+ | + | double | +DCoef | + |
+ | ) | ++ |
+This function sets A, B, C and D coefficients.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
ACoef | specifies the A coefficient value within the range [0.0 to 1.0] that needs to be set. | |
BCoef | specifies the B coefficient value within the range [0.0 to 1.0] that needs to be set. | |
CCoef | specifies the C coefficient value within the range [0.0 to 1.0] that needs to be set. | |
DCoef | specifies the D coefficient value within the range [0.0 to 1.0] that needs to be set. |
void XRgb2YCrCb_SetCrMax | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CrMax | + |
+ | ) | ++ |
+This function sets the maximum value allowed on the Cr Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CrMax | specifies the maximum value within range [0, 255] of Cr Chroma channel that needs to be set. |
void XRgb2YCrCb_SetCrMin | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CrMin | + |
+ | ) | ++ |
+This function sets the minimum value allowed on the Cr Chroma channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CrMin | specifies the minimum value within range [0, 255] of Cr Chroma channel that needs to be set. |
void XRgb2YCrCb_SetCrOffset | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +CrOffset | + |
+ | ) | ++ |
+This function sets the offset compensation value for the Cr Chroma channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
CrOffset | specifies the compensation value within range [0, 255] of Cr Chroma channel that needs to be set. |
void XRgb2YCrCb_Setup | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function sets up double buffered ACTIVE_SIZE register and enables the register update.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
void XRgb2YCrCb_SetYMax | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +YMax | + |
+ | ) | ++ |
+This function sets the maximum value allowed on the Luma (Y) channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
YMax | specifies the maximum value within range [0, 255] of Luma channel that needs to be set. |
void XRgb2YCrCb_SetYMin | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +YMin | + |
+ | ) | ++ |
+This function sets the minimum value allowed on the Luma (Y) channel of the output.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
YMin | specifies the minimum value within range [0, 255] of Luma channel that needs to be set. |
void XRgb2YCrCb_SetYOffset | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +YOffset | + |
+ | ) | ++ |
+This function sets the offset compensation value for the Luma (Y) channel.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. | |
YOffset | specifies the compensation value within range [0, 255] of Luma channel that needs to be set. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__g_8c.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__g_8c.html new file mode 100644 index 00000000..c507d688 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__g_8c.html @@ -0,0 +1,50 @@ + +
+ +
+#include "xparameters.h"
+#include "xrgb2ycrcb.h"
+
Variables | |
XRgb2YCrCb_Config | XRgb2YCrCb_ConfigTable [] |
XRgb2YCrCb_Config XRgb2YCrCb_ConfigTable[] | +
+ +
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__hw_8h.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__hw_8h.html new file mode 100644 index 00000000..8f2adb03 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__hw_8h.html @@ -0,0 +1,1810 @@ + +
+ ++
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------ -------- ----------------------------------------------------- + 7.0 adk 01/28/14 First release. + Added the register offsets and bit masks for the + registers. + Added backward compatibility macros. ++
+#include "xil_io.h"
+
Control Registers | |
Control registers offset for RGB2YCRCB core. | |
#define | XRGB_CONTROL_OFFSET 0x000 |
#define | XRGB_STATUS_OFFSET 0x004 |
#define | XRGB_ERROR_OFFSET 0x008 |
#define | XRGB_IRQ_EN_OFFSET 0x00C |
#define | XRGB_VERSION_OFFSET 0x010 |
#define | XRGB_SYSDEBUG0_OFFSET 0x014 |
#define | XRGB_SYSDEBUG1_OFFSET 0x018 |
#define | XRGB_SYSDEBUG2_OFFSET 0x01C |
Timing Control Registers | |
Timing control registers offset for RGB2YCRCB core. | |
#define | XRGB_ACTIVE_SIZE_OFFSET 0x020 |
Core Specific Registers | |
Core specific registers offset. | |
#define | XRGB_YMAX_OFFSET 0x100 |
#define | XRGB_YMIN_OFFSET 0x104 |
#define | XRGB_CBMAX_OFFSET 0x108 |
#define | XRGB_CBMIN_OFFSET 0x10C |
#define | XRGB_CRMAX_OFFSET 0x110 |
#define | XRGB_CRMIN_OFFSET 0x114 |
#define | XRGB_YOFFSET_OFFSET 0x118 |
#define | XRGB_CBOFFSET_OFFSET 0x11C |
#define | XRGB_CROFFSET_OFFSET 0x120 |
#define | XRGB_ACOEF_OFFSET 0x124 |
#define | XRGB_BCOEF_OFFSET 0x128 |
#define | XRGB_CCOEF_OFFSET 0x12C |
#define | XRGB_DCOEF_OFFSET 0x130 |
Control Register Bit Masks | |
Control Register bit definition for RGB2YCRCB core. | |
#define | XRGB_CTL_SW_EN_MASK 0x00000001 |
#define | XRGB_CTL_RUE_MASK 0x00000002 |
#define | XRGB_CTL_BPE_MASK 0x00000010 |
#define | XRGB_CTL_TPE_MASK 0x00000020 |
#define | XRGB_CTL_AUTORESET_MASK 0x40000000 |
#define | XRGB_CTL_RESET_MASK 0x80000000 |
Slave Error Bit Masks | |
#define | XRGB_ERR_EOL_EARLY_MASK 0x000000001 |
#define | XRGB_ERR_EOL_LATE_MASK 0x000000002 |
#define | XRGB_ERR_SOF_EARLY_MASK 0x000000004 |
#define | XRGB_ERR_SOF_LATE_MASK 0x000000008 |
Interrupt Register Bit Masks | |
Interrupt Register bit definition for RGB2YCRCB core. It is applicable for STATUS and IRQ_ENABLE Registers. | |
#define | XRGB_IXR_PROC_STARTED_MASK 0x00000001 |
#define | XRGB_IXR_EOF_MASK 0x00000002 |
#define | XRGB_IXR_SE_MASK 0x00010000 |
#define | XRGB_IXR_ALLINTR_MASK 0x00010003 |
Version Register Bit Masks and Shifts | |
Version Register bit definition for RGB2YCRCB core. | |
#define | XRGB_VER_REV_NUM_MASK 0x000000FF |
#define | XRGB_VER_PID_MASK 0x00000F00 |
#define | XRGB_VER_REV_MASK 0x0000F000 |
#define | XRGB_VER_MINOR_MASK 0x00FF0000 |
#define | XRGB_VER_MAJOR_MASK 0xFF000000 |
#define | XRGB_VER_MAJOR_SHIFT 24 |
#define | XRGB_VER_MINOR_SHIFT 16 |
#define | XGMA_VER_REV_SHIFT 12 |
#define | XRGB_VER_INTERNAL_SHIFT 8 |
ActiveSize Register Bit Masks and Shift | |
#define | XRGB_ACTSIZE_NUM_PIXEL_MASK 0x00001FFF |
#define | XRGB_ACTSIZE_NUM_LINE_MASK 0x1FFF0000 |
#define | XRGB_ACTSIZE_NUM_LINE_SHIFT 16 |
YMax Register Bit Mask | |
#define | XRGB_YMAX_MASK 0x0000FFFF |
YMin Register Bit Mask | |
#define | XRGB_YMIN_MASK 0x0000FFFF |
CBMax Register Bit Mask | |
#define | XRGB_CBMAX_MASK 0x0000FFFF |
CBMin Register Bit Mask | |
#define | XRGB_CBMIN_MASK 0x0000FFFF |
CRMax Register Bit Mask | |
#define | XRGB_CRMAX_MASK 0x0000FFFF |
CRMin Register Bit Mask | |
#define | XRGB_CRMIN_MASK 0x0000FFFF |
YOffset Register Bit Mask | |
#define | XRGB_YOFFSET_MASK 0x0001FFFF |
CbOffset Register Bit Mask | |
#define | XRGB_CBOFFSET_MASK 0x0001FFFF |
CrOffset Register Bit Mask | |
#define | XRGB_CROFFSET_MASK 0x0001FFFF |
ACOEF, BCOEF, CCOEF, DCOEF Register Bit Mask | |
#define | XRGB_COEFF_MASK 0x0001FFFF |
General purpose Bit Mask and Shifts | |
#define | XRGB_8_BIT_MASK 0x000000FF |
#define | XRGB_16_BIT_MASK 0x0000FFFF |
#define | XRGB_16_BIT_COEF_SHIFT 16 |
Data widths in bits per color. | |
#define | XRGB_DATA_WIDTH_8 8 |
#define | XRGB_DATA_WIDTH_10 10 |
#define | XRGB_DATA_WIDTH_12 12 |
#define | XRGB_DATA_WIDTH_16 16 |
Backward Compatibility Macros | |
To support backward compatibility, following macro definitions are re-defined. | |
#define | RGB_CONTROL XRGB_CONTROL_OFFSET |
#define | RGB_STATUS XRGB_STATUS_OFFSET |
#define | RGB_ERROR XRGB_ERROR_OFFSET |
#define | RGB_IRQ_EN XRGB_IRQ_EN_OFFSET |
#define | RGB_VERSION XRGB_VERSION_OFFSET |
#define | RGB_SYSDEBUG0 XRGB_SYSDEBUG0_OFFSET |
#define | RGB_SYSDEBUG1 XRGB_SYSDEBUG1_OFFSET |
#define | RGB_SYSDEBUG2 XRGB_SYSDEBUG2_OFFSET |
#define | RGB_ACTIVE_SIZE XRGB_ACTIVE_SIZE_OFFSET |
#define | RGB_YMAX XRGB_YMAX_OFFSET |
#define | RGB_YMIN XRGB_YMIN_OFFSET |
#define | RGB_CBMAX XRGB_CBMAX_OFFSET |
#define | RGB_CBMIN XRGB_CBMIN_OFFSET |
#define | RGB_CRMAX XRGB_CRMAX_OFFSET |
#define | RGB_CRMIN XRGB_CRMIN_OFFSET |
#define | RGB_YOFFSET XRGB_YOFFSET_OFFSET |
#define | RGB_CBOFFSET XRGB_CBOFFSET_OFFSET |
#define | RGB_CROFFSET XRGB_CROFFSET_OFFSET |
#define | RGB_ACOEF XRGB_ACOEF_OFFSET |
#define | RGB_BCOEF XRGB_BCOEF_OFFSET |
#define | RGB_CCOEF XRGB_CCOEF_OFFSET |
#define | RGB_DCOEF XRGB_DCOEF_OFFSET |
#define | RGB_CTL_EN_MASK XRGB_CTL_EN_MASK |
#define | RGB_CTL_RUE_MASK XRGB_CTL_RUE_MASK |
#define | RGB_RST_RESET XRGB_CTL_RESET_MASK |
#define | RGB_RST_AUTORESET XRGB_CTL_AUTORESET_MASK |
#define | RGB_In32 XRgb2YCrCb_In32 |
#define | RGB_Out32 XRgb2YCrCb_Out32 |
Interrupt Registers | |
Interrupt status register generates a interrupt if the corresponding bits of interrupt enable register bits are set. | |
#define | XRGB_ISR_OFFSET XRGB_STATUS_OFFSET |
#define | XRGB_IER_OFFSET XRGB_IRQ_EN_OFFSET |
Defines | |
#define | XRGB2YCRCB_HW_H_ |
#define | XRgb2YCrCb_In32 Xil_In32 |
#define | XRgb2YCrCb_Out32 Xil_Out32 |
#define | XRgb2YCrCb_ReadReg(BaseAddress, RegOffset) XRgb2YCrCb_In32((BaseAddress) + (u32)(RegOffset)) |
#define | XRgb2YCrCb_WriteReg(BaseAddress, RegOffset, Data) XRgb2YCrCb_Out32((BaseAddress) + (u32)(RegOffset),(u32)(Data)) |
#define RGB_ACOEF XRGB_ACOEF_OFFSET | +
+ +
#define RGB_ACTIVE_SIZE XRGB_ACTIVE_SIZE_OFFSET | +
+ +
#define RGB_BCOEF XRGB_BCOEF_OFFSET | +
+ +
#define RGB_CBMAX XRGB_CBMAX_OFFSET | +
+ +
#define RGB_CBMIN XRGB_CBMIN_OFFSET | +
+ +
#define RGB_CBOFFSET XRGB_CBOFFSET_OFFSET | +
+ +
#define RGB_CCOEF XRGB_CCOEF_OFFSET | +
+ +
#define RGB_CONTROL XRGB_CONTROL_OFFSET | +
+ +
#define RGB_CRMAX XRGB_CRMAX_OFFSET | +
+ +
#define RGB_CRMIN XRGB_CRMIN_OFFSET | +
+ +
#define RGB_CROFFSET XRGB_CROFFSET_OFFSET | +
+ +
#define RGB_CTL_EN_MASK XRGB_CTL_EN_MASK | +
+ +
#define RGB_CTL_RUE_MASK XRGB_CTL_RUE_MASK | +
+ +
#define RGB_DCOEF XRGB_DCOEF_OFFSET | +
+ +
#define RGB_ERROR XRGB_ERROR_OFFSET | +
+ +
#define RGB_In32 XRgb2YCrCb_In32 | +
+ +
#define RGB_IRQ_EN XRGB_IRQ_EN_OFFSET | +
+ +
#define RGB_Out32 XRgb2YCrCb_Out32 | +
+ +
#define RGB_RST_AUTORESET XRGB_CTL_AUTORESET_MASK | +
+ +
#define RGB_RST_RESET XRGB_CTL_RESET_MASK | +
+ +
#define RGB_STATUS XRGB_STATUS_OFFSET | +
+ +
#define RGB_SYSDEBUG0 XRGB_SYSDEBUG0_OFFSET | +
+ +
#define RGB_SYSDEBUG1 XRGB_SYSDEBUG1_OFFSET | +
+ +
#define RGB_SYSDEBUG2 XRGB_SYSDEBUG2_OFFSET | +
+ +
#define RGB_VERSION XRGB_VERSION_OFFSET | +
+ +
#define RGB_YMAX XRGB_YMAX_OFFSET | +
+ +
#define RGB_YMIN XRGB_YMIN_OFFSET | +
+ +
#define RGB_YOFFSET XRGB_YOFFSET_OFFSET | +
+ +
#define XGMA_VER_REV_SHIFT 12 | +
+Revision Shift +
#define XRGB2YCRCB_HW_H_ | +
+Prevent circular inclusions by using protection macros +
#define XRgb2YCrCb_In32 Xil_In32 | +
+Input operation +
#define XRgb2YCrCb_Out32 Xil_Out32 | +
+Output operation +
#define XRgb2YCrCb_ReadReg | +( | +BaseAddress, | |||
+ | + | RegOffset | ++ | ) | +XRgb2YCrCb_In32((BaseAddress) + (u32)(RegOffset)) | +
+This function macro reads the given register.
+
BaseAddress | is the Xilinx base address of the RGB2YCRCB core. | |
RegOffset | is the register offset of the register (defined at top of this file). |
#define XRgb2YCrCb_WriteReg | +( | +BaseAddress, | |||
+ | + | RegOffset, | |||
+ | + | Data | ++ | ) | +XRgb2YCrCb_Out32((BaseAddress) + (u32)(RegOffset),(u32)(Data)) | +
+This function macro writes the given register.
+
BaseAddress | is the Xilinx base address of the RGB2YCRCB core. | |
RegOffset | is the register offset of the register (defined at top of this file). | |
Data | is the 32-bit value to write to the register. |
#define XRGB_16_BIT_COEF_SHIFT 16 | +
+16-Bit Coefficient shift +
#define XRGB_16_BIT_MASK 0x0000FFFF | +
+16-Bit mask +
#define XRGB_8_BIT_MASK 0x000000FF | +
+8-Bit mask +
#define XRGB_ACOEF_OFFSET 0x124 | +
+A Coefficient offset +
#define XRGB_ACTIVE_SIZE_OFFSET 0x020 | +
+Active Size (V x H) offset +
#define XRGB_ACTSIZE_NUM_LINE_MASK 0x1FFF0000 | +
+The number of lines in source image +
#define XRGB_ACTSIZE_NUM_LINE_SHIFT 16 | +
+Shift for number of lines +
#define XRGB_ACTSIZE_NUM_PIXEL_MASK 0x00001FFF | +
+The number of pixels in source image +
#define XRGB_BCOEF_OFFSET 0x128 | +
+B Coefficient offset +
#define XRGB_CBMAX_MASK 0x0000FFFF | +
+Chroma Cb clipping value Mask +
#define XRGB_CBMAX_OFFSET 0x108 | +
+Cb Clipping offset +
#define XRGB_CBMIN_MASK 0x0000FFFF | +
+Chroma Cb clamping value mask +
#define XRGB_CBMIN_OFFSET 0x10C | +
+Cb Clamping offset +
#define XRGB_CBOFFSET_MASK 0x0001FFFF | +
+Chroma(Cb) offset compensation value Mask +
#define XRGB_CBOFFSET_OFFSET 0x11C | +
+Cb Offset offset +
#define XRGB_CCOEF_OFFSET 0x12C | +
+C Coefficient offset +
#define XRGB_COEFF_MASK 0x0001FFFF | +
+Matrix Conversion Coefficient value mask +
#define XRGB_CONTROL_OFFSET 0x000 | +
+Control offset +
#define XRGB_CRMAX_MASK 0x0000FFFF | +
+Chroma Cr clipping value Mask +
#define XRGB_CRMAX_OFFSET 0x110 | +
+Cr Clipping offset +
#define XRGB_CRMIN_MASK 0x0000FFFF | +
+Chroma Cr clamping value Mask +
#define XRGB_CRMIN_OFFSET 0x114 | +
+Cr Clamping offset +
#define XRGB_CROFFSET_MASK 0x0001FFFF | +
+Chroma(Cr) offset compensation value Mask +
#define XRGB_CROFFSET_OFFSET 0x120 | +
+Cr Offset offset +
#define XRGB_CTL_AUTORESET_MASK 0x40000000 | +
+Software Reset - Auto-synchronize to SOF Mask +
#define XRGB_CTL_BPE_MASK 0x00000010 | +
+Bypass Mask +
#define XRGB_CTL_RESET_MASK 0x80000000 | +
+Software Reset - Instantaneous Mask +
#define XRGB_CTL_RUE_MASK 0x00000002 | +
+Register Update Enable Mask +
#define XRGB_CTL_SW_EN_MASK 0x00000001 | +
+Software Enable Mask +
#define XRGB_CTL_TPE_MASK 0x00000020 | +
+Test Pattern Mask +
#define XRGB_DATA_WIDTH_10 10 | +
+10-bit Data Width +
#define XRGB_DATA_WIDTH_12 12 | +
+12-bit Data Width +
#define XRGB_DATA_WIDTH_16 16 | +
+16-bit Data Width +
#define XRGB_DATA_WIDTH_8 8 | +
+8-bit Data Width +
#define XRGB_DCOEF_OFFSET 0x130 | +
+D Coefficient offset +
#define XRGB_ERR_EOL_EARLY_MASK 0x000000001 | +
+Error: End of line Early Mask +
#define XRGB_ERR_EOL_LATE_MASK 0x000000002 | +
+Error: End of line Late Mask +
#define XRGB_ERR_SOF_EARLY_MASK 0x000000004 | +
+Error: Start of frame Early Mask +
#define XRGB_ERR_SOF_LATE_MASK 0x000000008 | +
+Error: Start of frame Late Mask +
#define XRGB_ERROR_OFFSET 0x008 | +
+Error offset +
#define XRGB_IER_OFFSET XRGB_IRQ_EN_OFFSET | +
+Interrupt Enable Offset +
#define XRGB_IRQ_EN_OFFSET 0x00C | +
+IRQ Enable offset +
#define XRGB_ISR_OFFSET XRGB_STATUS_OFFSET | +
+Interrupt Status Offset +
#define XRGB_IXR_ALLINTR_MASK 0x00010003 | +
+Interrupt All Error Mask (ORing (of All Interrupt Mask) +
#define XRGB_IXR_EOF_MASK 0x00000002 | +
+End-Of-Frame Mask +
#define XRGB_IXR_PROC_STARTED_MASK 0x00000001 | +
+Process Started Mask +
#define XRGB_IXR_SE_MASK 0x00010000 | +
+Slave Error Mask +
#define XRGB_STATUS_OFFSET 0x004 | +
+Status offset +
#define XRGB_SYSDEBUG0_OFFSET 0x014 | +
+System Debug 0 offset +
#define XRGB_SYSDEBUG1_OFFSET 0x018 | +
+System Debug 1 offset +
#define XRGB_SYSDEBUG2_OFFSET 0x01C | +
+System Debug 2 offset +
#define XRGB_VER_INTERNAL_SHIFT 8 | +
+Internal Shift +
#define XRGB_VER_MAJOR_MASK 0xFF000000 | +
+Major Mask +
#define XRGB_VER_MAJOR_SHIFT 24 | +
+Major Shift +
#define XRGB_VER_MINOR_MASK 0x00FF0000 | +
+Minor Mask +
#define XRGB_VER_MINOR_SHIFT 16 | +
+Minor Shift +
#define XRGB_VER_PID_MASK 0x00000F00 | +
+Patch ID Mask +
#define XRGB_VER_REV_MASK 0x0000F000 | +
+Revision Mask +
#define XRGB_VER_REV_NUM_MASK 0x000000FF | +
+Revision Number Mask +
#define XRGB_VERSION_OFFSET 0x010 | +
+Version offset +
#define XRGB_YMAX_MASK 0x0000FFFF | +
+Luma clipping value Mask +
#define XRGB_YMAX_OFFSET 0x100 | +
+Luma Clipping offset +
#define XRGB_YMIN_MASK 0x0000FFFF | +
+Luma clamping value Mask +
#define XRGB_YMIN_OFFSET 0x104 | +
+Luma Clamping offset +
#define XRGB_YOFFSET_MASK 0x0001FFFF | +
+Luma offset compensation value Mask +
#define XRGB_YOFFSET_OFFSET 0x118 | +
+Luma Offset offset +
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__intr_8c.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__intr_8c.html new file mode 100644 index 00000000..96d63c2e --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__intr_8c.html @@ -0,0 +1,137 @@ + +
+ ++
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ----- -------- --------------------------------------------------- + 7.0 adk 01/28/14 First release. + Implemented the following functions: + XRgb2YCrCb_IntrHandler, + XRgb2YCrCb_SetCallBack. ++
+#include "xrgb2ycrcb.h"
+
Functions | |
void | XRgb2YCrCb_IntrHandler (void *InstancePtr) |
int | XRgb2YCrCb_SetCallBack (XRgb2YCrCb *InstancePtr, u32 HandlerType, void *CallBackFunc, void *CallBackRef) |
void XRgb2YCrCb_IntrHandler | +( | +void * | +InstancePtr | +) | ++ |
+This function is the interrupt handler for the RGB2YCRCB driver.
+This handler reads the pending interrupt from the IER(IRQ_ENABLE register) or ISR (STATUS register), determines the source of the interrupts, calls according callbacks, and finally clears the interrupts.
+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 XRgb2YCrCb_SetCallBack() during initialization phase.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance that just interrupted. |
int XRgb2YCrCb_SetCallBack | +( | +XRgb2YCrCb * | +InstancePtr, | +|
+ | + | u32 | +HandlerType, | +|
+ | + | void * | +CallBackFunc, | +|
+ | + | void * | +CallBackRef | + |
+ | ) | ++ |
+This routine installs an asynchronous callback function for the given HandlerType:
+
+ HandlerType Callback Function Type + ----------------------- -------------------------------------------------- + XRGB_HANDLER_PROCSTART ProcStartCallBack + XRGB_HANDLER_FRAMEDONE FrameDoneCallBack + XRGB_HANDLER_ERROR ErrCallBack +
+
InstancePtr | is a pointer to the XRgb2YCrCb instance to be worked on. | |
HandlerType | specifies which callback is to be attached. | |
CallBackFunc | is the address of the callback function. | |
CallBackRef | is a user data item that will be passed to the callback function when it is invoked. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__selftest_8c.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__selftest_8c.html new file mode 100644 index 00000000..f6ad5a73 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__selftest_8c.html @@ -0,0 +1,73 @@ + +
+ ++
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------ -------- -------------------------------------------------- + 7.0 adk 01/28/14 First Release. + Implemented the following function: + XRgb2YCrCb_SelfTest. ++
+#include "xrgb2ycrcb.h"
+
Functions | |
int | XRgb2YCrCb_SelfTest (XRgb2YCrCb *InstancePtr) |
int XRgb2YCrCb_SelfTest | +( | +XRgb2YCrCb * | +InstancePtr | +) | ++ |
+This function reads version register of RGB2YCRCB core and compares with zero as part of self test.
+
InstancePtr | is a pointer to the XRgb2YCrCb instance. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__sinit_8c.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__sinit_8c.html new file mode 100644 index 00000000..86d055d3 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/doc/html/api/xrgb2ycrcb__sinit_8c.html @@ -0,0 +1,72 @@ + +
+ ++
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------ -------- -------------------------------------------------- + 7.0 adk 01/28/14 First release. + Implemented following function: + XRgb2YCrCb_LookupConfig. ++
+#include "xrgb2ycrcb.h"
+#include "xparameters.h"
+
Functions | |
XRgb2YCrCb_Config * | XRgb2YCrCb_LookupConfig (u16 DeviceId) |
XRgb2YCrCb_Config* XRgb2YCrCb_LookupConfig | +( | +u16 | +DeviceId | +) | ++ |
+This function returns a reference to an XRgb2YCrCb_Config structure based on the unique core id, DeviceId. The return value will refer to an entry in the core configuration table defined in the xrgb2ycrcb_g.c file.
+
DeviceId | is the unique core ID of the core for the lookup operation. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/example.c b/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/example.c deleted file mode 100755 index cd8b9d26..00000000 --- a/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/example.c +++ /dev/null @@ -1,195 +0,0 @@ -/****************************************************************************** -* -* Copyright (C) 2012 - 2014 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* -******************************************************************************/ -/*****************************************************************************/ -/** - * - * @file example.c - * - * This file demonstrates how to use Xilinx RGB to YCrCb Color Space Converter - * (RGB2YCRCB) driver on Xilinx RGB to YCrCb Color Space Converter (RGB2YCRCB) - * core. This code does not cover the Xilinx TimeBase setup and any other - * configuration which might be required to get the YCRCB2RGB device working properly. - * - *
- * MODIFICATION HISTORY: - * - * Ver Who Date Changes - * ----- ---- -------- ------------------------------------------------------- - * 5.00a tb 02/27/12 Updates for the v5.00.a release - *- * - * *************************************************************************** - */ - -#include "rgb2ycrcb.h" -#include "xparameters.h" - -/***************************************************************************/ -// RGB to YCrCb Color Space Converter Register Reading Example -// This function provides an example of how to read the current configuration -// settings of the RGB2YCRCB core. -/***************************************************************************/ -void report_rgb_settings(u32 BaseAddress) { - xil_printf("RGB to YCrCb Color Space Converter Core Configuration:\r\n"); - xil_printf(" Version: 0x%08x\r\n", RGB_ReadReg(BaseAddress, RGB_VERSION)); - xil_printf(" Enable Bit: %1d\r\n", RGB_ReadReg(BaseAddress, RGB_CONTROL) & RGB_CTL_EN_MASK); - - xil_printf(" Register Update Bit: %1d\r\n", (RGB_ReadReg(BaseAddress, RGB_CONTROL) & RGB_CTL_RUE_MASK) >> 1); - - xil_printf(" Reset Bit: %1d\r\n", (RGB_ReadReg(BaseAddress, RGB_CONTROL) & RGB_RST_RESET) >> 31); - - xil_printf(" AutoReset Bit: %1d\r\n", (RGB_ReadReg(BaseAddress, RGB_CONTROL) & RGB_RST_AUTORESET) >> 30); - - xil_printf(" Columns=0x%8x, Rows=0x%8x\r\n", - (RGB_ReadReg(BaseAddress, RGB_ACTIVE_SIZE)>>16), - (RGB_ReadReg(BaseAddress, RGB_ACTIVE_SIZE)&0xFFFF)); - - xil_printf(" Acoef=0x%8x, Bcoef=0x%8x, Ccoef=0x%8x, Dcoef=0x%8x\r\n", - RGB_ReadReg(BaseAddress, RGB_ACOEF), - RGB_ReadReg(BaseAddress, RGB_BCOEF), - RGB_ReadReg(BaseAddress, RGB_CCOEF), - RGB_ReadReg(BaseAddress, RGB_DCOEF)); - - xil_printf(" Y Offset=0x%8x, Cb Offset=0x%8x, Cr Offset=0x%8x\r\n", - RGB_ReadReg(BaseAddress, RGB_YOFFSET), - RGB_ReadReg(BaseAddress, RGB_CBOFFSET), - RGB_ReadReg(BaseAddress, RGB_CROFFSET)); - - xil_printf(" Y Max=0x%8x, Y Min=0x%8x\r\n", - RGB_ReadReg(BaseAddress, RGB_YMAX), - RGB_ReadReg(BaseAddress, RGB_YMIN)); - - xil_printf(" Cb Max=0x%8x, Cb Min=0x%8x\r\n", - RGB_ReadReg(BaseAddress, RGB_CBMAX), - RGB_ReadReg(BaseAddress, RGB_CBMIN)); - - xil_printf(" Cr Max=0x%8x, Cr Min=0x%8x\r\n", - RGB_ReadReg(BaseAddress, RGB_CRMAX), - RGB_ReadReg(BaseAddress, RGB_CRMIN)); -} - - - -/***************************************************************************/ -// RGB to YCrCb Color Space Converter Register Update Example -// This function provides an example of the process used to update -// the coefficient and offset registers in the RGB2YCrCb core. -// In most video systems, it is expected that this process would be executed -// in response to an interrupt connected to the SOF timing signal -// or a timeout signal associated with a watchdog timer. -/***************************************************************************/ -void RGB_Update_Example() { - //Enable the RGB2YCRCB software enable - RGB_Enable(XPAR_RGB2YCRCB_0_BASEADDR); - - //Disable register updates. - //This is the default operating mode for the CCM core, and allows - //registers to be updated without effecting the core's behavior. - RGB_RegUpdateDisable(XPAR_RGB2YCRCB_0_BASEADDR); - - //Set the Active Columns and Rows - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_ACTIVE_SIZE, (1280<<16)+720); //1280x720 - - //Set the coefficients - // These values are floating point values in the range: [0.0, 1.0) - // These are represented as integers by multiplying by 2^16, - // resulting in an integer value in the range from [0, 65535] - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_ACOEF, 19595); //ACOEF = 0.299 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_BCOEF, 7471); //BCOEF = 0.114 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_CCOEF, 46727); //CCOEF = 0.713 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_DCOEF, 36962); //DCOEF = 0.564 - - //Set the offsets - // For 8-bit color: Valid range = [ -256, 255] - // For 10-bit color: Valid range = [ -1024, 1023] - // For 12-bit color: Valid range = [ -4096, 4095] - // For 16-bit color: Valid range = [-65536, 65535] - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_YOFFSET, 16); //YOFFSET = 16 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_CBOFFSET, 128); //CBOFFSET = 128 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_CROFFSET, 128); //CROFFSET = 128 - - //Set the Clip/Clamp - // For 8-bit color: Valid range = [0, 255] - // For 10-bit color: Valid range = [0, 1023] - // For 12-bit color: Valid range = [0, 4095] - // For 16-bit color: Valid range = [0, 65535] - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_YMAX, 240); //YMAX = 240 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_YMIN, 16); //YMIN = 16 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_CBMAX, 240); //CBMAX = 240 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_CBMIN, 16); //CBMIN = 16 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_CRMAX, 240); //CRMAX = 240 - RGB_WriteReg(XPAR_RGB2YCRCB_0_BASEADDR, RGB_CRMIN, 16); //CRMIN = 16 - - //Enable register updates. - //This mode will cause the coefficient and offset registers internally - //to the CCM core to automatically be updated on the next SOF. - RGB_RegUpdateEnable(XPAR_RGB2YCRCB_0_BASEADDR); - -} - - -/*****************************************************************************/ -// -// This is the main function for the RGB2YCrCb example. -// -/*****************************************************************************/ -int main(void) -{ - struct rgb_coef_inputs coef_in; - struct rgb_coef_outputs coef_out; - - // Print the current settings for the RGB2YCrCb core - report_rgb_settings(XPAR_RGB2YCRCB_0_BASEADDR); - - // Call the RGB2YCrCb example, specify the Device ID generated in xparameters.h - RGB_Update_Example(XPAR_RGB2YCRCB_0_BASEADDR); - - // Read the current RGB2YCrCb core coefficients - RGB_get_coefficients(XPAR_RGB2YCRCB_0_BASEADDR, &coef_out); - - // Setup coef_in for SD_ITU_601, 16_to_235_for_Studio_Equipment - // and data width of 8-bits - RGB_select_standard(0, 1, XPAR_RGB2YCRCB_0_M_AXIS_VIDEO_DATA_WIDTH, &coef_in); - - // Translate into RGB2YCrCb core coefficients - RGB_coefficient_translation(&coef_in, &coef_out,XPAR_RGB2YCRCB_0_M_AXIS_VIDEO_DATA_WIDTH); - - // Program the new RGB2YCrCb core coefficients - RGB_set_coefficients(XPAR_RGB2YCRCB_0_BASEADDR, &coef_out); - - // Print the current settings for the RGB2YCrCb core - report_rgb_settings(XPAR_RGB2YCRCB_0_BASEADDR); - - return 0; -} - - diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/index.html b/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/index.html index 22618a09..37199ff2 100755 --- a/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/index.html +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/index.html @@ -7,11 +7,15 @@ -
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.
+Copyright ? 1995-2014 Xilinx, Inc. All rights reserved.
- \ No newline at end of file + + diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/rgb2ycrcb_example.c b/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/rgb2ycrcb_example.c new file mode 100755 index 00000000..84923469 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/rgb2ycrcb_example.c @@ -0,0 +1,217 @@ +/****************************************************************************** +* +* Copyright (C) 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ + +/*****************************************************************************/ +/** +* +* @file rgb2ycrcb_example.c +* +* This file demonstrates how to use Xilinx RGB to YCrCb Color Space Converter +* (RGB2YCRCB) driver on Xilinx RGB to YCrCb Color Space Converter (RGB2YCRCB) +* core. +* +*+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ---- -------- ------------------------------------------------------- +* 7.00 adk 07/07/14 First release. +*+* +******************************************************************************/ + +#include "xrgb2ycrcb.h" +#include "xparameters.h" + +/************************** Constant Definitions *****************************/ + +/** +* The following constants map to the XPAR parameters created in the +* xparameters.h file. They are defined here such that a user can easily +* change all the needed parameters in one place. +*/ +#define XRGB_DEVICE_ID XPAR_RGB2YCRCB_0_DEVICE_ID + +/**************************** Type Definitions *******************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/************************** Function Prototypes ******************************/ + +int Rgb2YCrCb_Update_Example(u16 DeviceId); + +/************************** Variable Definitions *****************************/ + +XRgb2YCrCb XRgbInstance; /**< Instance of the RGB2YCRCB core */ + +/************************** Function Definitions *****************************/ + + +/*****************************************************************************/ +/** +* +* Main function to call the Rgb2YCrCb example. +* +* @param None. +* +* @return +* - XST_SUCCESS if successful, +* - XST_FAILURE if it is unsuccessful +* +* @note None. +* +******************************************************************************/ +int main(void) +{ + + int Status; + + /* Call the Rgb2YCrCb update example, specify the parameters generated + * in xparameters.h + */ + Status = Rgb2YCrCb_Update_Example(XRGB_DEVICE_ID); + if (Status != XST_SUCCESS) { + xil_printf("RGB2YCRCB driver example failed.\n\r"); + return XST_FAILURE; + } + + xil_printf("Successfully ran RGB2YCRCB driver example.\n\r"); + + return XST_SUCCESS; +} + +/*****************************************************************************/ +/** +* +* RGB to YCrCb Color Space Converter Register Update Example. +* This function provides an example of the process used to update the +* coefficient and offset registers in the RGB2YCrCb core. . +* +* @param DeviceId is the unique device id of the RGB2YCRCB core. +* +* @return +* - XST_SUCCESS if successful, +* - XST_FAILURE if it is un-successful +* +* @note None. +* +****************************************************************************/ +int Rgb2YCrCb_Update_Example(u16 DeviceId) +{ + + struct XRgb2YCrCb_Coef_Inputs CoefIn; + struct XRgb2YCrCb_Coef_Outputs CoefOut; + XRgb2YCrCb_Config *Config; + int Status; + + /* Initialize the RGB2YCrCb driver so that it's ready to use look up + * the configuration in the config table, then initialize it. + */ + Config = XRgb2YCrCb_LookupConfig(DeviceId); + if(NULL == Config){ + return XST_FAILURE; + } + + Status = XRgb2YCrCb_CfgInitialize(&XRgbInstance, Config, + Config->BaseAddress); + if(Status != XST_SUCCESS){ + return XST_FAILURE; + } + + /* Enable the RGB2YCRCB core */ + XRgb2YCrCb_Enable(&XRgbInstance); + + /* Disable register updates. This is the default operating mode for + * the RGB2YCRCB core and allows registers to be updated without + * effecting the core's behavior. + */ + XRgb2YCrCb_RegUpdateDisable(&XRgbInstance); + + /* Setup CoefIn for XRGB_STANDARD_ITU_601_SD, 16_to_240_for_TV + * and data width of 8-bits. + * enum Standards are: + * 0 = XRGB_STANDARD_ITU_601_SD + * 1 = XRGB_STANDARD_ITU_709_NTSC + * 2 = XRGB_STANDARD_ITU_709_PAL + * 3 = XRGB_STANDARD_YUV. + */ + XRgb2YCrCb_Select_Standard(&XRgbInstance, XRGB_STANDARD_ITU_601_SD, + XRGB_TV_16_TO_240, (u32)XRGB_DATA_WIDTH_8, + &CoefIn); + + /* Translate into RGB2YCrCb core coefficients */ + XRgb2YCrCb_Coefficient_Translation(&XRgbInstance, + &CoefIn, &CoefOut,(u32)XRGB_DATA_WIDTH_8); + + /* Program the new RGB2YCrCb core coefficients */ + XRgb2YCrCb_SetCoefs(&XRgbInstance, CoefIn.ACoef, CoefIn.BCoef, + CoefIn.CCoef, CoefIn.DCoef); + + /* Set output range */ + XRgb2YCrCb_Select_OutputRange(&XRgbInstance, XRGB_TV_16_TO_240); + + /* Set the Active Columns and Rows */ + XRgb2YCrCb_SetActiveSize(&XRgbInstance, 720, 1280); + + /* Set the offsets + * For 8-bit color: Valid range = [0, 255] + * For 10-bit color: Valid range = [0, 1023] + * For 12-bit color: Valid range = [0, 4095] + * For 16-bit color: Valid range = [0, 65535] + */ + XRgb2YCrCb_SetYOffset(&XRgbInstance, 16); + XRgb2YCrCb_SetCbOffset(&XRgbInstance, 128); + XRgb2YCrCb_SetCrOffset(&XRgbInstance, 128); + + /* Set the Clip/Clamp + * For 8-bit color: Valid range = [0, 255] + * For 10-bit color: Valid range = [0, 1023] + * For 12-bit color: Valid range = [0, 4095] + * For 16-bit color: Valid range = [0, 65535] + */ + XRgb2YCrCb_SetYMax(&XRgbInstance, 240); + XRgb2YCrCb_SetYMin(&XRgbInstance, 16); + XRgb2YCrCb_SetCbMax(&XRgbInstance, 240); + XRgb2YCrCb_SetCbMin(&XRgbInstance, 16); + XRgb2YCrCb_SetCrMax(&XRgbInstance, 240); + XRgb2YCrCb_SetCrMin(&XRgbInstance, 16); + + /* Enable register updates. This mode will cause the coefficient and + * offset registers internally to the RGB2YCRCB core to automatically + * be updated on the next start-of-frame (SOF). + */ + XRgb2YCrCb_RegUpdateEnable(&XRgbInstance); + + return XST_SUCCESS; +} diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/rgb2ycrcb_selftest_example.c b/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/rgb2ycrcb_selftest_example.c new file mode 100755 index 00000000..20d5e55a --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/examples/rgb2ycrcb_selftest_example.c @@ -0,0 +1,149 @@ +/****************************************************************************** +* +* Copyright (C) 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file rgb2ycrcb_selftest_example.c +* +* This file contains an example using the XRgb2YCrCb driver to do self test +* on the device. +* +* @note None. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------ -------- ------------------------------------------------------ +* 7.0 adk 01/20/14 First Release. +*+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xparameters.h" +#include "xrgb2ycrcb.h" +#include "xil_printf.h" + +/************************** Constant Definitions *****************************/ + +/* + * The following constants map to the XPAR parameters created in the + * xparameters.h file. They are defined here such that a user can easily + * change all the needed parameters in one place. + */ +#define XRGB_DEVICE_ID XPAR_RGB2YCRCB_0_DEVICE_ID + +/**************************** Type Definitions *******************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/************************** Function Prototypes ******************************/ + +int XRgb2YCrCbSelfTestExample(u16 DeviceId); + +/************************** Variable Definitions *****************************/ + +XRgb2YCrCb Rgb2YCrCbInst; /**< Instance of the RGB2YCRCB core */ + +/*****************************************************************************/ +/** +* +* Main/Entry function for self test example. +* +* @return +* - XST_SUCCESS if successful. +* - XST_FAILURE if it is unsuccessful. +* +* @note None. +* +******************************************************************************/ +int main(void) +{ + int Status; + + /* Run selftest example */ + Status = XRgb2YCrCbSelfTestExample(XRGB_DEVICE_ID); + if(Status != XST_SUCCESS) { + xil_printf("RGB Selftest Example Failed\r\n"); + return XST_FAILURE; + } + + xil_printf("Successfully ran RGB2YCrCb driver Selftest Example\r\n"); + + return XST_SUCCESS; +} + +/*****************************************************************************/ +/** +* +* This function does a minimal test on the RGB driver. +* +* @param DeviceId is an ID of RGB core or device. +* +* @return +* - XST_SUCCESS if successful. +* - XST_FAILURE if it is unsuccessful. +* +* @note None. +* +******************************************************************************/ +int XRgb2YCrCbSelfTestExample(u16 DeviceId) +{ + int Status; + XRgb2YCrCb_Config *Config; + + /* Initialize the RGB2YCrCb driver so that it's ready to use look up + * the configuration in the config table, then initialize it. + */ + Config = XRgb2YCrCb_LookupConfig(DeviceId); + if(NULL == Config){ + return XST_FAILURE; + } + + Status = XRgb2YCrCb_CfgInitialize(&Rgb2YCrCbInst, Config, + Config->BaseAddress); + if(Status != XST_SUCCESS){ + return XST_FAILURE; + } + + /* Perform a self-test to check hardware build. */ + Status = XRgb2YCrCb_SelfTest(&Rgb2YCrCbInst); + if(Status != XST_SUCCESS){ + return XST_FAILURE; + } + + return XST_SUCCESS; +} diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/rgb2ycrcb.c b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/rgb2ycrcb.c deleted file mode 100755 index 0ab47689..00000000 --- a/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/rgb2ycrcb.c +++ /dev/null @@ -1,265 +0,0 @@ -/****************************************************************************** -* -* Copyright (C) 2012 - 2014 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file rgb2ycrcb.c -* -* This is main code of Xilinx RGB to YCrCb Color Space Converter (RGB2YCRCB) -* device driver. Please see rgb2ycrcb.h for more details of the driver. -* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ---- -------- ------------------------------------------------------- -* 5.00a tb 02/27/12 Updated for RGB2YCRCB v5.00.a -* -******************************************************************************/ - -/***************************** Include Files *********************************/ - -#include "rgb2ycrcb.h" -#include "xenv.h" -#include "stdio.h" - - -/*****************************************************************************/ -// Note: Most of the functions are currently implemented as high-performance -// macros within rgb2ycrcb.h -/*****************************************************************************/ - -/*****************************************************************************/ -/** -* -* Select input coefficients for 4 supported Standards and 3 Input Ranges. -* -* @param standard_sel is the standards selection: 0 = SD_ITU_601 -* 1 = HD_ITU_709__1125_NTSC -* 2 = HD_ITU_709__1250_PAL -* 3 = YUV -* @param input_range is the limit on the range of the data: 0 = 16_to_240_for_TV, -* 1 = 16_to_235_for_Studio_Equipment, -* 3 = 0_to_255_for_Computer_Graphics -* @param data_width has a valid range of [8,10,12,16] -* @param coef_in is a pointer to a rgb_coef_inputs data structure. -* -* @return None. -* -* @note -* -******************************************************************************/ -void RGB_select_standard(u32 standard_sel, u32 input_range, u32 data_width, struct rgb_coef_inputs *coef_in) -{ - double acoef[4][3] = {{0.299, 0.299, 0.2568}, {0.299, 0.299, 0.2568}, {0.2126, 0.2126, 0.1819}, {0.299, 0.299, 0.299}}; - double bcoef[4][3] = {{0.114, 0.114, 0.0979}, {0.114, 0.114, 0.0979}, {0.0722, 0.0722, 0.0618}, {0.114, 0.114, 0.114}}; - double ccoef[4][3] = {{0.713, 0.7295, 0.5910}, {0.713, 0.7295, 0.5910}, {0.6350, 0.6495, 0.6495}, {0.877283, 0.877283, 0.877283}}; - double dcoef[4][3] = {{0.564, 0.5772, 0.5772}, {0.564, 0.5772, 0.5772}, {0.5389, 0.5512, 0.5512}, {0.492111, 0.492111, 0.492111}}; - u32 yoffset = 1<<(data_width-4); - u32 coffset = 1<<(data_width-1); - u32 max[3] = {(240*(1<<(data_width-8))), (235*(1<<(data_width-8))), ((1<
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------ -------- ------------------------------------------------------- +* 5.00a tb 02/27/12 Updated for RGB2YCRCB v5.00.a. +* 7.0 adk 01/07/14 Changed the file name from "rgb2ycrcb.c" to +* "xrgb2ycrcb.c". +* +* Implemented the following functions: +* XRgb2YCrCb_CfgInitialize, XRgb2YCrCb_EnableDbgByPass, +* XRgb2YCrCb_IsDbgByPassEnabled, +* XRgb2YCrCb_DisableDbgBypass, +* XRgb2YCrCb_EnableDbgTestPattern, +* XRgb2YCrCb_IsDbgTestPatternEnabled, +* XRgb2YCrCb_DisableDbgTestPattern, +* XRgb2YCrCb_GetVersion, XRgb2YCrCb_GetDbgFrameCount, +* XRgb2YCrCb_GetDbgLineCount, +* XRgb2YCrCb_GetDbgPixelCount, XRgb2YCrCb_Setup, +* XRgb2YCrCb_SetActiveSize, XRgb2YCrCb_GetActiveSize, +* XRgb2YCrCb_SetYMax, XRgb2YCrCb_GetYMax, +* XRgb2YCrCb_SetYMin, XRgb2YCrCb_GetYMin, +* XRgb2YCrCb_SetCbMax, XRgb2YCrCb_GetCbMax, +* XRgb2YCrCb_SetCbMin, XRgb2YCrCb_GetCbMin, +* XRgb2YCrCb_SetCrMax, XRgb2YCrCb_GetCrMax, +* XRgb2YCrCb_SetCrMin, XRgb2YCrCb_GetCrMin, +* XRgb2YCrCb_SetYOffset, XRgb2YCrCb_GetYOffset, +* XRgb2YCrCb_SetCbOffset, XRgb2YCrCb_GetCbOffset, +* XRgb2YCrCb_SetCrOffset, XRgb2YCrCb_GetCrOffset, +* XRgb2YCrCb_SetCoefs, XRgb2YCrCb_GetCoefs, +* XRgb2YCrCb_Select_Standard, +* XRgb2YCrCb_Coefficient_Translation, +* XRgb2YCrCb_Select_OutputRange. +*+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xrgb2ycrcb.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + +/** +* Each of Callback functions to be called on different types of interrupts. +* These stub functions are set during XRgb2YCrCb_CfgInitialize as default +* callback functions. If application is not registered any of the callback +* function, these functions will be called for doing nothing. +*/ +static void StubCallBack(void *CallBackRef); +static void StubErrCallBack(void *CallBackRef, u32 ErrorMask); + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function initializes the Rgb2YCrCb core. This function must be called +* prior to using the Rgb2YCrCb core. Initialization of the Rgb2YCrCb includes +* setting up the instance data and ensuring the hardware is in a quiescent +* state. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param CfgPtr is a reference to a structure containing information +* about a specific XRgb2YCrCb driver. +* @param 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. +* +* @return - XST_SUCCESS if initialization was successful. +* +* @note None. +* +******************************************************************************/ +int XRgb2YCrCb_CfgInitialize(XRgb2YCrCb *InstancePtr, + XRgb2YCrCb_Config *CfgPtr, u32 EffectiveAddr) +{ + /* Verify arguments. */ + Xil_AssertNonvoid(CfgPtr != NULL); + Xil_AssertNonvoid(EffectiveAddr != (u32)0x0); + + /* Setup the instance */ + (void)memset((void *)InstancePtr, 0, sizeof(XRgb2YCrCb)); + (void)memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr, + sizeof(XRgb2YCrCb_Config)); + + InstancePtr->Config.BaseAddress = EffectiveAddr; + + /* Set all handlers to stub values, let user configure this + * data later + */ + InstancePtr->ProcStartCallBack = + (XRgb2YCrCb_CallBack)((void *)StubCallBack); + InstancePtr->FrameDoneCallBack = + (XRgb2YCrCb_CallBack)((void *)StubCallBack); + InstancePtr->ErrCallBack = + (XRgb2YCrCb_ErrorCallBack)((void *)StubErrCallBack); + + /* Reset the hardware and set the flag to indicate the + * driver is ready + */ + XRgb2YCrCb_Reset(InstancePtr); + InstancePtr->IsReady = (u32)(XIL_COMPONENT_IS_READY); + + return (XST_SUCCESS); +} + +/*****************************************************************************/ +/** +* +* This function sets the bypass bit of control register to switch the core to +* bypass mode if debug is enabled in the IP. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return None. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +void XRgb2YCrCb_EnableDbgByPass(XRgb2YCrCb *InstancePtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET), + ((XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET))) | + (XRGB_CTL_BPE_MASK))); +} + +/*****************************************************************************/ +/** +* +* This function returns the current bypass mode of a core. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return +* - TRUE if ByPass mode is enabled. +* - FALSE if ByPpass mode is not enabled. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +int XRgb2YCrCb_IsDbgByPassEnabled(XRgb2YCrCb *InstancePtr) +{ + u32 DbgByPass; + int Status; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + DbgByPass = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET))) & (XRGB_CTL_BPE_MASK); + if (DbgByPass == (XRGB_CTL_BPE_MASK)) { + Status = (TRUE); + } + else { + Status = (FALSE); + } + + return Status; +} + +/*****************************************************************************/ +/** +* +* This function disables Bypass mode. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb core instance to be +* worked on. +* +* @return None. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +void XRgb2YCrCb_DisableDbgBypass(XRgb2YCrCb *InstancePtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid((InstancePtr)->Config.HasDebug != (u16)0x0); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET), + ((XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET))) & (~(XRGB_CTL_BPE_MASK)))); +} + +/*****************************************************************************/ +/** +* +* This function switches the core to test-pattern generator mode if debug +* feature is enabled. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return None. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +void XRgb2YCrCb_EnableDbgTestPattern(XRgb2YCrCb *InstancePtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET), + ((XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET))) | (XRGB_CTL_TPE_MASK))); +} + +/*****************************************************************************/ +/** +* +* This function returns the test-pattern generator mode (enabled or not), if +* debug feature is enabled. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return +* - TRUE if Test-pattern mode is enabled. +* - FALSE if Test-pattern mode is not enabled. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +int XRgb2YCrCb_IsDbgTestPatternEnabled(XRgb2YCrCb *InstancePtr) +{ + u32 DbgTestPattern; + int Status; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid((InstancePtr)->Config.HasDebug != (u16)0x0); + + DbgTestPattern = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET))) & (XRGB_CTL_TPE_MASK); + + if (DbgTestPattern == (XRGB_CTL_TPE_MASK)) { + Status = (TRUE); + } + else { + Status = (FALSE); + } + + return Status; +} + +/*****************************************************************************/ +/** +* +* This function disables debug test pattern mode. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb core instance to be +* worked on. +* +* @return None. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +void XRgb2YCrCb_DisableDbgTestPattern(XRgb2YCrCb *InstancePtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0); + + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, + (XRGB_CONTROL_OFFSET), + ((XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CONTROL_OFFSET))) & (~(XRGB_CTL_TPE_MASK)))); +} + +/*****************************************************************************/ +/** +* +* This function facilitates software identification of exact version of the +* RGB2YCrCb hardware (h/w). +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return Version, contents of a Version register. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetVersion(XRgb2YCrCb *InstancePtr) +{ + u32 Version; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + /* Read version register */ + Version = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_VERSION_OFFSET)); + return Version; +} + +/*****************************************************************************/ +/** +* +* This function returns the frame count, the number of frames processed since +* power-up. This is available only if the debugging feature is enabled. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return DbgFrameCount, number of frames processed since power-up. +* +* @note The SYSDEBUG0, or Frame Throughput Monitor register indicates +* the number of frames processed since power-up or the last time +* the core was reset. The SYSDEBUG registers can be useful to +* identify external memory / frame buffer/ throughput bottlenecks +* in a video system. +* Debug functionality should be enabled. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetDbgFrameCount(XRgb2YCrCb *InstancePtr) +{ + u32 DbgFrameCount; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + /* Frame Throughput monitor */ + DbgFrameCount = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_SYSDEBUG0_OFFSET)); + + return DbgFrameCount; +} + +/*****************************************************************************/ +/** +* +* This function returns Line count, the number of lines processed since +* power-up. This is available only if the debugging feature is enabled. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return DbgLineCount, number of lines processed since power-up. +* +* @note The SYSDEBUG1 or Line Throughput Monitor register indicates +* the number of lines processed since power-up or the last time +* the core was reset. The SYSDEBUG registers can be useful to +* identify external memory / Frame buffer / throughput +* bottlenecks in a video system. +* Debug functionality should be enabled. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetDbgLineCount(XRgb2YCrCb *InstancePtr) +{ + u32 DbgLineCount; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + /* Line Throughput monitor */ + DbgLineCount = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_SYSDEBUG1_OFFSET)); + + return DbgLineCount; +} + +/*****************************************************************************/ +/** +* +* This function returns the pixel count, the number of pixels processed since +* power up. This is available only if the debugging feature is enabled. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return DbgPixelCount, number of pixels processed since power-up. +* +* @note The SYSDEBUG2, or Pixel Throughput Monitor register indicates +* the number of pixel processed since power-up or the last time +* the core was reset. The SYSDEBUG registers can be useful to +* identify external memory / Frame buffer / throughput +* bottlenecks in a video system. +* Debug functionality should be enabled. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetDbgPixelCount(XRgb2YCrCb *InstancePtr) +{ + u32 DbgPixelCount; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + /* Pixel Throughput monitor */ + DbgPixelCount = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_SYSDEBUG2_OFFSET)); + + return DbgPixelCount; +} + +/*****************************************************************************/ +/** +* +* This function sets up double buffered ACTIVE_SIZE register and enables the +* register update. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_Setup(XRgb2YCrCb *InstancePtr) +{ + u32 ActiveSize; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + + XRgb2YCrCb_RegUpdateDisable(InstancePtr); + + /* Write into active size register */ + ActiveSize = (u32)(((u32)((InstancePtr->VSize)) << + (u32)(XRGB_ACTSIZE_NUM_LINE_SHIFT)) & + (u32)(XRGB_ACTSIZE_NUM_LINE_MASK)) | + ((u32)((InstancePtr->HSize)) & + (u32)(XRGB_ACTSIZE_NUM_PIXEL_MASK)); + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_ACTIVE_SIZE_OFFSET), ActiveSize); + + XRgb2YCrCb_RegUpdateEnable(InstancePtr); +} + +/*****************************************************************************/ +/** +* +* This function sets active H/V sizes in the active size register. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param HSize specifies the number of Active Pixels per scanline that +* needs to be set within the range [32, 7680]. +* @param VSize specifies the number of Active Lines per frame that needs +* to be set within the range [32, 7680]. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetActiveSize(XRgb2YCrCb *InstancePtr, u16 HSize, u16 VSize) +{ + u32 Size; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid((VSize >= (u16)(XRGB_VSIZE_FIRST)) && + (VSize <= (u16)(XRGB_VSIZE_LAST))); + Xil_AssertVoid((HSize >= (u16)(XRGB_HSIZE_FIRST)) && + (HSize <= (u16)(XRGB_HSIZE_LAST))); + + /* The core supports spatial resolutions from 32x32 to 7680x7680 */ + Size = (((u32)VSize) << ((u32)(XRGB_ACTSIZE_NUM_LINE_SHIFT))) | + (HSize); + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_ACTIVE_SIZE_OFFSET), Size); +} + +/*****************************************************************************/ +/** +* +* This function gets the active H/V sizes of the Rgb2YCrCb core from +* active size register. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param HSize is a pointer to 16-bit variable in which the number of +* Active Pixels per scanline is returned within the range +* [32, 7680]. +* @param VSize is a pointer to 16-bit variable in which the number of +* Active Lines per frame is returned within the range +* [32, 7680]. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_GetActiveSize(XRgb2YCrCb *InstancePtr, u16 *HSize, u16 *VSize) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(HSize != NULL); + Xil_AssertVoid(VSize != NULL); + + /* Reads Number of Active Pixels per scan line */ + *HSize = (u16)(XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_ACTIVE_SIZE_OFFSET))) & + (XRGB_ACTSIZE_NUM_PIXEL_MASK); + + /* Reads number of active lines per frame */ + *VSize = (u16)(XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_ACTIVE_SIZE_OFFSET)) & + (XRGB_ACTSIZE_NUM_LINE_MASK)) >> + (XRGB_ACTSIZE_NUM_LINE_SHIFT); +} + +/*****************************************************************************/ +/** +* +* This function sets the maximum value allowed on the Luma (Y) channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param YMax specifies the maximum value within range [0, 255] of Luma +* channel that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetYMax(XRgb2YCrCb *InstancePtr, u32 YMax) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(YMax <= (u32)XRGB_YMAX_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_YMAX_OFFSET), YMax); +} + +/*****************************************************************************/ +/** +* +* This function returns the maximum value of the Luma (Y) channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return YMax, Maximum value within range [0, 255] of the Luma channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetYMax(XRgb2YCrCb *InstancePtr) +{ + u32 YMax; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + YMax = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_YMAX_OFFSET)) & (XRGB_16_BIT_MASK)); + + return YMax; +} + +/*****************************************************************************/ +/** +* +* This function sets the minimum value allowed on the Luma (Y) channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param YMin specifies the minimum value within range [0, 255] of Luma +* channel that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetYMin(XRgb2YCrCb *InstancePtr, u32 YMin) +{ + /* Verify arguments */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(YMin <= (u32)XRGB_YMIN_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_YMIN_OFFSET), YMin); +} + +/*****************************************************************************/ +/** +* +* This function returns the minimum value of the Luma (Y) channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return YMin, minimum value within range [0, 255] of the Luma channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetYMin(XRgb2YCrCb *InstancePtr) +{ + u32 YMin; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + YMin = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_YMIN_OFFSET)) & (XRGB_16_BIT_MASK)); + + return YMin; +} + +/*****************************************************************************/ +/** +* +* This function sets the maximum value allowed on the Cb Chroma channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param CbMax specifies the maximum value within range [0, 255] of Cb +* Chroma channel that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetCbMax(XRgb2YCrCb *InstancePtr, u32 CbMax) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CbMax <= (u32)XRGB_CBMAX_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CBMAX_OFFSET), CbMax); +} + +/*****************************************************************************/ +/** +* +* This function returns the maximum value on the Cb Chroma channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return CbMax, maximum value within range [0, 255] of the Cb Chroma +* Channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetCbMax(XRgb2YCrCb *InstancePtr) +{ + u32 CbMax; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + CbMax = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CBMAX_OFFSET)) & (XRGB_16_BIT_MASK)); + + return CbMax; +} + +/*****************************************************************************/ +/** +* +* This function sets the minimum value allowed on the Cb Chroma channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param CbMin specifies the maximum value within range [0, 255] of Cb +* Chroma channel needs to set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetCbMin(XRgb2YCrCb *InstancePtr, u32 CbMin) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CbMin <= (u32)XRGB_CBMIN_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CBMIN_OFFSET), CbMin); +} + +/*****************************************************************************/ +/** +* +* This function returns the minimum value on the Cb Chroma channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return CbMin, minimum value within range [0, 255] on the Cb Chroma +* Channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetCbMin(XRgb2YCrCb *InstancePtr) +{ + u32 CbMin; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + CbMin = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CBMIN_OFFSET)) & (XRGB_16_BIT_MASK)); + + return CbMin; +} +/*****************************************************************************/ +/** +* +* This function sets the maximum value allowed on the Cr Chroma channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param CrMax specifies the maximum value within range [0, 255] of Cr +* Chroma channel that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetCrMax(XRgb2YCrCb *InstancePtr, u32 CrMax) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CrMax <= (u32)XRGB_CRMAX_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CRMAX_OFFSET), CrMax); +} + +/*****************************************************************************/ +/** +* +* This function returns the maximum value on the Cr Chroma channel of the +* output +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return CrMax, maximum value within range [0, 255] on the Cr Chroma +* Channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetCrMax(XRgb2YCrCb *InstancePtr) +{ + u32 CrMax; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + CrMax = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CRMAX_OFFSET)) & (XRGB_16_BIT_MASK)); + + return CrMax; +} + +/*****************************************************************************/ +/** +* +* This function sets the minimum value allowed on the Cr Chroma channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param CrMin specifies the minimum value within range [0, 255] of Cr +* Chroma channel that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetCrMin(XRgb2YCrCb *InstancePtr, u32 CrMin) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CrMin <= (u32)XRGB_CRMIN_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CRMIN_OFFSET), CrMin); +} + +/*****************************************************************************/ +/** +* +* This function returns the minimum value on the Cr Chroma channel of the +* output. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return CrMin, minimum value within range [0, 255] on the Cr Chroma +* Channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetCrMin(XRgb2YCrCb *InstancePtr) +{ + u32 CrMin; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + CrMin = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CRMIN_OFFSET)) & (XRGB_16_BIT_MASK)); + + return CrMin; +} + +/*****************************************************************************/ +/** +* +* This function sets the offset compensation value for the Luma (Y) channel. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param YOffset specifies the compensation value within range [0, 255] +* of Luma channel that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetYOffset(XRgb2YCrCb *InstancePtr, u32 YOffset) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(YOffset <= (u32)XRGB_YOFFSET_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_YOFFSET_OFFSET), YOffset); +} + +/*****************************************************************************/ +/** +* +* This function returns the offset compensation value for the Luma (Y) channel. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return YOffset is compensation value within range [0, 255] for the +* Luma (Y) channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetYOffset(XRgb2YCrCb *InstancePtr) +{ + u32 YOffset; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + YOffset = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_YOFFSET_OFFSET)) & (XRGB_16_BIT_MASK)); + + return YOffset; +} + +/*****************************************************************************/ +/** +* +* This function sets the offset compensation value for the Cb Chroma channel. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param CbOffset specifies the compensation value within range [0, 255] +* of Cb Chroma channel that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetCbOffset(XRgb2YCrCb *InstancePtr, u32 CbOffset) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CbOffset <= (u32)XRGB_CBOFFSET_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CBOFFSET_OFFSET), CbOffset); +} + +/*****************************************************************************/ +/** +* +* This function returns the offset compensation value for the Cb Chroma channel. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return CbOffset is the compensation value within range [0, 255] for +* the Cb Chroma channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetCbOffset(XRgb2YCrCb *InstancePtr) +{ + u32 CbOffset; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + CbOffset = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CBOFFSET_OFFSET)) & (XRGB_16_BIT_MASK)); + + return CbOffset; +} + +/*****************************************************************************/ +/** +* +* This function sets the offset compensation value for the Cr Chroma channel. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param CrOffset specifies the compensation value within range [0, 255] +* of Cr Chroma channel that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetCrOffset(XRgb2YCrCb *InstancePtr, u32 CrOffset) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CrOffset <= (u32)XRGB_CROFFSET_LAST); + + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CROFFSET_OFFSET), CrOffset); +} + +/*****************************************************************************/ +/** +* +* This function returns the offset compensation value of the Cr Chroma channel. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return CrOffset is the compensation value within range [0, 255] of the +* Cr Chroma channel. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_GetCrOffset(XRgb2YCrCb *InstancePtr) +{ + u32 CrOffset; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + CrOffset = (XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CROFFSET_OFFSET)) & (XRGB_16_BIT_MASK)); + + return CrOffset; +} + +/*****************************************************************************/ +/** +* +* This function sets A, B, C and D coefficients. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param ACoef specifies the A coefficient value within the range +* [0.0 to 1.0] that needs to be set. +* @param BCoef specifies the B coefficient value within the range +* [0.0 to 1.0] that needs to be set. +* @param CCoef specifies the C coefficient value within the range +* [0.0 to 1.0] that needs to be set. +* @param DCoef specifies the D coefficient value within the range +* [0.0 to 1.0] that needs to be set. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_SetCoefs(XRgb2YCrCb *InstancePtr, double ACoef, double BCoef, + double CCoef, double DCoef) +{ + u32 CoefVal; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid((ACoef >= 0.000) && (ACoef <= 1.000)); + Xil_AssertVoid((BCoef >= 0.000) && (BCoef <= 1.000)); + Xil_AssertVoid((CCoef >= 0.000) && (CCoef <= 1.000)); + Xil_AssertVoid((DCoef >= 0.000) && (DCoef <= 1.000)); + + CoefVal = (u32)((ACoef) * (1 << (XRGB_16_BIT_COEF_SHIFT))); + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_ACOEF_OFFSET), CoefVal); + + CoefVal = (u32)((BCoef) * (1 << (XRGB_16_BIT_COEF_SHIFT))); + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_BCOEF_OFFSET), CoefVal); + + CoefVal = (u32)((CCoef) * (1 << (XRGB_16_BIT_COEF_SHIFT))); + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_CCOEF_OFFSET), CoefVal); + + CoefVal = (u32)((DCoef) * (1 << (XRGB_16_BIT_COEF_SHIFT))); + XRgb2YCrCb_WriteReg(InstancePtr->Config.BaseAddress, + (XRGB_DCOEF_OFFSET), CoefVal); +} + +/*****************************************************************************/ +/** +* +* This function returns A, B, C and D coefficients. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param ACoef is a pointer to double variable in which A coefficient is +* returned within the range [0.0 to 1.0]. +* @param BCoef is a pointer to double variable in which B coefficient is +* returned within the range [0.0 to 1.0]. +* @param CCoef is a pointer to double variable in which C coefficient is +* returned within the range [0.0 to 1.0]. +* @param DCoef is a pointer to double variable in which D coefficient is +* returned within the range [0.0 to 1.0]. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_GetCoefs(XRgb2YCrCb *InstancePtr, double *ACoef, double *BCoef, + double *CCoef, double *DCoef) +{ + u32 CoefVal; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(ACoef != NULL); + Xil_AssertVoid(BCoef != NULL); + Xil_AssertVoid(CCoef != NULL); + Xil_AssertVoid(DCoef != NULL); + + CoefVal = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_ACOEF_OFFSET)); + *ACoef = (double)CoefVal / + (double)(1 << (XRGB_16_BIT_COEF_SHIFT)); + + CoefVal = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_BCOEF_OFFSET)); + *BCoef = (double)CoefVal / + (double)(1 << (XRGB_16_BIT_COEF_SHIFT)); + + CoefVal = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_CCOEF_OFFSET)); + *CCoef = (double)CoefVal / + (double)(1 << (XRGB_16_BIT_COEF_SHIFT)); + + CoefVal = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_DCOEF_OFFSET)); + *DCoef = (double)CoefVal / + (double)(1 << (XRGB_16_BIT_COEF_SHIFT)); +} + +/*****************************************************************************/ +/** +* +* This function populates an XRgb2YCrCb_Coef_Inputs structure with the values +* from the selected video standard. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param StandardSel needs to be set from enum Standards value as : +* 0 = XRGB_STANDARD_ITU_601_SD +* 1 = XRGB_STANDARD_ITU_709_NTSC +* 2 = XRGB_STANDARD_ITU_709_PAL +* 3 = XRGB_STANDARD_YUV. +* @param InputRange needs to be set from enum OutputRanges value as: +* 0 = XRGB_TV_16_TO_240, +* 1 = XRGB_STUDIO_16_TO_235, +* 2 = XRGB_GRAPHICS_0_TO_255. +* @param DataWidth specifies the valid range of [8,10,12,16] that needs +* to be set. +* @param CoefIn specifies a pointer to a XRgb2YCrCb_Coef_Inputs +* structure which is populated with the values from selected +* video standard. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XRgb2YCrCb_Select_Standard(XRgb2YCrCb *InstancePtr, + enum Standards StandardSel, + enum OutputRanges InputRange, u32 DataWidth, + struct XRgb2YCrCb_Coef_Inputs *CoefIn) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CoefIn != NULL); + Xil_AssertVoid((DataWidth == (u32)(XRGB_DATA_WIDTH_16)) || + (DataWidth == (u32)(XRGB_DATA_WIDTH_10)) || + (DataWidth == (u32)(XRGB_DATA_WIDTH_12)) || + (DataWidth == (u32)(XRGB_DATA_WIDTH_8))); + + Xil_AssertVoid(StandardSel <(u32)(XRGB_STANDARD_CUSTOM)); + Xil_AssertVoid(InputRange <= (u32)(XRGB_GRAPHICS_0_TO_255)); + + double ACoef[4][3] = { + {0.299, 0.299, 0.2568}, + {0.299, 0.299, 0.2568}, + {0.2126, 0.2126, 0.1819}, + {0.299, 0.299, 0.299} + }; + + double BCoef[4][3] = { + {0.114, 0.114, 0.0979}, + {0.114, 0.114, 0.0979}, + {0.0722, 0.0722, 0.0618}, + {0.114, 0.114, 0.114} + }; + + double CCoef[4][3] = { + {0.713, 0.7295, 0.5910}, + {0.713, 0.7295, 0.5910}, + {0.6350, 0.6495, 0.6495}, + {0.877283, 0.877283, 0.877283} + }; + + double DCoef[4][3] = { + {0.564, 0.5772, 0.5772}, + {0.564, 0.5772, 0.5772}, + {0.5389, 0.5512, 0.5512}, + {0.492111, 0.492111, 0.492111} + }; + + u32 Max[3] = { + (240 * (1 << (DataWidth - 8))), + (235 * (1 << (DataWidth - 8))), + ((1 << DataWidth) - 1) + }; + u32 Min[3] = { + (16 * (1 << (DataWidth - 8))), + (16 * (1 << (DataWidth - 8))), + 0 + }; + + u32 YOffset = (1 << (DataWidth - 4)); + u32 COffset = (u32)(1 << (DataWidth - 1)); + + CoefIn->ACoef = ACoef[StandardSel][InputRange]; + CoefIn->BCoef = BCoef[StandardSel][InputRange]; + CoefIn->CCoef = CCoef[StandardSel][InputRange]; + CoefIn->DCoef = DCoef[StandardSel][InputRange]; + + CoefIn->YOffset = YOffset; + CoefIn->CbOffset = COffset; + CoefIn->CrOffset = COffset; + + CoefIn->YMax = Max[InputRange]; + CoefIn->YMin = Min[InputRange]; + CoefIn->CbMax = Max[InputRange]; + CoefIn->CbMin = Min[InputRange]; + CoefIn->CrMax = Max[InputRange]; + CoefIn->CrMin = Min[InputRange]; +} + +/*****************************************************************************/ +/** +* +* This function translates the XRgb2YCrCb_Coef_Inputs structure into the +* XRgb2YCrCb_Coef_Outputs structure that can be used to program the core's +* registers. The XRgb2YCrCb_Coef_Inputs structure uses the same values as the +* core's GUIs. The XRgb2YCrCb_Coef_Outputs structure uses the values that can +* be programmed into the core's registers. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param CoefIn specifies a pointer to a XRgb2YCrCb_Coef_Inputs +* structure to be translated. +* @param CoefOut specifies a pointer to a XRgb2YCrCb_Coef_Outputs +* structure with translated values. +* @param DataWidth specifies a valid range of [8,10,12,16] that needs +* to be set. +* +* @return RetVal, returns the 32-bit value with following bit information: +* - bit(0)= ACoef + BCoef > 1.0. +* - bit(1)= Y Offset outside data width range as +* [-2^Data_Width, (2^Data_Width)-1]. +* - bit(2)= Cb Offset outside data width range as +* [-2^Data_Width, (2^Data_Width)-1]. +* - bit(3)= Cr Offset outside data width range as +* [-2^Data_Width, (2^Data_Width)-1]. +* - bit(4)= Y Max outside data width range as +* [0, (2^Data_Width)-1]. +* - bit(5)= Y Min outside data width range as +* [0, (2^Data_Width)-1]. +* - bit(6)= Cb Max outside data width range as +* [0, (2^Data_Width)-1]. +* - bit(7)= Cb Min outside data width range as +* [0, (2^Data_Width)-1]. +* - bit(8)= Cr Max outside data width range as +* [0, (2^Data_Width)-1]. +* - bit(9)= Cr Min outside data width range as +* [0, (2^Data_Width)-1]. +* +* @note None. +* +******************************************************************************/ +u32 XRgb2YCrCb_Coefficient_Translation(XRgb2YCrCb *InstancePtr, + struct XRgb2YCrCb_Coef_Inputs *CoefIn, + struct XRgb2YCrCb_Coef_Outputs *CoefOut, + u32 DataWidth) +{ + u32 RetVal = 0; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(CoefIn != NULL); + Xil_AssertNonvoid(CoefOut != NULL); + + Xil_AssertNonvoid( (DataWidth == (u32)(XRGB_DATA_WIDTH_16)) || + (DataWidth == (u32)(XRGB_DATA_WIDTH_10)) || + (DataWidth == (u32)(XRGB_DATA_WIDTH_12)) || + (DataWidth == (u32)(XRGB_DATA_WIDTH_8))); + + if((CoefIn->ACoef + CoefIn->BCoef) > (1.0)) { + RetVal = (RetVal) | (0x1); + } + if((((int)CoefIn->YOffset) < ((int)-(1 << DataWidth))) || + (((int)CoefIn->YOffset) > ((int)((1 << DataWidth) -1 )))) { + RetVal = (RetVal) | (0x2); + } + if((((int)CoefIn->CbOffset) < ((int)-(1 << DataWidth))) || + (((int)CoefIn->CbOffset) > ((int)((1 << DataWidth) - 1)))) { + RetVal = (RetVal) | (0x4); + } + if((((int)CoefIn->CrOffset) < ((int)-(1 << DataWidth))) || + (((int)CoefIn->CrOffset) > ((int)((1 << DataWidth) - 1)))) { + RetVal = (RetVal) | (0x8); + } + if(((int)CoefIn->YMax) > ((int)((1 << DataWidth) - 1))) { + RetVal = (RetVal) | (0x10); + } + if(((int)CoefIn->YMin) > ((int)((1 << DataWidth) - 1))) { + RetVal = (RetVal) | (0x20); + } + if(((int)CoefIn->CbMax) > ((int)((1 << DataWidth) - 1))) { + RetVal = (RetVal) | (0x40); + } + if(((int)CoefIn->CbMin) > ((int)((1 << DataWidth) - 1))) { + RetVal = (RetVal) | (0x80); + } + if(((int)CoefIn->CrMax) > ((int)((1 << DataWidth) - 1))) { + RetVal = (RetVal) | (0x100); + } + if(((int)CoefIn->CrMin) > ((int)((1 << DataWidth) - 1))) { + RetVal = (RetVal) | (0x200); + } + + CoefOut->ACoef = CoefIn->ACoef * (1 << 16); + CoefOut->BCoef = CoefIn->BCoef * (1 << 16); + CoefOut->CCoef = CoefIn->CCoef * (1 << 16); + CoefOut->DCoef = CoefIn->DCoef * (1 << 16); + CoefOut->YOffset = CoefIn->YOffset; + CoefOut->CbOffset = CoefIn->CbOffset; + CoefOut->CrOffset = CoefIn->CrOffset; + CoefOut->YMax = CoefIn->YMax; + CoefOut->YMin = CoefIn->YMin; + CoefOut->CbMax = CoefIn->CbMax; + CoefOut->CbMin = CoefIn->CbMin; + CoefOut->CrMax = CoefIn->CrMax; + CoefOut->CrMin = CoefIn->CrMin; + + return RetVal; +} + +/*****************************************************************************/ +/** +* +* This function governs the range of outputs Y, Cr and Cb by affecting the +* conversion coefficients as well as the clipping and clamping values. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* @param Range needs to be set from the enum OutputRanges values as: +* 0 = XRGB_TV_16_TO_240, +* 1 = XRGB_STUDIO_16_TO_235, +* 2 = XRGB_GRAPHICS_0_TO_255. +* +* @return None. +* +* @note None. +* +*****************************************************************************/ +void XRgb2YCrCb_Select_OutputRange(XRgb2YCrCb *InstancePtr, + enum OutputRanges Range) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(Range <= (u32)(XRGB_GRAPHICS_0_TO_255)); + + /* Sets output range. */ + switch (Range) { + case XRGB_TV_16_TO_240: + (InstancePtr)->OutputRange = + (u32)XRGB_TV_16_TO_240; + break; + + case XRGB_STUDIO_16_TO_235: + (InstancePtr)->OutputRange = + (u32)XRGB_STUDIO_16_TO_235; + break; + + case XRGB_GRAPHICS_0_TO_255: + (InstancePtr)->OutputRange = + (u32)XRGB_GRAPHICS_0_TO_255; + break; + + default: + ; + break; + } +} + +/*****************************************************************************/ +/** +* +* This routine is a stub for the asynchronous callbacks. The stub is here in +* case the upper layer forgot to set the handlers. On initialization, All +* handlers except error handler are set to this callback. It is considered an +* error for this handler to be invoked. +* +* @param 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. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +static void StubCallBack(void *CallBackRef) +{ + Xil_AssertVoid(CallBackRef != NULL); + Xil_AssertVoidAlways(); +} + +/*****************************************************************************/ +/** +* +* This routine is a stub for the asynchronous error interrupt callback. The +* stub is here in case the upper layer forgot to set the handler. On +* initialization, Error interrupt handler is set to this callback. It is +* considered an error for this handler to be invoked. +* +* @param 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. +* @param ErrorMask is a bit mask indicating the cause of the error. Its +* value equals 'OR'ing one or more XRGB_IXR_*_MASK values defined +* in xrgb2ycrcb_hw.h +* +* @return None. +* +* @note None. +* +******************************************************************************/ +static void StubErrCallBack(void *CallBackRef, u32 ErrorMask) +{ + Xil_AssertVoid(CallBackRef != NULL); + Xil_AssertVoid(ErrorMask != (u32)0x0); + Xil_AssertVoidAlways(); +} + diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb.h b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb.h new file mode 100755 index 00000000..56aff325 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb.h @@ -0,0 +1,840 @@ +/****************************************************************************** +* +* Copyright (C) 2012 - 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xrgb2ycrcb.h +* +* This header file contains identifiers and register-level driver functions (or +* macros), range macros, structure typedefs that can be used to access the +* Xilinx Rgb2YCrCb core instance. +* +* The RGB to YCrCb Color-Space Convertor core is a simplified 3x3 matrix +* multiplier converts three input color samples to three output samples in a +* single clock cycle. The core supports four common format conversions as well +* as a custom mode that allows for a user-defined transform. The core is +* capable of a maximum resolution of 7680 columns by 7680 rows with 8, 10, 12, +* or 16 bits per pixel. +* +* Initialization & Configuration +* +* The device driver enables higher layer software (e.g., an application) to +* communicate to the RGB2YCRCB core. +* +* XRgb2YCrCb_CfgInitialize() API is used to initialize the RGB2YCRCB core. +* The user needs to first call the XRgb2YCrCb_LookupConfig() API which returns +* the Configuration structure pointer which is passed as a parameter to the +* XRgb2YCrCb_CfgInitialize() API. +* +* Interrupts +* +* The driver provides an interrupt handler XRgb2YCrCb_IntrHandler for handling +* the interrupt from the RGB2YCRCB core. The users of this driver have to +* register this handler with the interrupt system and provide the callback +* functions by using XRgb2YCrCb_SetCallBack API. +* +* Virtual Memory +* +* This driver supports Virtual Memory. The RTOS is responsible for calculating +* the correct device base address in Virtual Memory space. +* +* Threads +* +* This driver is not thread safe. Any needs for threads or thread mutual +* exclusion must be satisfied by the layer above this driver. +* +* Asserts +* +* Asserts are used within all Xilinx drivers to enforce constraints on argument +* values. Asserts can be turned off on a system-wide basis by defining, at +* compile time, the NDEBUG identifier. By default, asserts are turned on and it +* is recommended that users leave asserts on during development. +* +* Building the driver +* +* The XRgb2YCrCb driver is composed of several source files. This allows the user +* to build and link only those parts of the driver that are necessary. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------ -------- ------------------------------------------------------- +* 5.00a tb 02/27/12 Updated for RGB2YCRCB V5.00.a +* 5.01a bao 12/28/12 Converted from xio.h to xil_io.h, translating basic +* types, MB cache functions, exceptions and assertions +* to xil_io format. +* 6.0 adk 19/12/13 Updated as per the New Tcl API's. +* 7.0 adk 01/07/14 Changed the file name from "rgb2ycrcb.h" to +* "xrgb2ycrcb.h". +* Moved register offsets and bit definitions from +* rgb2ycrcb.h file to xrgb2ycrcb_hw.h file. +* +* Removed RGB_TIMING_STATUS register offset because this +* register is not present in latest product guide. +* +* Removed following function macros: +* RGB_Enable, RGB_Disable, RGB_RegUpdateEnable, +* RGB_RegUpdateDisable, RGB_Reset, RGB_ClearReset, +* RGB_AutoSyncReset. + +* Removed following functions: +* RGB_select_standard, RGB_coefficient_translation, +* RGB_set_coefficients, RGB_get_coefficients. +* +* Added following handler types as enum: +* XRGB_HANDLER_PROCSTART, XRGB_HANDLER_FRAMEDONE, +* XRGB_HANDLER_ERROR. +* +* Added following standard types as enum: +* XRGB_STANDARD_ITU_601_SD, XRGB_STANDARD_ITU_709_NTSC, +* XRGB_STANDARD_ITU_709_PAL, XRGB_STANDARD_YUV, +* XRGB_STANDARD_CUSTOM. +* +* Added following output ranges as enum: +* XRGB_TV_16_TO_240, XRGB_STUDIO_16_TO_235, +* XRGB_GRAPHICS_0_TO_255. +* +* Added range macros for ActiveSize, YMAX, YMIN, YOFFSET, +* CBMAX, CBMIN, CBOFFSET, CRMAX, CRMIN, CROFFSET +* registers. +* +* Added following function macros: +* XRgb2YCrCb_IntrEnable, XRgb2YCrCb_SyncReset, +* XRgb2YCrCb_IntrDisable, XRgb2YCrCb_StatusGetPending, +* XRgb2YCrCb_IntrGetPending, XRgb2YCrCb_IntrClear, +* XRgb2YCrCb_RegUpdateEnable, +* XRgb2YCrCb_RegUpdateDisable, XRgb2YCrCb_Reset, +* XRgb2YCrCb_Enable, XRgb2YCrCb_Disable, +* XRgb2YCrCb_Start, XRgb2YCrCb_Stop. +* +* Added core and configuration structure. +* Renamed rgb_coef_inputs -> XRgb2YCrCb_Coef_Inputs and +* rgb_coef_outputs - > XRgb2YCrCb_Coef_Outputs. +* +* Added callback functions typedef. +* +* Implemented XRgb2YCrCb_LookupConfig in +* xrgb2ycrcb_sinit.c +* Implemented XRgb2YCrCb_SelfTest in +* xrgb2ycrcb_selftest.c +* Implemented XRgb2YCrCb_IntrHandler, +* XRgb2YCrCb_SetCallBack in xrgb2ycrcb_intr.c. +* +* Implemented following functions in xrgb2ycrcb.c: +* XRgb2YCrCb_CfgInitialize, XRgb2YCrCb_EnableDbgByPass, +* XRgb2YCrCb_IsDbgByPassEnabled, +* XRgb2YCrCb_DisableDbgBypass, +* XRgb2YCrCb_EnableDbgTestPattern, +* XRgb2YCrCb_IsDbgTestPatternEnabled, +* XRgb2YCrCb_DisableDbgTestPattern, +* XRgb2YCrCb_GetVersion, XRgb2YCrCb_GetDbgFrameCount, +* XRgb2YCrCb_GetDbgLineCount, +* XRgb2YCrCb_GetDbgPixelCount, XRgb2YCrCb_Setup, +* XRgb2YCrCb_SetActiveSize, XRgb2YCrCb_GetActiveSize, +* XRgb2YCrCb_SetYMax, XRgb2YCrCb_GetYMax, +* XRgb2YCrCb_SetYMin, XRgb2YCrCb_GetYMin, +* XRgb2YCrCb_SetCbMax, XRgb2YCrCb_GetCbMax, +* XRgb2YCrCb_SetCbMin, XRgb2YCrCb_GetCbMin, +* XRgb2YCrCb_SetCrMax, XRgb2YCrCb_GetCrMax, +* XRgb2YCrCb_SetCrMin, XRgb2YCrCb_GetCrMin, +* XRgb2YCrCb_SetYOffset, XRgb2YCrCb_GetYOffset, +* XRgb2YCrCb_SetCbOffset, XRgb2YCrCb_GetCbOffset, +* XRgb2YCrCb_SetCrOffset, XRgb2YCrCb_GetCrOffset, +* XRgb2YCrCb_SetCoefs, XRgb2YCrCb_GetCoefs, +* XRgb2YCrCb_Select_Standard, +* XRgb2YCrCb_Coefficient_Translation, +* XRgb2YCrCb_Select_OutputRange. +*+* +******************************************************************************/ + +#ifndef XRGB2YCRCB_H_ +#define XRGB2YCRCB_H_ /**< Prevent circular inclusions by using protection + * macros + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xrgb2ycrcb_hw.h" +#include "xil_assert.h" +#include "xstatus.h" + +/************************** Constant Definitions *****************************/ + +/** @name Handler Types + * @{ + */ +/** +* +* These constants specify different types of handler and used to differentiate +* interrupt requests from core. +*/ +enum { + XRGB_HANDLER_PROCSTART = 1, /**< A processing start event interrupt + * type */ + XRGB_HANDLER_FRAMEDONE, /**< A frame done event + * interrupt type */ + XRGB_HANDLER_ERROR /**< An error condition interrupt + * type */ +} ; +/*@}*/ + +/** @name Standard Types + * @{ + */ +/** +* +* These constants specify different types of standards used to represent +* standard color encoding. +*/ +enum Standards { + XRGB_STANDARD_ITU_601_SD = 0, /**< Standard ITU 601 SD. */ + XRGB_STANDARD_ITU_709_NTSC, /**< Standard ITU 709 NTSC. */ + XRGB_STANDARD_ITU_709_PAL, /**< Standard ITU 709 PAL. */ + XRGB_STANDARD_YUV, /**< Standard YUV. */ + XRGB_STANDARD_CUSTOM /**< Standard Custom. */ +} ; +/*@}*/ + +/** @name Output Ranges + * @{ + */ +/** +* +* These constants specify different ranges used for studio equipment, +* television and computer graphics respectively. +*/ +enum OutputRanges { + XRGB_TV_16_TO_240 = 0, /**< 16 to 240, for Television. */ + XRGB_STUDIO_16_TO_235, /**< 16 to 235, for Studio Equipment. */ + XRGB_GRAPHICS_0_TO_255 /**< 0 to 255, for Computer Graphics. */ +} ; +/*@}*/ + +/** @name Active size range macros + * @{ + */ +#define XRGB_VSIZE_FIRST 32 /**< VSize starting value */ +#define XRGB_VSIZE_LAST 7680 /**< VSize ending value */ +#define XRGB_HSIZE_FIRST 32 /**< HSize starting value */ +#define XRGB_HSIZE_LAST 7680 /**< HSize ending value */ +/*@}*/ + +/** @name Ymax range macros + * @{ + */ +#define XRGB_YMAX_FIRST 0 /**< Ymax starting value */ +#define XRGB_YMAX_LAST 255 /**< Ymax ending value */ +/*@}*/ + +/** @name Ymin range macros + * @{ + */ +#define XRGB_YMIN_FIRST 0 /**< Ymin starting value */ +#define XRGB_YMIN_LAST 255 /**< Ymax ending value */ +/*@}*/ + +/** @name Yoffset range macros + * @{ + */ +#define XRGB_YOFFSET_FIRST 0 /**< Yoffset starting value */ +#define XRGB_YOFFSET_LAST 255 /**< Yoffset ending value */ +/*@}*/ + +/** @name Cbmax range macros + * @{ + */ +#define XRGB_CBMAX_FIRST 0 /**< Cbmax starting value */ +#define XRGB_CBMAX_LAST 255 /**< Cbmax ending value */ +/*@}*/ + +/** @name Cbmin range macros + * @{ + */ +#define XRGB_CBMIN_FIRST 0 /**< Cbmin starting value */ +#define XRGB_CBMIN_LAST 255 /**< Cbmin ending value */ +/*@}*/ + +/** @name Cboffset range macros + * @{ + */ +#define XRGB_CBOFFSET_FIRST 0 /**< Cboffset starting value */ +#define XRGB_CBOFFSET_LAST 255 /**< Cboffset ending value */ +/*@}*/ + +/** @name Crmax range macros + * @{ + */ +#define XRGB_CRMAX_FIRST 0 /**< Crmax starting value */ +#define XRGB_CRMAX_LAST 255 /**< Crmax ending value */ +/*@}*/ + +/** @name Crmin range macros + * @{ + */ +#define XRGB_CRMIN_FIRST 0 /**< Crmin starting value */ +#define XRGB_CRMIN_LAST 255 /**< Crmin ending value */ +/*@}*/ + +/** @name Croffset range macros + * @{ + */ +#define XRGB_CROFFSET_FIRST 0 /**< Croffset starting value */ +#define XRGB_CROFFSET_LAST 255 /**< Croffset ending value */ +/*@}*/ + +/***************** Macros (Inline Functions) Definitions *********************/ + +/*****************************************************************************/ +/** +* +* This macro enables the Rgb2YCrCb device/core. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_Enable(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_Enable(InstancePtr) \ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET))) | (XRGB_CTL_SW_EN_MASK))) + +/*****************************************************************************/ +/** +* +* This macro disables the Rgb2YCrCb device/core. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_Disable(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_Disable(InstancePtr) \ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET))) & (~(XRGB_CTL_SW_EN_MASK)))) + +/*****************************************************************************/ +/** +* +* This function macro enables/starts the Rgb2YCrCb core. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb instance to be +* worked on +* +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_Start(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_Start XRgb2YCrCb_Enable + +/*****************************************************************************/ +/** +* +* This function macro disables/stops the Rgb2YCrCb core. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb instance to be +* worked on +* +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_Stop(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_Stop XRgb2YCrCb_Disable + +/*****************************************************************************/ +/** +* +* This macro enables copying from updated processor register values to +* the active set at the end of each AXI-Stream frame. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_RegUpdateEnable(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_RegUpdateEnable(InstancePtr)\ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET))) | (XRGB_CTL_RUE_MASK))) + +/*****************************************************************************/ +/** +* +* This macro disables copying from updated processor register values to +* the active set at the end of each AXI-Stream frame. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_RegUpdateDisable(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_RegUpdateDisable(InstancePtr) \ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET)))) & (~(XRGB_CTL_RUE_MASK))) + +/*****************************************************************************/ +/** +* +* This macro resets the Rgb2YCrCb device, but differs from XRgb_Reset() in that +* it automatically synchronizes to the VBlank_in input of the core to prevent +* tearing. +* +* On the next rising-edge of VBlank_in following a call to +* XRgb2YCrCb_SyncReset(), all of the core's configuration registers and outputs +* will be reset, then the reset flag will be immediately released, allowing the +* core to immediately resume default operation. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_SyncReset(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_SyncReset(InstancePtr) \ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), (XRGB_CTL_AUTORESET_MASK)) + +/*****************************************************************************/ +/** +* +* This macro resets the Rgb2YCrCb core. This reset effects the core +* immediately, and may cause image tearing. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_Reset(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_Reset(InstancePtr) \ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_CONTROL_OFFSET), (XRGB_CTL_RESET_MASK)) + +/*****************************************************************************/ +/** +* +* This function macro enables individual interrupts of the RGB2YCRCB core by +* updating the IRQ_ENABLE register. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* @param IntrType is the bit-mask of the interrupts to be enabled. +* Bit positions of 1 will be enabled. Bit positions of 0 will +* keep the previous setting. This mask is formed by OR'ing +* XRGB_IXR_*_MASK bits defined in xrgb2ycrcb_hw.h. +* +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_IntrEnable(XRgb2YCrCb *InstancePtr, +* u32 IntrType) +* +* The existing enabled interrupt(s) will remain enabled. +* +******************************************************************************/ +#define XRgb2YCrCb_IntrEnable(InstancePtr, IntrType) \ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET), (((IntrType) & \ + (XRGB_IXR_ALLINTR_MASK)) | \ + (XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET))))) + +/*****************************************************************************/ +/** +* +* This function macro disables individual interrupts of the RGB2YCRCB core by +* updating the IRQ_ENABLE register. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* @param IntrType is the bit-mask of the interrupts to be disabled. +* Bit positions of 1 will be disabled. Bit positions of 0 will +* keep the previous setting. This mask is formed by OR'ing +* XRGB_IXR_*_MASK bits defined in xrgb2ycrcb_hw.h. +* +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_IntrDisable(XRgb2YCrCb *InstancePtr, +* u32 IntrType) +* +* Any other interrupt not covered by parameter IntrType, if +* enabled before this macro is called, will remain enabled. +* +******************************************************************************/ +#define XRgb2YCrCb_IntrDisable(InstancePtr, IntrType) \ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET), \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET))) & ((~(IntrType)) & \ + (XRGB_IXR_ALLINTR_MASK)))) + +/*****************************************************************************/ +/** +* +* This function macro returns the pending interrupt status of the RGB2YCRCB +* core read from the Status register. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* +* @return The status of pending interrupts of the Rgb2YCrCb core. +* Use XRGB_IXR_*_MASK constants defined in xrgb2ycrcb_hw.h to +* interpret this value. +* +* @note C-style signature: +* u32 XRgb2YCrCb_StatusGePending(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_StatusGetPending(InstancePtr) \ + XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_STATUS_OFFSET)) & (XRgb2YCrCb_IXR_ALLINTR_MASK) + +/*****************************************************************************/ +/** +* +* This function macro returns the pending interrupts of the RGB2YCRCB core for +* the interrupts that have been enabled. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* +* @return The pending interrupts of the Rgb2YCrCb core. Use +* XRGB_IXR_*_MASK constants defined in xrgb2ycrcb_hw.h to +* interpret this value. The returned value is a logical AND of +* the contents of the STATUS Register and the IRQ_ENABLE +* Register. +* +* @note C-style signature: +* u32 XRgb2YCrCb_IntrGetPending(XRgb2YCrCb *InstancePtr) +* +******************************************************************************/ +#define XRgb2YCrCb_IntrGetPending(InstancePtr) \ + XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_IRQ_EN_OFFSET)) & \ + ((XRgb2YCrCb_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_STATUS_OFFSET))) & ((u32)(XRGB_IXR_ALLINTR_MASK))) + +/*****************************************************************************/ +/** +* +* This function macro clears/acknowledges pending interrupts of the RGB2YCRCB +* core in the Status register. Bit positions of 1 will be cleared. +* +* @param InstancePtr is a pointer to the Rgb2YCrCb core instance to be +* worked on. +* @param IntrType is the pending interrupts to clear/acknowledge. +* Use OR'ing of XRGB_IXR_*_MASK constants defined in +* xrgb2ycrcb_hw.h to create this parameter value. +* +* @return None. +* +* @note C-style signature: +* void XRgb2YCrCb_IntrClear(XRgb2YCrCb *InstancePtr, +* u32 IntrType) +* +******************************************************************************/ +#define XRgb2YCrCb_IntrClear(InstancePtr, IntrType) \ + XRgb2YCrCb_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XRGB_STATUS_OFFSET), ((IntrType) & \ + (XRGB_IXR_ALLINTR_MASK))) + +/**************************** Type Definitions *******************************/ + +/** +* This typedef contains configuration information for a Rgb2YCrCb core. +* Each Rgb2YCrCb core should have a configuration structure associated. +*/ +typedef struct { + u16 DeviceId; /**< DeviceId is the unique ID of the + * RGB2YCRCB core */ + u32 BaseAddress; /**< BaseAddress is the physical base address + * of the RGB2YCRCB core registers */ + u32 SlaveAxisVideoFormat; /**< Slave Axis Video Format */ + u32 MasterAxisVideoFormat; /**< Master Axis Video Format */ + u16 HasDebug; /**< To check debug support */ + u16 HasIntcIf; /**< To check Interrupt controller + * support */ + u32 MaxCols; /**< Maximum number of columns */ + u32 ActiveCols; /**< Number of active columns */ + u32 ActiveRows; /**< Number of active rows */ + u16 HasClip; /**< To check support for clipping */ + u16 HasClamp; /**< To check support for clamping */ + u32 ACoef; /**< A coefficient */ + u32 BCoef; /**< B coefficient */ + u32 CCoef; /**< C coefficient */ + u32 DCoef; /**< D coefficient */ + u32 YOffset; /**< Y Offset value */ + u32 CbOffset; /**< Cb Offset value */ + u32 CrOffset; /**< Cr Offset value */ + u32 YMax; /**< Y Min value */ + u32 YMin; /**< Y Max value */ + u32 CbMax; /**< Cb Max value */ + u32 CbMin; /**< Cb Min value */ + u32 CrMax; /**< Cr Max value */ + u32 CrMin; /**< Cr Min value */ + u32 SlaveAxiClkFreqHz; /**< Slave AXI Clock Frequency in Hz */ + u32 StandardSelection; /**< To select standard */ + u32 OutputRange; /**< To identify output range */ +} XRgb2YCrCb_Config; + +/*****************************************************************************/ +/** +* +* Callback type for all interrupts except error interrupt. +* +* @param 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. +* +* @return None. +* +* @note None. +* +*****************************************************************************/ +typedef void (*XRgb2YCrCb_CallBack)(void *CallBackRef); + +/*****************************************************************************/ +/** +* +* This data type defines a handler that an application defines to communicate +* with interrupt system to retrieve error information while processing video +* frame. +* +* @param 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. +* @param ErrorMask is a bit mask indicating the cause of the error. Its +* value equals 'OR'ing one or more XRGB_IXR_*_MASK values defined +* in xrgb2ycrcb_hw.h. +* +* @return None. +* +* @note None. +* +*****************************************************************************/ +typedef void (*XRgb2YCrCb_ErrorCallBack)(void *CallBackRef, u32 ErrorMask); + +/** +* The XRgb2YCrCb driver instance data structure. A pointer to an instance data +* structure is passed around by functions to refer to a specific driver +* instance. +*/ +typedef struct { + XRgb2YCrCb_Config Config; /**< Hardware configuration */ + u32 IsReady; /**< Core and driver instance are initialized */ + u16 HSize; /**< Active Video Horizontal Size */ + u16 VSize; /**< Active Video Vertical Size */ + + /* IRQ callbacks Here */ + XRgb2YCrCb_CallBack ProcStartCallBack; /**< Callback for Processing + * Start interrupt */ + void *ProcStartRef; /**< To be passed to Process start interrupt + * callback */ + XRgb2YCrCb_CallBack FrameDoneCallBack; /**< Callback for Frame Done + * interrupt */ + void *FrameDoneRef; /**< To be passed to the Frame done interrupt + * callback */ + XRgb2YCrCb_ErrorCallBack ErrCallBack; /**< Callback for Error + * interrupt */ + void *ErrRef; /**< To be passed to the Error interrupt callback */ + u32 StandardSelection; /**< Standard Selection */ + u32 OutputRange; /**< Output Range */ +} XRgb2YCrCb; + +/** +* Rgb2YCrCb input coefficient +*/ +struct XRgb2YCrCb_Coef_Inputs { + /* Pre-translated coefficient/offset data */ + double ACoef; /**< [ 0.0 - 1.0 ] 0.0 < ACOEFF + BCOEFF < 1.0 */ + double BCoef; /**< [ 0.0 - 1.0 ] 0.0 < ACOEFF + BCOEFF < 1.0 */ + double CCoef; /**< [ 0.0 - 0.9 ] */ + double DCoef; /**< [ 0.0 - 0.9 ] */ + u32 YOffset; /**< Offset for the Luminance Channel */ + u32 CbOffset; /**< Offset for the Chrominance Channels */ + u32 CrOffset; /**< Offset for the Chrominance Channels */ + u32 YMax; /**< Y Clipping */ + u32 YMin; /**< Y Clamping */ + u32 CbMax; /**< Cb Clipping */ + u32 CbMin; /**< Cb Clamping */ + u32 CrMax; /**< Cr Clipping */ + u32 CrMin; /**< Cr Clamping */ +} ; + +/** +* Rgb2YCrCb output coefficient +*/ +struct XRgb2YCrCb_Coef_Outputs { + /* Translated coefficient/offset data */ + u32 ACoef; /**< Translated ACoef */ + u32 BCoef; /**< Translated BCoef */ + u32 CCoef; /**< Translated CCoef */ + u32 DCoef; /**< Translated DCoef */ + u32 YOffset; /**< Translated Offset for the Luminance Channel */ + u32 CbOffset; /**< Translated Offset for the Chrominance Channels */ + u32 CrOffset; /**< Translated Offset for the Chrominance Channels */ + u32 YMax; /**< Translated Y Clipping */ + u32 YMin; /**< Translated Y Clamping */ + u32 CbMax; /**< Translated Cb Clipping */ + u32 CbMin; /**< Translated Cb Clamping */ + u32 CrMax; /**< Translated Cr Clipping */ + u32 CrMin; /**< Translated Cr Clamping */ +} ; + +/************************** Function Prototypes ******************************/ + +/* Static lookup function implemented in xrgb2ycrcb_sinit.c */ +XRgb2YCrCb_Config *XRgb2YCrCb_LookupConfig(u16 DeviceId); + +/* Following functions implemented in xrgb2ycrcb.c */ +int XRgb2YCrCb_CfgInitialize(XRgb2YCrCb *InstancePtr, + XRgb2YCrCb_Config *CfgPtr, u32 EffectiveAddr); + +void XRgb2YCrCb_EnableDbgByPass(XRgb2YCrCb *InstancePtr); +int XRgb2YCrCb_IsDbgByPassEnabled(XRgb2YCrCb *InstancePtr); +void XRgb2YCrCb_DisableDbgBypass(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_EnableDbgTestPattern(XRgb2YCrCb *InstancePtr); +int XRgb2YCrCb_IsDbgTestPatternEnabled(XRgb2YCrCb *InstancePtr); +void XRgb2YCrCb_DisableDbgTestPattern(XRgb2YCrCb *InstancePtr); + +u32 XRgb2YCrCb_GetVersion(XRgb2YCrCb *InstancePtr); + +u32 XRgb2YCrCb_GetDbgFrameCount(XRgb2YCrCb *InstancePtr); +u32 XRgb2YCrCb_GetDbgLineCount(XRgb2YCrCb *InstancePtr); +u32 XRgb2YCrCb_GetDbgPixelCount(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_Setup(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetActiveSize(XRgb2YCrCb *InstancePtr, u16 HSize, u16 VSize); +void XRgb2YCrCb_GetActiveSize(XRgb2YCrCb *InstancePtr, u16 *HSize, u16 *VSize); + +void XRgb2YCrCb_SetYMax(XRgb2YCrCb *InstancePtr, u32 YMax); +u32 XRgb2YCrCb_GetYMax(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetYMin(XRgb2YCrCb *InstancePtr, u32 YMin); +u32 XRgb2YCrCb_GetYMin(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetCbMax(XRgb2YCrCb *InstancePtr, u32 CbMax); +u32 XRgb2YCrCb_GetCbMax(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetCbMin(XRgb2YCrCb *InstancePtr, u32 CbMin); +u32 XRgb2YCrCb_GetCbMin(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetCrMax(XRgb2YCrCb *InstancePtr, u32 CrMax); +u32 XRgb2YCrCb_GetCrMax(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetCrMin(XRgb2YCrCb *InstancePtr, u32 CrMin); +u32 XRgb2YCrCb_GetCrMin(XRgb2YCrCb *InstancePtr); + + +void XRgb2YCrCb_SetYOffset(XRgb2YCrCb *InstancePtr, u32 YOffset); +u32 XRgb2YCrCb_GetYOffset(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetCbOffset(XRgb2YCrCb *InstancePtr, u32 CbOffset); +u32 XRgb2YCrCb_GetCbOffset(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetCrOffset(XRgb2YCrCb *InstancePtr, u32 CrOffset); +u32 XRgb2YCrCb_GetCrOffset(XRgb2YCrCb *InstancePtr); + +void XRgb2YCrCb_SetCoefs(XRgb2YCrCb *InstancePtr, double ACoef, double BCoef, + double CCoef, double DCoef); +void XRgb2YCrCb_GetCoefs(XRgb2YCrCb *InstancePtr, double *ACoef, double *BCoef, + double *CCoef, double *DCoef); + +void XRgb2YCrCb_Select_Standard(XRgb2YCrCb *InstancePtr, + enum Standards StandardSel, + enum OutputRanges InputRange, u32 DataWidth, + struct XRgb2YCrCb_Coef_Inputs *CoefIn); + +u32 XRgb2YCrCb_Coefficient_Translation(XRgb2YCrCb *InstancePtr, + struct XRgb2YCrCb_Coef_Inputs *CoefIn, + struct XRgb2YCrCb_Coef_Outputs *CoefOut, + u32 Data_Width); + +void XRgb2YCrCb_Select_OutputRange(XRgb2YCrCb *InstancePtr, + enum OutputRanges Range); + +/* Self-test function implemented in xrgb2ycrcb_selftest.c */ +int XRgb2YCrCb_SelfTest(XRgb2YCrCb *InstancePtr); + +/* Interrupt related functions implemented in xrgbycrcb_intr.c */ +void XRgb2YCrCb_IntrHandler(void *InstancePtr); + +int XRgb2YCrCb_SetCallBack(XRgb2YCrCb *InstancePtr, u32 HandlerType, + void *CallBackFunc, + void *CallBackRef); + +/************************** Variable Declarations ****************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* End of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_g.c b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_g.c new file mode 100755 index 00000000..2b5af030 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_g.c @@ -0,0 +1,87 @@ + +/******************************************************************* +* +* CAUTION: This file is automatically generated by HSM. +* Version: +* DO NOT EDIT. +* +* v (64-bit) +SW Build (by ) on +Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. +* +* Description: Driver configuration +* +*******************************************************************/ + +#include "xparameters.h" +#include "xrgb2ycrcb.h" + +/* +* The configuration table for devices +*/ + +XRgb2YCrCb_Config XRgb2YCrCb_ConfigTable[] = +{ + { + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_DEVICE_ID, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_BASEADDR, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_HIGHADDR, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_S_AXIS_VIDEO_FORMAT, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_M_AXIS_VIDEO_FORMAT, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_HAS_DEBUG, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_HAS_INTC_IF, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_MAX_COLS, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_ACTIVE_COLS, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_ACTIVE_ROWS, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_HAS_CLIP, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_HAS_CLAMP, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_ACOEF, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_BCOEF, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_CCOEF, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_DCOEF, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_YOFFSET, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_CBOFFSET, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_CROFFSET, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_YMAX, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_YMIN, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_CBMAX, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_CBMIN, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_CRMAX, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_CRMIN, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_S_AXI_CLK_FREQ_HZ, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_STANDARD_SEL, + XPAR_FMC_SENSOR_INPUT_V_RGB2YCRCB_1_OUTPUT_RANGE + }, + { + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_DEVICE_ID, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_BASEADDR, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_HIGHADDR, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_S_AXIS_VIDEO_FORMAT, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_M_AXIS_VIDEO_FORMAT, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_HAS_DEBUG, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_HAS_INTC_IF, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_MAX_COLS, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_ACTIVE_COLS, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_ACTIVE_ROWS, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_HAS_CLIP, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_HAS_CLAMP, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_ACOEF, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_BCOEF, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_CCOEF, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_DCOEF, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_YOFFSET, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_CBOFFSET, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_CROFFSET, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_YMAX, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_YMIN, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_CBMAX, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_CBMIN, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_CRMAX, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_CRMIN, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_S_AXI_CLK_FREQ_HZ, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_STANDARD_SEL, + XPAR_HDMI_OUTPUT_V_RGB2YCRCB_1_OUTPUT_RANGE + } +}; + + diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_hw.h b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_hw.h new file mode 100755 index 00000000..73193475 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_hw.h @@ -0,0 +1,371 @@ +/****************************************************************************** +* +* Copyright (C) 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xrgb2ycrcb_hw.h +* +* This header file contains identifiers and register-level driver functions (or +* macros) that can be used to access the Xilinx RGB to YCrCb color space +* converter (RGB2YCRCB) core. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------ -------- ----------------------------------------------------- +* 7.0 adk 01/28/14 First release. +* Added the register offsets and bit masks for the +* registers. +* Added backward compatibility macros. +*+* +******************************************************************************/ + +#ifndef XRGB2YCRCB_HW_H_ +#define XRGB2YCRCB_HW_H_ /**< Prevent circular inclusions + * by using protection macros */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xil_io.h" + +/************************** Constant Definitions *****************************/ + +/** @name Control Registers + * + * Control registers offset for RGB2YCRCB core. + * @{ + */ +#define XRGB_CONTROL_OFFSET 0x000 /**< Control offset */ +#define XRGB_STATUS_OFFSET 0x004 /**< Status offset */ +#define XRGB_ERROR_OFFSET 0x008 /**< Error offset */ +#define XRGB_IRQ_EN_OFFSET 0x00C /**< IRQ Enable offset */ +#define XRGB_VERSION_OFFSET 0x010 /**< Version offset */ +#define XRGB_SYSDEBUG0_OFFSET 0x014 /**< System Debug 0 offset */ +#define XRGB_SYSDEBUG1_OFFSET 0x018 /**< System Debug 1 offset */ +#define XRGB_SYSDEBUG2_OFFSET 0x01C /**< System Debug 2 offset */ +/*@}*/ + +/** @name Timing Control Registers + * + * Timing control registers offset for RGB2YCRCB core. + * @{ + */ +#define XRGB_ACTIVE_SIZE_OFFSET 0x020 /**< Active Size (V x H) + * offset */ +/*@}*/ + +/** @name Core Specific Registers + * + * Core specific registers offset. + * @{ + */ +#define XRGB_YMAX_OFFSET 0x100 /**< Luma Clipping offset */ +#define XRGB_YMIN_OFFSET 0x104 /**< Luma Clamping offset */ +#define XRGB_CBMAX_OFFSET 0x108 /**< Cb Clipping offset */ +#define XRGB_CBMIN_OFFSET 0x10C /**< Cb Clamping offset */ +#define XRGB_CRMAX_OFFSET 0x110 /**< Cr Clipping offset */ +#define XRGB_CRMIN_OFFSET 0x114 /**< Cr Clamping offset */ +#define XRGB_YOFFSET_OFFSET 0x118 /**< Luma Offset offset */ +#define XRGB_CBOFFSET_OFFSET 0x11C /**< Cb Offset offset */ +#define XRGB_CROFFSET_OFFSET 0x120 /**< Cr Offset offset */ +#define XRGB_ACOEF_OFFSET 0x124 /**< A Coefficient offset */ +#define XRGB_BCOEF_OFFSET 0x128 /**< B Coefficient offset */ +#define XRGB_CCOEF_OFFSET 0x12C /**< C Coefficient offset */ +#define XRGB_DCOEF_OFFSET 0x130 /**< D Coefficient offset */ +/*@}*/ + +/** @name Control Register Bit Masks + * + * Control Register bit definition for RGB2YCRCB core. + * @{ + */ +#define XRGB_CTL_SW_EN_MASK 0x00000001 /**< Software Enable Mask */ +#define XRGB_CTL_RUE_MASK 0x00000002 /**< Register Update + * Enable Mask */ +#define XRGB_CTL_BPE_MASK 0x00000010 /**< Bypass Mask */ +#define XRGB_CTL_TPE_MASK 0x00000020 /**< Test Pattern Mask */ +#define XRGB_CTL_AUTORESET_MASK 0x40000000 /**< Software Reset - + * Auto-synchronize + * to SOF Mask */ +#define XRGB_CTL_RESET_MASK 0x80000000 /**< Software Reset - + * Instantaneous Mask */ +/*@}*/ + +/** @name Slave Error Bit Masks + * @{ + */ +#define XRGB_ERR_EOL_EARLY_MASK 0x000000001 /**
+* HandlerType Callback Function Type +* ----------------------- -------------------------------------------------- +* XRGB_HANDLER_PROCSTART ProcStartCallBack +* XRGB_HANDLER_FRAMEDONE FrameDoneCallBack +* XRGB_HANDLER_ERROR ErrCallBack +*+* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance to be +* worked on. +* @param HandlerType specifies which callback is to be attached. +* @param CallBackFunc is the address of the callback function. +* @param CallBackRef is a user data item that will be passed to the +* callback function when it is invoked. +* +* @return +* - 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. +* +******************************************************************************/ +int XRgb2YCrCb_SetCallBack(XRgb2YCrCb *InstancePtr, u32 HandlerType, + void *CallBackFunc, void *CallBackRef) +{ + int Status; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->IsReady == + (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertNonvoid(CallBackFunc != NULL); + Xil_AssertNonvoid(CallBackRef != NULL); + Xil_AssertNonvoid((HandlerType >= (u32)(XRGB_HANDLER_PROCSTART)) && + (HandlerType <= (u32)(XRGB_HANDLER_ERROR))); + + /* Sets the callback according to HandlerType */ + switch (HandlerType) { + case XRGB_HANDLER_PROCSTART: + InstancePtr->ProcStartCallBack = + (XRgb2YCrCb_CallBack)((void *)CallBackFunc); + InstancePtr->ProcStartRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + case XRGB_HANDLER_FRAMEDONE: + InstancePtr->FrameDoneCallBack = + (XRgb2YCrCb_CallBack)((void *)CallBackFunc); + InstancePtr->FrameDoneRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + case XRGB_HANDLER_ERROR: + InstancePtr->ErrCallBack = + (XRgb2YCrCb_ErrorCallBack)((void *)CallBackFunc); + InstancePtr->ErrRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + default: + Status = (XST_INVALID_PARAM); + break; + } + + return Status; +} diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_selftest.c b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_selftest.c new file mode 100755 index 00000000..af02a97c --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_selftest.c @@ -0,0 +1,108 @@ +/****************************************************************************** +* +* Copyright (C) 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xrgb2ycrcb_selftest.c +* +* This file contains the self-test function for the RGB2YCRCB core. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------ -------- -------------------------------------------------- +* 7.0 adk 01/28/14 First Release. +* Implemented the following function: +* XRgb2YCrCb_SelfTest. +*+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xrgb2ycrcb.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function reads version register of RGB2YCRCB core and compares with zero +* as part of self test. +* +* @param InstancePtr is a pointer to the XRgb2YCrCb instance. +* +* @return +* - XST_SUCCESS if the version register read test was successful. +* - XST_FAILURE if the version register read test failed. +* +* @note None. +* +******************************************************************************/ +int XRgb2YCrCb_SelfTest(XRgb2YCrCb *InstancePtr) +{ + u32 Version; + int Status; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + /* Read RGB2YCRCB core version register. */ + Version = XRgb2YCrCb_ReadReg(InstancePtr->Config.BaseAddress, + (XRGB_VERSION_OFFSET)); + + /* Compare Version with zero */ + if (Version != (u32)0x0) { + Status = (XST_SUCCESS); + } + else { + Status = (XST_FAILURE); + } + + return Status; +} diff --git a/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_sinit.c b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_sinit.c new file mode 100755 index 00000000..a0d611b9 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/rgb2ycrcb/src/xrgb2ycrcb_sinit.c @@ -0,0 +1,110 @@ +/****************************************************************************** +* +* Copyright (C) 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xrgb2ycrcb_sinit.c +* +* This file contains static initialization function for RGB2YCRCB core. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------ -------- -------------------------------------------------- +* 7.0 adk 01/28/14 First release. +* Implemented following function: +* XRgb2YCrCb_LookupConfig. +*+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xrgb2ycrcb.h" +#include "xparameters.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function returns a reference to an XRgb2YCrCb_Config structure +* based on the unique core id, DeviceId. The return value will refer +* to an entry in the core configuration table defined in the xrgb2ycrcb_g.c +* file. +* +* @param DeviceId is the unique core ID of the core for the lookup +* operation. +* +* @return XRgb2YCrCb_LookupConfig returns a reference to a config record +* in the configuration table (in xrgb2ycrcb_g.c) corresponding to +* DeviceId, or NULL if no match is found. +* +* @note None. +* +******************************************************************************/ +XRgb2YCrCb_Config *XRgb2YCrCb_LookupConfig(u16 DeviceId) +{ + u32 Index; + XRgb2YCrCb_Config *CfgPtr = NULL; + extern XRgb2YCrCb_Config + XRgb2YCrCb_ConfigTable[XPAR_RGB2YCRCB_NUM_INSTANCES]; + + /* Get the reference pointer to XRgb2YCrCb_Config structure */ + for (Index = (u32)0x0; Index < (u32)(XPAR_RGB2YCRCB_NUM_INSTANCES); + Index++) { + + /* Compare device Id with configTable's device Id */ + if (XRgb2YCrCb_ConfigTable[Index].DeviceId == DeviceId) { + CfgPtr = &XRgb2YCrCb_ConfigTable[Index]; + break; + } + } + + return (XRgb2YCrCb_Config *)CfgPtr; +}