diff --git a/XilinxProcessorIPLib/drivers/ccm/data/ccm.mdd b/XilinxProcessorIPLib/drivers/ccm/data/ccm.mdd index 703abe0b..ff755335 100755 --- a/XilinxProcessorIPLib/drivers/ccm/data/ccm.mdd +++ b/XilinxProcessorIPLib/drivers/ccm/data/ccm.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/ccm/data/ccm.tcl b/XilinxProcessorIPLib/drivers/ccm/data/ccm.tcl index f5d6ef26..0c9d63ac 100755 --- a/XilinxProcessorIPLib/drivers/ccm/data/ccm.tcl +++ b/XilinxProcessorIPLib/drivers/ccm/data/ccm.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,11 +27,13 @@ # 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. -# ############################################################################### proc generate {drv_handle} { - xdefine_include_file $drv_handle "xparameters.h" "CCM" "C_BASEADDR" "NUM_INSTANCES" "DEVICE_ID" "C_HIGHADDR" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_S_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_DATA_WIDTH" "C_M_AXIS_VIDEO_FORMAT" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_CLIP" "C_CLAMP" "C_K11" "C_K12" "C_K13" "C_K21" "C_K22" "C_K23" "C_K31" "C_K32" "C_K33" "C_ROFFSET" "C_GOFFSET" "C_BOFFSET" + + xdefine_include_file $drv_handle "xparameters.h" "CCM" "C_BASEADDR" "NUM_INSTANCES" "DEVICE_ID" "C_HIGHADDR" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_S_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_DATA_WIDTH" "C_M_AXIS_VIDEO_FORMAT" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_CLIP" "C_CLAMP" "C_K11" "C_K12" "C_K13" "C_K21" "C_K22" "C_K23" "C_K31" "C_K32" "C_K33" "C_ROFFSET" "C_GOFFSET" "C_BOFFSET" "C_MAX_COLS" "C_HAS_DEBUG" "C_HAS_INTC_IF" "C_S_AXI_CLK_FREQ_HZ" - xdefine_canonical_xpars $drv_handle "xparameters.h" "CCM" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_S_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_DATA_WIDTH" "C_M_AXIS_VIDEO_FORMAT" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_CLIP" "C_CLAMP" "C_K11" "C_K12" "C_K13" "C_K21" "C_K22" "C_K23" "C_K31" "C_K32" "C_K33" "C_ROFFSET" "C_GOFFSET" "C_BOFFSET" + xdefine_config_file $drv_handle "xccm_g.c" "XCcm" "DEVICE_ID" "C_BASEADDR" "C_S_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_FORMAT" "C_MAX_COLS" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_HAS_DEBUG" "C_HAS_INTC_IF" "C_CLIP" "C_CLAMP" "C_K11" "C_K12" "C_K13" "C_K21" "C_K22" "C_K23" "C_K31" "C_K32" "C_K33" "C_ROFFSET" "C_GOFFSET" "C_BOFFSET" "C_S_AXI_CLK_FREQ_HZ" + + xdefine_canonical_xpars $drv_handle "xparameters.h" "CCM" "C_BASEADDR" "NUM_INSTANCES" "DEVICE_ID" "C_HIGHADDR" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_S_AXIS_VIDEO_FORMAT" "C_M_AXIS_VIDEO_DATA_WIDTH" "C_M_AXIS_VIDEO_FORMAT" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_CLIP" "C_CLAMP" "C_K11" "C_K12" "C_K13" "C_K21" "C_K22" "C_K23" "C_K31" "C_K32" "C_K33" "C_ROFFSET" "C_GOFFSET" "C_BOFFSET" "C_MAX_COLS" "C_HAS_DEBUG" "C_HAS_INTC_IF" "C_S_AXI_CLK_FREQ_HZ" } diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/annotated.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/annotated.html new file mode 100644 index 00000000..622d418a --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/annotated.html @@ -0,0 +1,29 @@ + +
+ +XCcm | |
XCcm_Coefs | |
XCcm_Config |
ccm.c |
xccm.c | |
xccm.h | |
xccm_g.c | |
xccm_hw.h | |
xccm_intr.c | |
xccm_selftest.c | |
xccm_sinit.c |
+Here is a list of all class members with links to the classes they belong to: +
+
+ +
+
+Here is a list of all file members with links to the files they belong to: +
+
+ +
+
+
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/globals_func.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/globals_func.html new file mode 100644 index 00000000..3cf203ae --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/globals_func.html @@ -0,0 +1,64 @@ + + + ++
+
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/globals_vars.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/globals_vars.html new file mode 100644 index 00000000..56ee8004 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/globals_vars.html @@ -0,0 +1,39 @@ + + + ++
-This header file contains identifiers and register-level driver functions (or macros) that can be used to access the Xilinx Color Correction Matrix(CCM) device.
-MODIFICATION HISTORY:
-Ver Who Date Changes ----- ---- -------- ------------------------------------------------------- 2.00a jo 05/1/10 Updated for CCM V2.0 3.00a ren 09/11/11 Updated for CCM V3.0 4.00a jj 12/18/12 Converted from xio.h to xil_io.h,translating basic types,MB cache functions, exceptions and assertions to xil_io format 5.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 Color Correction Matrix (CCM) core instance.
+The Color Correction Matrix core offers a 3x3 matrix multiplication for a variety of color correction applications. CCM core provides following features:
+Initialization & Configuration
+The device driver enables higher layer software (e.g., an application) to communicate to the CCM core.
+XCcm_CfgInitialize() API is used to initialize the CCM core. The user needs to first call the XCcm_LookupConfig() API which returns the Configuration structure pointer which is passed as a parameter to the XCcm_CfgInitialize() API.
+ Interrupts
+The driver provides an interrupt handler XCcm_IntrHandler for handling the interrupt from the CCM core. The users of this driver have to register this handler with the interrupt system and provide the callback functions by using XCcm_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 XCcm 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 + ----- ------ -------- --------------------------------------------------- + 2.00a jo 05/1/10 Updated for CCM V2.0. + 3.00a ren 09/11/11 Updated for CCM V3.0. + 4.00a jj 12/18/12 Converted from xio.h to xil_io.h,translating + basic types,MB cache functions, exceptions + and assertions to xil_io format. + 5.0 adk 19/12/13 Updated as per the New Tcl API's. + 6.0 adk 03/06/14 Changed file name ccm.h to xccm.h. + Moved register offsets and bit definitions to + xccm_hw.h file. + Defined the following handler types as enum values: + XCCM_HANDLER_PROCSTART ,XCCM_HANDLER_FRAMEDONE and + XCCM_HANDLER_ERROR.
+
Added the following range macros: + XCCM_VSIZE_FIRST, XCCM_VSIZE_LAST + XCCM_HSIZE_FIRST, XCCM_HSIZE_LAST + XCCM_COEF_FIRST,XCCM_COEF_LAST + XCCM_OFFSET_FIRST,XCCM_OFFSET_LAST + XCCM_CLAMP_FIRST,XCCM_CLAMP_LAST + XCCM_CLIP_FIRST,XCCM_CLIP_LAST.
+
Added the following structure type definitions: + XCcm_Config and XCcm.
+
Removed the following functional macros: + CCM_Enable, CCM_Disable, CCM_RegUpdateEnable + CCM_RegUpdateDisable, CCM_Reset, CCM_AutoSyncReset + CCM_ClearReset.
+
Added the following macros: + XCcm_Enable, XCcm_Disable,XCcm_RegUpdateEnable, + XCcm_SyncReset, XCcm_Reset, XCcm_IntrGetPending, + XCcm_IntrEnable, XCcm_IntrDisable, + XCcm_StatusGetPending, XCcm_IntrClear, XCcm_Start, + XCcm_Stop.
+
Modification history from xccm_hw.h + First release. + Added the register offsets and bit masks for the + registers. + Added backward compatibility macros.
+
Modifications in the file xccm.c are: + Changed filename ccm to xccm.c. + Implemented the following functions: + XCcm_CfgInitialize, XCcm_Setup, XCcm_GetVersion, + XCcm_EnableDbgByPass, XCcm_IsDbgByPassEnabled, + XCcm_DisableDbgByPass, XCcm_EnableDbgTestPattern, + XCcm_IsDbgTestPatternEnabled, + XCcm_DisableDbgTestPattern, XCcm_GetDbgFrameCount, + XCcm_GetDbgLineCount, XCcm_GetDbgPixelCount, + XCcm_SetActiveSize, XCcm_GetActiveSize, + XCcm_SetCoefMatrix, XCcm_GetCoefMatrix, + XCcm_SetRgbOffset, XCcm_GetRgbOffset, + XCcm_SetClip, XCcm_GetClip, + XCcm_SetClamp XCcm_GetClamp XCcm_FloatToFixedConv, + and XCcm_FixedToFloatConv.
+
Modifications in the file xccm_selftest.c are: + Implemented XCcm_SelfTest function.
+
Modifications in the file xccm_sinit.c are: + Implemented XCcm_LookupConfig function.
+
Modifications in the file xccm_intr.c are: + Implemented the following functions: + XCcm_IntrHandler + XCcm_SetCallBack
+
Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/struct_x_ccm-members.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/struct_x_ccm-members.html new file mode 100644 index 00000000..36ff2736 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/struct_x_ccm-members.html @@ -0,0 +1,35 @@ + + + +
Config | XCcm | |
ErrCallBack | XCcm | |
ErrRef | XCcm | |
FrameDoneCallBack | XCcm | |
FrameDoneRef | XCcm | |
HSize | XCcm | |
IsReady | XCcm | |
ProcStartCallBack | XCcm | |
ProcStartRef | XCcm | |
VSize | XCcm |
#include <xccm.h>
++
Public Attributes | |
XCcm_Config | Config |
u32 | IsReady |
u16 | HSize |
u16 | VSize |
XCcm_CallBack | ProcStartCallBack |
void * | ProcStartRef |
XCcm_CallBack | FrameDoneCallBack |
void * | FrameDoneRef |
XCcm_ErrorCallBack | ErrCallBack |
void * | ErrRef |
XCcm_Config XCcm::Config | +
+Hardware configuration +
XCcm_ErrorCallBack XCcm::ErrCallBack | +
+Call back for Error interrupt +
void* XCcm::ErrRef | +
+To be passed to the Error interrupt callback +
XCcm_CallBack XCcm::FrameDoneCallBack | +
+Call back for Frame Done interrupt +
void* XCcm::FrameDoneRef | +
+To be passed to the Frame Done interrupt callback +
u16 XCcm::HSize | +
+Active Video Horizontal Size +
u32 XCcm::IsReady | +
+Device and the driver instance are initialized +
XCcm_CallBack XCcm::ProcStartCallBack | +
+Call back for Processing Start interrupt +
void* XCcm::ProcStartRef | +
+To be passed to the Process Start interrupt callback +
u16 XCcm::VSize | +
+Active Video Vertical Size +
+
K11 | XCcm_Coefs | |
K12 | XCcm_Coefs | |
K13 | XCcm_Coefs | |
K21 | XCcm_Coefs | |
K22 | XCcm_Coefs | |
K23 | XCcm_Coefs | |
K31 | XCcm_Coefs | |
K32 | XCcm_Coefs | |
K33 | XCcm_Coefs |
#include <xccm.h>
++
Public Attributes | |
float | K11 |
float | K12 |
float | K13 |
float | K21 |
float | K22 |
float | K23 |
float | K31 |
float | K32 |
float | K33 |
float XCcm_Coefs::K11 | +
+Matrix Coefficient +
float XCcm_Coefs::K12 | +
+Matrix Coefficient +
float XCcm_Coefs::K13 | +
+Matrix Coefficient +
float XCcm_Coefs::K21 | +
+Matrix Coefficient +
float XCcm_Coefs::K22 | +
+Matrix Coefficient +
float XCcm_Coefs::K23 | +
+Matrix Coefficient +
float XCcm_Coefs::K31 | +
+Matrix Coefficient +
float XCcm_Coefs::K32 | +
+Matrix Coefficient +
float XCcm_Coefs::K33 | +
+Matrix Coefficient +
+
#include <xccm.h>
++
Public Attributes | |
u16 | DeviceId |
u32 | BaseAddress |
u32 | SlaveAxisVideoFormat |
u32 | MasterAxisVideoFormat |
u32 | MaxColumns |
u32 | ActiveColumns |
u32 | ActiveRows |
u16 | HasDebug |
u16 | HasIntcIf |
u16 | Clip |
u16 | Clamp |
u32 | K11 |
u32 | K12 |
u32 | K13 |
u32 | K21 |
u32 | K22 |
u32 | K23 |
u32 | K31 |
u32 | K32 |
u32 | K33 |
u32 | ROffset |
u32 | GOffset |
u32 | BOffset |
u32 | SlaveAxiClkFreqHz |
u32 XCcm_Config::ActiveColumns | +
+Active Columns +
u32 XCcm_Config::ActiveRows | +
+Active rows +
u32 XCcm_Config::BaseAddress | +
+BaseAddress is the physical base address of the device's registers +
u32 XCcm_Config::BOffset | +
+Blue color offset value +
u16 XCcm_Config::Clamp | +
+Clamp value +
u16 XCcm_Config::Clip | +
+Clip value +
u16 XCcm_Config::DeviceId | +
+DeviceId is the unique ID of the device +
u32 XCcm_Config::GOffset | +
+Green color offset value +
u16 XCcm_Config::HasDebug | +
+Has Debug GUI specified +
u16 XCcm_Config::HasIntcIf | +
+Has Interrupt Control +
u32 XCcm_Config::K11 | +
+Element of Coefficient matrix +
u32 XCcm_Config::K12 | +
+Element of Coefficient matrix +
u32 XCcm_Config::K13 | +
+Element of Coefficient matrix +
u32 XCcm_Config::K21 | +
+Element of Coefficient matrix +
u32 XCcm_Config::K22 | +
+Element of Coefficient matrix +
u32 XCcm_Config::K23 | +
+Element of Coefficient matrix +
u32 XCcm_Config::K31 | +
+Element of Coefficient matrix +
u32 XCcm_Config::K32 | +
+Element of Coefficient matrix +
u32 XCcm_Config::K33 | +
+Element of Coefficient matrix +
u32 XCcm_Config::MasterAxisVideoFormat | +
+Master Axis Video Format +
u32 XCcm_Config::MaxColumns | +
+Maximum Columns +
u32 XCcm_Config::ROffset | +
+Red color offset value +
u32 XCcm_Config::SlaveAxiClkFreqHz | +
+Slave Clock Frequency in Hz +
u32 XCcm_Config::SlaveAxisVideoFormat | +
+Slave Axis Video Format +
+
+
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------- -------- ------------------------------------------------------ + 2.00a jo 05/1/10 Updated for CCM V2.0 + 3.00a ren 09/11/11 Updated for CCM v3.0 + 4.00a jj 12/18/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 03/06/14 Changed filename ccm.c to xccm.c. + Implemented the following functions: + XCcm_CfgInitialize, XCcm_Setup, XCcm_GetVersion, + XCcm_EnableDbgByPass, XCcm_IsDbgByPassEnabled, + XCcm_DisableDbgByPass, XCcm_EnableDbgTestPattern, + XCcm_IsDbgTestPatternEnabled, + XCcm_DisableDbgTestPattern, XCcm_GetDbgFrameCount, + XCcm_GetDbgLineCount, XCcm_GetDbgPixelCount, + XCcm_SetActiveSize, XCcm_GetActiveSize, + XCcm_SetCoefMatrix, XCcm_GetCoefMatrix, + XCcm_SetRgbOffset, XCcm_GetRgbOffset, + XCcm_SetClip, XCcm_GetClip, + XCcm_SetClamp and XCcm_GetClamp XCcm_FloatToFixedConv, + and XCcm_FixedToFloatConv.
+
+
+#include "xccm.h"
+
Functions | |
int | XCcm_CfgInitialize (XCcm *InstancePtr, XCcm_Config *CfgPtr, u32 EffectiveAddr) |
void | XCcm_Setup (XCcm *InstancePtr) |
void | XCcm_EnableDbgByPass (XCcm *InstancePtr) |
int | XCcm_IsDbgByPassEnabled (XCcm *InstancePtr) |
void | XCcm_DisableDbgByPass (XCcm *InstancePtr) |
void | XCcm_EnableDbgTestPattern (XCcm *InstancePtr) |
int | XCcm_IsDbgTestPatternEnabled (XCcm *InstancePtr) |
void | XCcm_DisableDbgTestPattern (XCcm *InstancePtr) |
u32 | XCcm_GetVersion (XCcm *InstancePtr) |
u32 | XCcm_GetDbgFrameCount (XCcm *InstancePtr) |
u32 | XCcm_GetDbgLineCount (XCcm *InstancePtr) |
u32 | XCcm_GetDbgPixelCount (XCcm *InstancePtr) |
void | XCcm_SetActiveSize (XCcm *InstancePtr, u16 HSize, u16 VSize) |
void | XCcm_GetActiveSize (XCcm *InstancePtr, u16 *HSize, u16 *VSize) |
void | XCcm_SetCoefMatrix (XCcm *InstancePtr, XCcm_Coefs *CoefValues) |
void | XCcm_GetCoefMatrix (XCcm *InstancePtr, XCcm_Coefs *CoefValues) |
void | XCcm_SetRgbOffset (XCcm *InstancePtr, s32 ROffset, s32 GOffset, s32 BOffset) |
void | XCcm_GetRgbOffset (XCcm *InstancePtr, s32 *ROffset, s32 *GOffset, s32 *BOffset) |
void | XCcm_SetClip (XCcm *InstancePtr, u32 Clip) |
u32 | XCcm_GetClip (XCcm *InstancePtr) |
void | XCcm_SetClamp (XCcm *InstancePtr, u32 Clamp) |
u32 | XCcm_GetClamp (XCcm *InstancePtr) |
int XCcm_CfgInitialize | +( | +XCcm * | +InstancePtr, | +|
+ | + | XCcm_Config * | +CfgPtr, | +|
+ | + | u32 | +EffectiveAddr | + |
+ | ) | ++ |
+This function initializes an CCM core. This function must be called prior to using an CCM core. Initialization of an CCM includes setting up the instance data and ensuring the hardware is in a quiescent state.
+
InstancePtr | is a pointer to the XCcm instance. | |
CfgPtr | is a reference to a structure containing information about a specific XCcm instance. | |
EffectiveAddr | is the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device 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. |
void XCcm_DisableDbgByPass | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function disables the Bypass mode of the CCM core.
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
void XCcm_DisableDbgTestPattern | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function disables debug test pattern mode in Control register of the CCM core, if Debug feature is enabled.
+
InstancePtr | is a pointer to the XCcm core instance to be worked on. |
void XCcm_EnableDbgByPass | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function enables the bypass mode by setting bypass bit of the Control register to switch the core to bypass mode if debug feature is enabled in the core.
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
void XCcm_EnableDbgTestPattern | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function enables the test-pattern mode if debug feature is enabled by setting test-pattern bit of the Control register of the CCM core.
+
InstancePtr | is a pointer to the XCcm instance. |
void XCcm_GetActiveSize | +( | +XCcm * | +InstancePtr, | +|
+ | + | u16 * | +HSize, | +|
+ | + | u16 * | +VSize | + |
+ | ) | ++ |
+This function gets the number of Active Pixels per Scan line and number of Active Lines per Frame from the Active Frame Size register.
+
InstancePtr | is a pointer to the XCcm instance. | |
HSize | is a pointer to 16-bit variable in which the number of Active Pixels per Scan Line is returned (Range is 32 to 7680). | |
VSize | is a pointer to 16-bit variable in which the number of Active Lines per Frame is returned (Range is 32 to 7680). |
u32 XCcm_GetClamp | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function returns the clamp value from the Clamp register.
+
InstancePtr | is a pointer to the CCM instance. |
u32 XCcm_GetClip | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets the clip value from Clip register of the CCM core.
+
InstancePtr | is a pointer to the CCM instance. |
void XCcm_GetCoefMatrix | +( | +XCcm * | +InstancePtr, | +|
+ | + | XCcm_Coefs * | +CoefValues | + |
+ | ) | ++ |
+This function gets the coefficient values of color correction matrix from K11 to K33 registers of the CCM core.
+
InstancePtr | is a pointer to the CCM instance | |
CoefValues | is a pointer to XCcm_Coefs structure which has matrix coefficients is updated with coefficient values. (Range is floating point numbers [-8, 8)). |
u32 XCcm_GetDbgFrameCount | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets number of frames processed since power-up or last time the core is reset.
+
InstancePtr | is a pointer to the XCcm instance. |
u32 XCcm_GetDbgLineCount | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets the number of lines processed since power-up or last time the core is reset.
+
InstancePtr | is a pointer to the XCcm instance. |
u32 XCcm_GetDbgPixelCount | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets the number of pixels processed since power-up or last time the core is reset.
+
InstancePtr | is a pointer to the XCcm instance. |
void XCcm_GetRgbOffset | +( | +XCcm * | +InstancePtr, | +|
+ | + | s32 * | +ROffset, | +|
+ | + | s32 * | +GOffset, | +|
+ | + | s32 * | +BOffset | + |
+ | ) | ++ |
+This function gets the offset compensation values of red, blue, green colors from Roffset, Goffset and Boffset registers.
+
InstancePtr | is a pointer to the CCM instance. | |
ROffset | is a pointer of signed 32 bit variable in which offset of red color value is returned. (Range of offset is [-256 255]). | |
GOffset | is a pointer of signed 32 bit variable in which offset of green color value is returned. (Range of offset is [-256 255]). | |
BOffset | is a pointer of signed 32 bit variable in which offset of blue color value is returned. (Range of offset is [-256 255]). |
u32 XCcm_GetVersion | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets the Version of the CCM core.
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
int XCcm_IsDbgByPassEnabled | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function returns the current bypass mode settings from Control register of the CCM core.
+
InstancePtr | is a pointer to the XCcm instance. |
int XCcm_IsDbgTestPatternEnabled | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function returns the test-pattern mode (enabled or not) from Control register of the CCM core, if debug feature was enabled.
+
InstancePtr | is a pointer to the XCcm instance. |
void XCcm_SetActiveSize | +( | +XCcm * | +InstancePtr, | +|
+ | + | u16 | +HSize, | +|
+ | + | u16 | +VSize | + |
+ | ) | ++ |
+This function sets the active H/V sizes in the Active Size register.
+
InstancePtr | is a pointer to the XCcm instance. | |
HSize | specifies the number of Active Pixels per Scan Line that needs to be set (Range is 32 to 7680). | |
VSize | specifies the number of Active Lines per Frame that needs to be set (Range is 32 to 7680). |
void XCcm_SetClamp | +( | +XCcm * | +InstancePtr, | +|
+ | + | u32 | +Clamp | + |
+ | ) | ++ |
+This function sets the clamp value in the Clamp register.
+
InstancePtr | is a pointer to the CCM instance | |
Clamp | is the minimum output value which needs to be set. (Range of Clamping value is 0 to 255). |
void XCcm_SetClip | +( | +XCcm * | +InstancePtr, | +|
+ | + | u32 | +Clip | + |
+ | ) | ++ |
+This function sets the clip value in the Clip register of the CCM core.
+
InstancePtr | is a pointer to the CCM instance. | |
Clip | is the maximum output value which needs to be set. (Range of Clip value is 0 to 255). |
void XCcm_SetCoefMatrix | +( | +XCcm * | +InstancePtr, | +|
+ | + | XCcm_Coefs * | +CoefValues | + |
+ | ) | ++ |
+This function sets the coefficients of color correction matrix in K11 to K33 registers of the CCM core.
+
InstancePtr | is a pointer to the CCM instance. | |
CoefValues | is a pointer to XCcm_Coefs structure which has matrix coefficients that needs to be set. (Range is floating point numbers [-8, 8)). |
void XCcm_SetRgbOffset | +( | +XCcm * | +InstancePtr, | +|
+ | + | s32 | +ROffset, | +|
+ | + | s32 | +GOffset, | +|
+ | + | s32 | +BOffset | + |
+ | ) | ++ |
+This function sets the offset compensation for red, blue and green colors in corresponding Roffset, Goffset and Boffset registers of the CCM core.
+
InstancePtr | is a pointer to the CCM instance. | |
ROffset | specifies offset value of red color component which needs to be set. (Range of offset is [-256 255]). | |
GOffset | specifies offset value of green color component which needs to be set. (Range of offset is [-256 255]). | |
BOffset | specifies offset value of blue color component which needs to be set. (Range of offset is [-256 255]). |
void XCcm_Setup | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function sets the input/output frame size in Active Size register and enables the register update.
+
InstancePtr | is a pointer to the Xccm instance. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm_8h.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm_8h.html new file mode 100644 index 00000000..28795a29 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm_8h.html @@ -0,0 +1,1711 @@ + +
+ +
+#include "xccm_hw.h"
+#include "xil_assert.h"
+#include "xstatus.h"
+
Classes | |
struct | XCcm_Config |
struct | XCcm |
struct | XCcm_Coefs |
Active Size Ranges | |
#define | XCCM_ACT_SIZE_FIRST 32 |
#define | XCCM_ACT_SIZE_LAST 7680 |
Coefficient ranges | |
#define | XCCM_COEF_FIRST -8.0 |
#define | XCCM_COEF_LAST 8.0 |
Offset ranges | |
#define | XCCM_OFFSET_FIRST 0xFFFFFF00 |
#define | XCCM_OFFSET_LAST 255 |
Clamp ranges | |
#define | XCCM_CLAMP_FIRST 0 |
#define | XCCM_CLAMP_LAST 255 |
Clip ranges | |
#define | XCCM_CLIP_FIRST 0 |
#define | XCCM_CLIP_LAST 255 |
Handler Types | |
enum | { XCCM_HANDLER_PROCSTART = 1, +XCCM_HANDLER_FRAMEDONE, +XCCM_HANDLER_ERROR + } |
Defines | |
#define | XCCM_H_ |
#define | XCcm_Enable(InstancePtr) |
#define | XCcm_Disable(InstancePtr) |
#define | XCcm_Start XCcm_Enable |
#define | XCcm_Stop XCcm_Disable |
#define | XCcm_RegUpdateEnable(InstancePtr) |
#define | XCcm_RegUpdateDisable(InstancePtr) |
#define | XCcm_SyncReset(InstancePtr) |
#define | XCcm_Reset(InstancePtr) |
#define | XCcm_IntrEnable(InstancePtr, IntrType) |
#define | XCcm_IntrDisable(InstancePtr, IntrType) |
#define | XCcm_StatusGetPending(InstancePtr) |
#define | XCcm_IntrGetPending(InstancePtr) |
#define | XCcm_IntrClear(InstancePtr, IntrType) |
Typedefs | |
typedef void(*) | XCcm_CallBack (void *CallBackRef) |
typedef void(*) | XCcm_ErrorCallBack (void *CallBackRef, u32 ErrorMask) |
Functions | |
XCcm_Config * | XCcm_LookupConfig (u16 DeviceId) |
int | XCcm_CfgInitialize (XCcm *InstancePtr, XCcm_Config *CfgPtr, u32 EffectiveAddr) |
u32 | XCcm_GetVersion (XCcm *InstancePtr) |
void | XCcm_Setup (XCcm *InstancePtr) |
void | XCcm_EnableDbgByPass (XCcm *InstancePtr) |
int | XCcm_IsDbgByPassEnabled (XCcm *InstancePtr) |
void | XCcm_DisableDbgByPass (XCcm *InstancePtr) |
void | XCcm_EnableDbgTestPattern (XCcm *InstancePtr) |
int | XCcm_IsDbgTestPatternEnabled (XCcm *InstancePtr) |
void | XCcm_DisableDbgTestPattern (XCcm *InstancePtr) |
u32 | XCcm_GetDbgFrameCount (XCcm *InstancePtr) |
u32 | XCcm_GetDbgLineCount (XCcm *InstancePtr) |
u32 | XCcm_GetDbgPixelCount (XCcm *InstancePtr) |
void | XCcm_SetActiveSize (XCcm *InstancePtr, u16 HSize, u16 VSize) |
void | XCcm_GetActiveSize (XCcm *InstancePtr, u16 *HSize, u16 *VSize) |
void | XCcm_SetCoefMatrix (XCcm *InstancePtr, XCcm_Coefs *CoefValues) |
void | XCcm_GetCoefMatrix (XCcm *InstancePtr, XCcm_Coefs *CoefValues) |
void | XCcm_SetRgbOffset (XCcm *InstancePtr, s32 ROffset, s32 GOffset, s32 BOffset) |
void | XCcm_GetRgbOffset (XCcm *InstancePtr, s32 *ROffset, s32 *GOffset, s32 *BOffset) |
void | XCcm_SetClip (XCcm *InstancePtr, u32 Clip) |
u32 | XCcm_GetClip (XCcm *InstancePtr) |
void | XCcm_SetClamp (XCcm *InstancePtr, u32 Clamp) |
u32 | XCcm_GetClamp (XCcm *InstancePtr) |
int | XCcm_SelfTest (XCcm *InstancePtr) |
void | XCcm_IntrHandler (void *InstancePtr) |
int | XCcm_SetCallBack (XCcm *InstancePtr, u32 HandlerType, void *CallBackFunc, void *CallBackRef) |
#define XCCM_ACT_SIZE_FIRST 32 | +
+Active Size starting value +
#define XCCM_ACT_SIZE_LAST 7680 | +
+Active Size ending value +
#define XCCM_CLAMP_FIRST 0 | +
+Clamp starting value +
#define XCCM_CLAMP_LAST 255 | +
+Clamp ending value +
#define XCCM_CLIP_FIRST 0 | +
+Clip starting value +
#define XCCM_CLIP_LAST 255 | +
+Clip ending value +
#define XCCM_COEF_FIRST -8.0 | +
+Coefficient starting value +
#define XCCM_COEF_LAST 8.0 | +
+Coefficient ending value +
#define XCcm_Disable | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET))) & (~(XCCM_CTL_SW_EN_MASK)))) +
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
#define XCcm_Enable | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET))) | (XCCM_CTL_SW_EN_MASK))) +
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
#define XCCM_H_ | +
+Prevent circular inclusions by using protection macros +
#define XCcm_IntrClear | +( | +InstancePtr, | |||
+ | + | IntrType | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_STATUS_OFFSET), ((IntrType) & (XCCM_IXR_ALLINTR_MASK))) +
+
InstancePtr | is a pointer to the XCcm instance to be worked on. | |
IntrType | is the pending interrupts to clear/acknowledge. Use OR'ing of XCCM_IXR_*_MASK constants defined in xccm_hw.h to create this parameter value. |
#define XCcm_IntrDisable | +( | +InstancePtr, | |||
+ | + | IntrType | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET))) & ((~(IntrType)) & \ + (XCCM_IXR_ALLINTR_MASK)))) +
+
InstancePtr | is a pointer to the XCcm instance to be worked on. | |
IntrType | is the type of the interrupts to disable. Use OR'ing of XCCM_IXR_*_MASK constants defined in xccm_hw.h to create this parameter value. |
#define XCcm_IntrEnable | +( | +InstancePtr, | |||
+ | + | IntrType | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET), \ + (((IntrType) & (XCCM_IXR_ALLINTR_MASK)) | \ + (XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET))))) +
+
InstancePtr | is a pointer to the XCcm instance to be worked on. | |
IntrType | is the type of the interrupts to enable. Use OR'ing of XCCM_IXR_*_MASK constants defined in xccm_hw.h to create this parameter value. |
#define XCcm_IntrGetPending | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET)) & \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_STATUS_OFFSET))) & (XCCM_IXR_ALLINTR_MASK)) +
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
#define XCCM_OFFSET_FIRST 0xFFFFFF00 | +
+Offset starting value +
#define XCCM_OFFSET_LAST 255 | +
+Offset ending value +
#define XCcm_RegUpdateDisable | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET))) & (~(XCCM_CTL_RUE_MASK)))) +
+This macro only works when the CCM core is enabled.
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
#define XCcm_RegUpdateEnable | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET))) | (XCCM_CTL_RUE_MASK))) +
+This macro only works when the CCM core is enabled.
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
#define XCcm_Reset | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + (XCCM_CTL_RESET_MASK)) +
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
#define XCcm_Start XCcm_Enable | +
+This macro enables/starts the CCM core.
+
InstancePtr | is a pointer to the XCcm instance to be worked on |
#define XCcm_StatusGetPending | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_STATUS_OFFSET)) & (XCCM_IXR_ALLINTR_MASK) +
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
#define XCcm_Stop XCcm_Disable | +
+This macro disables/stops the CCM core.
+
InstancePtr | is a pointer to the XCcm instance to be worked on |
#define XCcm_SyncReset | +( | +InstancePtr | ++ | ) | ++ |
+Value:
XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + (XCCM_CTL_AUTORESET_MASK)) +
+On the next rising-edge of SOF following a call to XCcm_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 XCcm instance to be worked on. |
+
typedef void(*) XCcm_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(*) XCcm_ErrorCallBack(void *CallBackRef, u32 ErrorMask) | +
+Callback type for 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. | |
ErrorMask | is a bit mask indicating the cause of the error. Its value equals 'OR'ing one or more XCCM_IXR_*_MASK values defined in xccm_hw.h. |
+
anonymous enum | +
+These constants specify different types of handler and used to differentiate interrupt requests from core.
+ ++
int XCcm_CfgInitialize | +( | +XCcm * | +InstancePtr, | +|
+ | + | XCcm_Config * | +CfgPtr, | +|
+ | + | u32 | +EffectiveAddr | + |
+ | ) | ++ |
+This function initializes an CCM core. This function must be called prior to using an CCM core. Initialization of an CCM includes setting up the instance data and ensuring the hardware is in a quiescent state.
+
InstancePtr | is a pointer to the XCcm instance. | |
CfgPtr | is a reference to a structure containing information about a specific XCcm instance. | |
EffectiveAddr | is the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device 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. |
void XCcm_DisableDbgByPass | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function disables the Bypass mode of the CCM core.
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
void XCcm_DisableDbgTestPattern | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function disables debug test pattern mode in Control register of the CCM core, if Debug feature is enabled.
+
InstancePtr | is a pointer to the XCcm core instance to be worked on. |
void XCcm_EnableDbgByPass | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function enables the bypass mode by setting bypass bit of the Control register to switch the core to bypass mode if debug feature is enabled in the core.
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
void XCcm_EnableDbgTestPattern | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function enables the test-pattern mode if debug feature is enabled by setting test-pattern bit of the Control register of the CCM core.
+
InstancePtr | is a pointer to the XCcm instance. |
void XCcm_GetActiveSize | +( | +XCcm * | +InstancePtr, | +|
+ | + | u16 * | +HSize, | +|
+ | + | u16 * | +VSize | + |
+ | ) | ++ |
+This function gets the number of Active Pixels per Scan line and number of Active Lines per Frame from the Active Frame Size register.
+
InstancePtr | is a pointer to the XCcm instance. | |
HSize | is a pointer to 16-bit variable in which the number of Active Pixels per Scan Line is returned (Range is 32 to 7680). | |
VSize | is a pointer to 16-bit variable in which the number of Active Lines per Frame is returned (Range is 32 to 7680). |
u32 XCcm_GetClamp | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function returns the clamp value from the Clamp register.
+
InstancePtr | is a pointer to the CCM instance. |
u32 XCcm_GetClip | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets the clip value from Clip register of the CCM core.
+
InstancePtr | is a pointer to the CCM instance. |
void XCcm_GetCoefMatrix | +( | +XCcm * | +InstancePtr, | +|
+ | + | XCcm_Coefs * | +CoefValues | + |
+ | ) | ++ |
+This function gets the coefficient values of color correction matrix from K11 to K33 registers of the CCM core.
+
InstancePtr | is a pointer to the CCM instance | |
CoefValues | is a pointer to XCcm_Coefs structure which has matrix coefficients is updated with coefficient values. (Range is floating point numbers [-8, 8)). |
u32 XCcm_GetDbgFrameCount | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets number of frames processed since power-up or last time the core is reset.
+
InstancePtr | is a pointer to the XCcm instance. |
u32 XCcm_GetDbgLineCount | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets the number of lines processed since power-up or last time the core is reset.
+
InstancePtr | is a pointer to the XCcm instance. |
u32 XCcm_GetDbgPixelCount | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets the number of pixels processed since power-up or last time the core is reset.
+
InstancePtr | is a pointer to the XCcm instance. |
void XCcm_GetRgbOffset | +( | +XCcm * | +InstancePtr, | +|
+ | + | s32 * | +ROffset, | +|
+ | + | s32 * | +GOffset, | +|
+ | + | s32 * | +BOffset | + |
+ | ) | ++ |
+This function gets the offset compensation values of red, blue, green colors from Roffset, Goffset and Boffset registers.
+
InstancePtr | is a pointer to the CCM instance. | |
ROffset | is a pointer of signed 32 bit variable in which offset of red color value is returned. (Range of offset is [-256 255]). | |
GOffset | is a pointer of signed 32 bit variable in which offset of green color value is returned. (Range of offset is [-256 255]). | |
BOffset | is a pointer of signed 32 bit variable in which offset of blue color value is returned. (Range of offset is [-256 255]). |
u32 XCcm_GetVersion | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function gets the Version of the CCM core.
+
InstancePtr | is a pointer to the XCcm instance to be worked on. |
void XCcm_IntrHandler | +( | +void * | +InstancePtr | +) | ++ |
+This function is the interrupt handler for the CCM core.
+This handler reads the pending interrupt from Status register, determines the source of the interrupts and calls the respective callbacks for the interrupts that are enabled in IRQ_ENABLE register, 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 XCcm_SetCallBack() during initialization phase. .
+
InstancePtr | is a pointer to the XCcm instance that just interrupted. |
int XCcm_IsDbgByPassEnabled | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function returns the current bypass mode settings from Control register of the CCM core.
+
InstancePtr | is a pointer to the XCcm instance. |
int XCcm_IsDbgTestPatternEnabled | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function returns the test-pattern mode (enabled or not) from Control register of the CCM core, if debug feature was enabled.
+
InstancePtr | is a pointer to the XCcm instance. |
XCcm_Config* XCcm_LookupConfig | +( | +u16 | +DeviceId | +) | ++ |
+XCcm_LookupConfig returns a reference to an XCcm_Config structure based on the unique device id, DeviceId. The return value will refer to an entry in the device configuration table defined in the xccm_g.c file.
+
DeviceId | is the unique device ID of the device for the lookup operation. |
int XCcm_SelfTest | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function reads Version register of CCM core and compares with zero as part of self test.
+
InstancePtr | is a pointer to XCcm instance. |
void XCcm_SetActiveSize | +( | +XCcm * | +InstancePtr, | +|
+ | + | u16 | +HSize, | +|
+ | + | u16 | +VSize | + |
+ | ) | ++ |
+This function sets the active H/V sizes in the Active Size register.
+
InstancePtr | is a pointer to the XCcm instance. | |
HSize | specifies the number of Active Pixels per Scan Line that needs to be set (Range is 32 to 7680). | |
VSize | specifies the number of Active Lines per Frame that needs to be set (Range is 32 to 7680). |
int XCcm_SetCallBack | +( | +XCcm * | +InstancePtr, | +|
+ | + | u32 | +HandlerType, | +|
+ | + | void * | +CallBackFunc, | +|
+ | + | void * | +CallBackRef | + |
+ | ) | ++ |
+This routine installs an asynchronous callback function for the given HandlerType.
+
+ HandlerType Callback Function Type + ----------------------- -------------------------------------------------- + XCCM_HANDLER_FRAMEDONE FrameDoneCallBack + XCCM_HANDLER_PROCSTART ProcStartCallBack + XCCM_HANDLER_ERROR ErrCallBack
+
+
InstancePtr | is a pointer to the Xccm 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 XCcm_SetClamp | +( | +XCcm * | +InstancePtr, | +|
+ | + | u32 | +Clamp | + |
+ | ) | ++ |
+This function sets the clamp value in the Clamp register.
+
InstancePtr | is a pointer to the CCM instance | |
Clamp | is the minimum output value which needs to be set. (Range of Clamping value is 0 to 255). |
void XCcm_SetClip | +( | +XCcm * | +InstancePtr, | +|
+ | + | u32 | +Clip | + |
+ | ) | ++ |
+This function sets the clip value in the Clip register of the CCM core.
+
InstancePtr | is a pointer to the CCM instance. | |
Clip | is the maximum output value which needs to be set. (Range of Clip value is 0 to 255). |
void XCcm_SetCoefMatrix | +( | +XCcm * | +InstancePtr, | +|
+ | + | XCcm_Coefs * | +CoefValues | + |
+ | ) | ++ |
+This function sets the coefficients of color correction matrix in K11 to K33 registers of the CCM core.
+
InstancePtr | is a pointer to the CCM instance. | |
CoefValues | is a pointer to XCcm_Coefs structure which has matrix coefficients that needs to be set. (Range is floating point numbers [-8, 8)). |
void XCcm_SetRgbOffset | +( | +XCcm * | +InstancePtr, | +|
+ | + | s32 | +ROffset, | +|
+ | + | s32 | +GOffset, | +|
+ | + | s32 | +BOffset | + |
+ | ) | ++ |
+This function sets the offset compensation for red, blue and green colors in corresponding Roffset, Goffset and Boffset registers of the CCM core.
+
InstancePtr | is a pointer to the CCM instance. | |
ROffset | specifies offset value of red color component which needs to be set. (Range of offset is [-256 255]). | |
GOffset | specifies offset value of green color component which needs to be set. (Range of offset is [-256 255]). | |
BOffset | specifies offset value of blue color component which needs to be set. (Range of offset is [-256 255]). |
void XCcm_Setup | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function sets the input/output frame size in Active Size register and enables the register update.
+
InstancePtr | is a pointer to the Xccm instance. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__g_8c.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__g_8c.html new file mode 100644 index 00000000..0cc315b8 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__g_8c.html @@ -0,0 +1,79 @@ + +
+ +
+#include "xparameters.h"
+#include "xccm.h"
+
Variables | |
XCcm_Config | XCcm_ConfigTable [] |
XCcm_Config XCcm_ConfigTable[] | +
+Initial value:
+{ + { + XPAR_FMC_SENSOR_INPUT_V_CCM_1_DEVICE_ID, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_BASEADDR, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_S_AXIS_VIDEO_FORMAT, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_M_AXIS_VIDEO_FORMAT, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_MAX_COLS, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_ACTIVE_COLS, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_ACTIVE_ROWS, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_HAS_DEBUG, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_HAS_INTC_IF, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_CLIP, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_CLAMP, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K11, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K12, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K13, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K21, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K22, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K23, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K31, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K32, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K33, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_ROFFSET, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_GOFFSET, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_BOFFSET, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_S_AXI_CLK_FREQ_HZ + } +} +
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__hw_8h.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__hw_8h.html new file mode 100644 index 00000000..3fabe2b3 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__hw_8h.html @@ -0,0 +1,1776 @@ + +
+ ++
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------- -------- ------------------------------------------------------- + 6.0 adk 03/06/14 First release. + Added the register offsets and bit masks for the + registers. + Added backward compatibility macros. ++
+#include "xil_io.h"
+
Registers offsets | |
#define | XCCM_CONTROL_OFFSET 0x000 |
#define | XCCM_STATUS_OFFSET 0x004 |
#define | XCCM_ERROR_OFFSET 0x008 |
#define | XCCM_IRQ_EN_OFFSET 0x00C |
#define | XCCM_VERSION_OFFSET 0x010 |
#define | XCCM_SYSDEBUG0_OFFSET 0x014 |
#define | XCCM_SYSDEBUG1_OFFSET 0x018 |
#define | XCCM_SYSDEBUG2_OFFSET 0x01C |
#define | XCCM_ACTIVE_SIZE_OFFSET 0x020 |
#define | XCCM_K11_OFFSET 0x100 |
#define | XCCM_K12_OFFSET 0x104 |
#define | XCCM_K13_OFFSET 0x108 |
#define | XCCM_K21_OFFSET 0x10C |
#define | XCCM_K22_OFFSET 0x110 |
#define | XCCM_K23_OFFSET 0x114 |
#define | XCCM_K31_OFFSET 0x118 |
#define | XCCM_K32_OFFSET 0x11C |
#define | XCCM_K33_OFFSET 0x120 |
#define | XCCM_ROFFSET_OFFSET 0x124 |
#define | XCCM_GOFFSET_OFFSET 0x128 |
#define | XCCM_BOFFSET_OFFSET 0x12C |
#define | XCCM_CLIP_OFFSET 0x130 |
#define | XCCM_CLAMP_OFFSET 0x134 |
Control register bit masks | |
#define | XCCM_CTL_SW_EN_MASK 0x00000001 |
#define | XCCM_CTL_RUE_MASK 0x00000002 |
#define | XCCM_CTL_BPE_MASK 0x00000010 |
#define | XCCM_CTL_TPE_MASK 0x00000020 |
#define | XCCM_CTL_AUTORESET_MASK 0x40000000 |
#define | XCCM_CTL_RESET_MASK 0x80000000 |
Interrupt register bit masks. It is applicable for | |
Status and IRQ_ENABLE Registers | |
#define | XCCM_IXR_PROCS_STARTED_MASK 0x00000001 |
#define | XCCM_IXR_EOF_MASK 0x00000002 |
#define | XCCM_IXR_SE_MASK 0x00010000 |
#define | XCCM_IXR_ALLINTR_MASK 0x00010003 |
Error register bit masks | |
#define | XCCM_ERR_EOL_EARLY_MASK 0x00000001 |
#define | XCCM_ERR_EOL_LATE_MASK 0x00000002 |
#define | XCCM_ERR_SOF_EARLY_MASK 0x00000004 |
#define | XCCM_ERR_SOF_LATE_MASK 0x00000008 |
Version register bit masks and shifts | |
#define | XCCM_VER_REV_NUM_MASK 0x000000FF |
#define | XCCM_VER_PID_MASK 0x00000F00 |
#define | XCCM_VER_REV_MASK 0x0000F000 |
#define | XCCM_VER_MINOR_MASK 0x00FF0000 |
#define | XCCM_VER_MAJOR_MASK 0xFF000000 |
#define | XCCM_VER_INTERNAL_SHIFT 0x00000008 |
#define | XCCM_VER_REV_SHIFT 0x0000000C |
#define | XCCM_VER_MINOR_SHIFT 0x00000010 |
#define | XCCM_VER_MAJOR_SHIFT 0x00000018 |
Active Size register masks and shift | |
#define | XCCM_ACTSIZE_NUM_PIXEL_MASK 0x00001FFF |
#define | XCCM_ACTSIZE_NUM_LINE_MASK 0x1FFF0000 |
#define | XCCM_ACTSIZE_NUM_LINE_SHIFT 16 |
Matrix coefficient masks and shifts | |
#define | XCCM_COEF_MASK 0x0003FFFF |
#define | XCCM_COEF_DECI_MASK 0x0001C000 |
#define | XCCM_COEFF_FRAC_MASK 0x00003FFF |
#define | XCCM_COEF_SHIFT 14 |
#define | XCCM_COEF_SIGN_MASK 0x20000 |
Offsets masks and shifts | |
#define | XCCM_OFFSET_MASK 0x0001FFFF |
#define | XCCM_OFFSET_SIGN_SHIFT 15 |
Clip and Clamp masks | |
#define | XCCM_CLIP_MASK 0x0000FFFF |
#define | XCCM_CLAMP_MASK 0x0000FFFF |
General purpose macros | |
#define | XCCM_SIGN_MUL -1 |
#define | XCCM_MAX_VALUE 0xFFFFFFFF |
#define | XCCM_SIGNBIT_MASK 0x10000000 |
Macros for backward compatibility | |
#define | CCM_CONTROL XCCM_CONTROL_OFFSET |
#define | CCM_STATUS XCCM_STATUS_OFFSET |
#define | CCM_ERROR XCCM_ERROR_OFFSET |
#define | CCM_IRQ_EN XCCM_IRQ_EN_OFFSET |
#define | CCM_VERSION XCCM_VERSION_OFFSET |
#define | CCM_SYSDEBUG0 XCCM_SYSDEBUG0_OFFSET |
#define | CCM_SYSDEBUG1 XCCM_SYSDEBUG1_OFFSET |
#define | CCM_SYSDEBUG2 XCCM_SYSDEBUG2_OFFSET |
#define | CCM_ACTIVE_SIZE XCCM_ACTIVE_SIZE_OFFSET |
#define | CCM_K11 XCCM_K11_OFFSET |
#define | CCM_K12 XCCM_K12_OFFSET |
#define | CCM_K13 XCCM_K13_OFFSET |
#define | CCM_K21 XCCM_K21_OFFSET |
#define | CCM_K22 XCCM_K22_OFFSET |
#define | CCM_K23 XCCM_K23_OFFSET |
#define | CCM_K31 XCCM_K31_OFFSET |
#define | CCM_K32 XCCM_K32_OFFSET |
#define | CCM_K33 XCCM_K33_OFFSET |
#define | CCM_ROFFSET XCCM_ROFFSET_OFFSET |
#define | CCM_GOFFSET XCCM_GOFFSET_OFFSET |
#define | CCM_BOFFSET XCCM_BOFFSET_OFFSET |
#define | CCM_CLIP XCCM_CLIP_OFFSET |
#define | CCM_CLAMP XCCM_CLAMP_OFFSET |
#define | CCM_CTL_EN_MASK XCCM_CTL_SW_EN_MASK |
#define | CCM_CTL_RUE_MASK XCCM_CTL_RUE_MASK |
#define | CCM_RST_RESET XCCM_CTL_RESET_MASK |
#define | CCM_RST_AUTORESET XCCM_CTL_AUTORESET_MASK |
#define | CCM_In32 XCcm_In32 |
#define | CCM_Out32 XCcm_Out32 |
#define | XCCM_ReadReg XCcm_ReadReg |
#define | XCCM_WriteReg XCcm_WriteReg |
Interrupt Enable and Status Registers Offsets | |
#define | XCCM_ISR_OFFSET XCCM_STATUS_OFFSET |
#define | XCCM_IER_OFFSET XCCM_IRQ_EN_OFFSET |
Defines | |
#define | XCCM_HW_H_ |
#define | XCcm_In32 Xil_In32 |
#define | XCcm_Out32 Xil_Out32 |
#define | XCcm_ReadReg(BaseAddress, RegOffset) XCcm_In32((BaseAddress) + (u32)(RegOffset)) |
#define | XCcm_WriteReg(BaseAddress, RegOffset, Data) XCcm_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data)) |
#define CCM_ACTIVE_SIZE XCCM_ACTIVE_SIZE_OFFSET | +
+ +
#define CCM_BOFFSET XCCM_BOFFSET_OFFSET | +
+ +
#define CCM_CLAMP XCCM_CLAMP_OFFSET | +
+ +
#define CCM_CLIP XCCM_CLIP_OFFSET | +
+ +
#define CCM_CONTROL XCCM_CONTROL_OFFSET | +
+ +
#define CCM_CTL_EN_MASK XCCM_CTL_SW_EN_MASK | +
+ +
#define CCM_CTL_RUE_MASK XCCM_CTL_RUE_MASK | +
+ +
#define CCM_ERROR XCCM_ERROR_OFFSET | +
+ +
#define CCM_GOFFSET XCCM_GOFFSET_OFFSET | +
+ +
#define CCM_In32 XCcm_In32 | +
+ +
#define CCM_IRQ_EN XCCM_IRQ_EN_OFFSET | +
+ +
#define CCM_K11 XCCM_K11_OFFSET | +
+ +
#define CCM_K12 XCCM_K12_OFFSET | +
+ +
#define CCM_K13 XCCM_K13_OFFSET | +
+ +
#define CCM_K21 XCCM_K21_OFFSET | +
+ +
#define CCM_K22 XCCM_K22_OFFSET | +
+ +
#define CCM_K23 XCCM_K23_OFFSET | +
+ +
#define CCM_K31 XCCM_K31_OFFSET | +
+ +
#define CCM_K32 XCCM_K32_OFFSET | +
+ +
#define CCM_K33 XCCM_K33_OFFSET | +
+ +
#define CCM_Out32 XCcm_Out32 | +
+ +
#define CCM_ROFFSET XCCM_ROFFSET_OFFSET | +
+ +
#define CCM_RST_AUTORESET XCCM_CTL_AUTORESET_MASK | +
+ +
#define CCM_RST_RESET XCCM_CTL_RESET_MASK | +
+ +
#define CCM_STATUS XCCM_STATUS_OFFSET | +
+ +
#define CCM_SYSDEBUG0 XCCM_SYSDEBUG0_OFFSET | +
+ +
#define CCM_SYSDEBUG1 XCCM_SYSDEBUG1_OFFSET | +
+ +
#define CCM_SYSDEBUG2 XCCM_SYSDEBUG2_OFFSET | +
+ +
#define CCM_VERSION XCCM_VERSION_OFFSET | +
+ +
#define XCCM_ACTIVE_SIZE_OFFSET 0x020 | +
+Active Size (V x H) offset +
#define XCCM_ACTSIZE_NUM_LINE_MASK 0x1FFF0000 | +
+Number of Active lines per frame (vertical) mask +
#define XCCM_ACTSIZE_NUM_LINE_SHIFT 16 | +
+Shift for number of lines +
#define XCCM_ACTSIZE_NUM_PIXEL_MASK 0x00001FFF | +
+Number of Active pixels per scan line (horizontal) mask +
#define XCCM_BOFFSET_OFFSET 0x12C | +
+Blue Offset offset +
#define XCCM_CLAMP_MASK 0x0000FFFF | +
+Clamp register mask +
#define XCCM_CLAMP_OFFSET 0x134 | +
+Clamp Offset offset +
#define XCCM_CLIP_MASK 0x0000FFFF | +
+Clip register mask +
#define XCCM_CLIP_OFFSET 0x130 | +
+Clip Offset offset +
#define XCCM_COEF_DECI_MASK 0x0001C000 | +
+Mask of Decimal part +
#define XCCM_COEF_MASK 0x0003FFFF | +
+Matrix Coefficient mask +
#define XCCM_COEF_SHIFT 14 | +
+Coefficient shift +
#define XCCM_COEF_SIGN_MASK 0x20000 | +
+Mask for sign bit +
#define XCCM_COEFF_FRAC_MASK 0x00003FFF | +
+Mask of Fractional part +
#define XCCM_CONTROL_OFFSET 0x000 | +
+Control offset +
#define XCCM_CTL_AUTORESET_MASK 0x40000000 | +
+Software Auto Reset mask +
#define XCCM_CTL_BPE_MASK 0x00000010 | +
+Bypass Enable mask +
#define XCCM_CTL_RESET_MASK 0x80000000 | +
+Software Reset mask +
#define XCCM_CTL_RUE_MASK 0x00000002 | +
+Register Update Enable mask +
#define XCCM_CTL_SW_EN_MASK 0x00000001 | +
+Enable mask +
#define XCCM_CTL_TPE_MASK 0x00000020 | +
+Test Pattern Enable mask +
#define XCCM_ERR_EOL_EARLY_MASK 0x00000001 | +
+End of Line Early mask +
#define XCCM_ERR_EOL_LATE_MASK 0x00000002 | +
+End of Line Late mask +
#define XCCM_ERR_SOF_EARLY_MASK 0x00000004 | +
+Start of Frame Early mask +
#define XCCM_ERR_SOF_LATE_MASK 0x00000008 | +
+Start of Frame Late mask +
#define XCCM_ERROR_OFFSET 0x008 | +
+Error offset +
#define XCCM_GOFFSET_OFFSET 0x128 | +
+Green Offset offset +
#define XCCM_HW_H_ | +
+Prevent circular inclusions by using protection macros +
#define XCCM_IER_OFFSET XCCM_IRQ_EN_OFFSET | +
+Interrupt enable Offset +
#define XCcm_In32 Xil_In32 | +
+Input operation +
#define XCCM_IRQ_EN_OFFSET 0x00C | +
+IRQ Enable offset +
#define XCCM_ISR_OFFSET XCCM_STATUS_OFFSET | +
+Interrupt status register generates a interrupt if the corresponding bits of interrupt enable register bits are set. Interrupt status offset +
#define XCCM_IXR_ALLINTR_MASK 0x00010003 | +
+Interrupt all error mask (ORing of all interrupt mask) +
#define XCCM_IXR_EOF_MASK 0x00000002 | +
+End-Of-Frame mask +
#define XCCM_IXR_PROCS_STARTED_MASK 0x00000001 | +
+Process Started mask +
#define XCCM_IXR_SE_MASK 0x00010000 | +
+Slave Error mask +
#define XCCM_K11_OFFSET 0x100 | +
+K11 Coefficient offset +
#define XCCM_K12_OFFSET 0x104 | +
+K12 Coefficient offset +
#define XCCM_K13_OFFSET 0x108 | +
+K13 Coefficient offset +
#define XCCM_K21_OFFSET 0x10C | +
+K21 Coefficient offset +
#define XCCM_K22_OFFSET 0x110 | +
+K22 Coefficient offset +
#define XCCM_K23_OFFSET 0x114 | +
+K23 Coefficient offset +
#define XCCM_K31_OFFSET 0x118 | +
+K31 Coefficient offset +
#define XCCM_K32_OFFSET 0x11C | +
+K32 Coefficient offset +
#define XCCM_K33_OFFSET 0x120 | +
+K33 Coefficient offset +
#define XCCM_MAX_VALUE 0xFFFFFFFF | +
+32 bit maximum value +
#define XCCM_OFFSET_MASK 0x0001FFFF | +
+Offset mask for Red, Green Blue Offset registers +
#define XCCM_OFFSET_SIGN_SHIFT 15 | +
+Shift for signed bit +
#define XCcm_Out32 Xil_Out32 | +
+Output operation +
#define XCcm_ReadReg | +( | +BaseAddress, | |||
+ | + | RegOffset | ++ | ) | +XCcm_In32((BaseAddress) + (u32)(RegOffset)) | +
+This macro reads the given register.
+
BaseAddress | is the Xilinx base address of the CCM core. | |
RegOffset | is the register offset of the register. |
#define XCCM_ReadReg XCcm_ReadReg | +
+ +
#define XCCM_ROFFSET_OFFSET 0x124 | +
+Red Offset offset +
#define XCCM_SIGN_MUL -1 | +
+Macro for sign multiplication +
#define XCCM_SIGNBIT_MASK 0x10000000 | +
+ +
#define XCCM_STATUS_OFFSET 0x004 | +
+Status offset +
#define XCCM_SYSDEBUG0_OFFSET 0x014 | +
+System Debug 0 offset +
#define XCCM_SYSDEBUG1_OFFSET 0x018 | +
+System Debug 1 offset +
#define XCCM_SYSDEBUG2_OFFSET 0x01C | +
+System Debug 2 offset +
#define XCCM_VER_INTERNAL_SHIFT 0x00000008 | +
+Version Internal shift +
#define XCCM_VER_MAJOR_MASK 0xFF000000 | +
+Version Major mask +
#define XCCM_VER_MAJOR_SHIFT 0x00000018 | +
+Version Major shift +
#define XCCM_VER_MINOR_MASK 0x00FF0000 | +
+Version Minor mask +
#define XCCM_VER_MINOR_SHIFT 0x00000010 | +
+Version Minor shift +
#define XCCM_VER_PID_MASK 0x00000F00 | +
+Version Patch ID mask +
#define XCCM_VER_REV_MASK 0x0000F000 | +
+Version Revision mask +
#define XCCM_VER_REV_NUM_MASK 0x000000FF | +
+Version Revision Number mask +
#define XCCM_VER_REV_SHIFT 0x0000000C | +
+Version Revision shift +
#define XCCM_VERSION_OFFSET 0x010 | +
+Version offset +
#define XCcm_WriteReg | +( | +BaseAddress, | |||
+ | + | RegOffset, | |||
+ | + | Data | ++ | ) | +XCcm_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data)) | +
+This macro writes the given register.
+
BaseAddress | is the Xilinx base address of the CCM core. | |
RegOffset | is the register offset of the register. | |
Data | is the 32-bit value to write to the register. |
#define XCCM_WriteReg XCcm_WriteReg | +
+ +
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__intr_8c.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__intr_8c.html new file mode 100644 index 00000000..e4debd25 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__intr_8c.html @@ -0,0 +1,136 @@ + +
+ ++
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------- -------- ------------------------------------------------------ + 6.0 adk 03/06/14 First release. + Implemented the following functions: + XCcm_IntrHandler and XCcm_SetCallBack.
+
+
+#include "xccm.h"
+
Functions | |
void | XCcm_IntrHandler (void *InstancePtr) |
int | XCcm_SetCallBack (XCcm *InstancePtr, u32 HandlerType, void *CallBackFunc, void *CallBackRef) |
void XCcm_IntrHandler | +( | +void * | +InstancePtr | +) | ++ |
+This function is the interrupt handler for the CCM core.
+This handler reads the pending interrupt from Status register, determines the source of the interrupts and calls the respective callbacks for the interrupts that are enabled in IRQ_ENABLE register, 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 XCcm_SetCallBack() during initialization phase. .
+
InstancePtr | is a pointer to the XCcm instance that just interrupted. |
int XCcm_SetCallBack | +( | +XCcm * | +InstancePtr, | +|
+ | + | u32 | +HandlerType, | +|
+ | + | void * | +CallBackFunc, | +|
+ | + | void * | +CallBackRef | + |
+ | ) | ++ |
+This routine installs an asynchronous callback function for the given HandlerType.
+
+ HandlerType Callback Function Type + ----------------------- -------------------------------------------------- + XCCM_HANDLER_FRAMEDONE FrameDoneCallBack + XCCM_HANDLER_PROCSTART ProcStartCallBack + XCCM_HANDLER_ERROR ErrCallBack
+
+
InstancePtr | is a pointer to the Xccm 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/ccm/doc/html/api/xccm__selftest_8c.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__selftest_8c.html new file mode 100644 index 00000000..9fa58b3d --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__selftest_8c.html @@ -0,0 +1,73 @@ + +
+ ++
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------- -------- ---------------------------------------------- + 6.0 adk 03/06/14 First Release. + Implemented XCcm_SelfTest function.
+
+
+#include "xccm.h"
+#include "xstatus.h"
+
Functions | |
int | XCcm_SelfTest (XCcm *InstancePtr) |
int XCcm_SelfTest | +( | +XCcm * | +InstancePtr | +) | ++ |
+This function reads Version register of CCM core and compares with zero as part of self test.
+
InstancePtr | is a pointer to XCcm instance. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__sinit_8c.html b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__sinit_8c.html new file mode 100644 index 00000000..7ba1d79b --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/doc/html/api/xccm__sinit_8c.html @@ -0,0 +1,71 @@ + +
+ ++
+ MODIFICATION HISTORY:
+
Ver Who Date Changes + ----- ------- -------- -------------------------------------------------- + 6.0 adk 03/06/14 First release. + Implemented XCcm_LookupConfig function.
+
+
+#include "xccm.h"
+#include "xparameters.h"
+
Functions | |
XCcm_Config * | XCcm_LookupConfig (u16 DeviceId) |
XCcm_Config* XCcm_LookupConfig | +( | +u16 | +DeviceId | +) | ++ |
+XCcm_LookupConfig returns a reference to an XCcm_Config structure based on the unique device id, DeviceId. The return value will refer to an entry in the device configuration table defined in the xccm_g.c file.
+
DeviceId | is the unique device ID of the device for the lookup operation. |
+Copyright @ 1995-2014 Xilinx, Inc. All rights reserved. diff --git a/XilinxProcessorIPLib/drivers/ccm/examples/ccm_selftest_example.c b/XilinxProcessorIPLib/drivers/ccm/examples/ccm_selftest_example.c new file mode 100755 index 00000000..4e2f702f --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/examples/ccm_selftest_example.c @@ -0,0 +1,158 @@ +/****************************************************************************** +* +* (c) Copyright 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 ccm_selftest_example.c +* +* This file contains an example using the XCCM driver to do self test +* on the device. +* +* @note +* +* None +* +* MODIFICATION HISTORY: +*
+* Ver Who Date Changes +* ----- ------- -------- ----------------------------------------------- +* 6.00 adk 03/06/14 First Release. +* Implimented XCcmSelfTestExample function. +* Adherence to Xilinx coding guidelines. +* +*+******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xccm.h" +#include "xparameters.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 CCM_DEVICE_ID XPAR_CCM_0_DEVICE_ID /**< CCM Device ID */ + +/**************************** Type Definitions *******************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + +/************************** Function Prototypes ******************************/ + + +int XCcmSelfTestExample(u16 DeviceId); + +/************************** Variable Definitions *****************************/ + + +XCcm Ccm; /**
- * MODIFICATION HISTORY: - * - * Ver Who Date Changes - * ----- ---- -------- ------------------------------------------------------- - * 4.00a tb 02/27/12 Updates for the v4.00.a release - * 1.00a xd 05/15/09 First release - *- * - * *************************************************************************** - */ - -#include "ccm.h" -#include "xparameters.h" - -/***************************************************************************/ -// Color Correction Matrix Register Reading Example -// This function provides an example of how to read the current configuration -// settings of the CCM core. -/***************************************************************************/ -void report_ccm_settings(u32 BaseAddress) { - xil_printf("Color Correction Matrix Core Configuration:\r\n"); - - xil_printf(" CCM Version: 0x%08x\r\n", CCM_ReadReg(BaseAddress, CCM_VERSION)); - - xil_printf(" CCM Enable Bit: %1x\r\n", (CCM_ReadReg(BaseAddress, CCM_CONTROL) & CCM_CTL_EN_MASK)); - - xil_printf(" CCM Register Update Bit: %1d\r\n", (CCM_ReadReg(BaseAddress, CCM_CONTROL) & CCM_CTL_RUE_MASK) >> 1); - - xil_printf(" CCM Reset Bit: %1d\r\n", (CCM_ReadReg(BaseAddress, CCM_CONTROL) & CCM_RST_RESET) >> 31); - - xil_printf(" CCM AutoReset Bit: %1d\r\n", (CCM_ReadReg(BaseAddress, CCM_CONTROL) & CCM_RST_AUTORESET) >> 30); - - xil_printf(" Active Columns=%d, Active Rows=%d\r\n", - CCM_ReadReg(BaseAddress, CCM_ACTIVE_SIZE)&0x0000FFFF, - CCM_ReadReg(BaseAddress, CCM_ACTIVE_SIZE)>>16); - xil_printf(" [K11=%8x, K12=%8x, K13=%8x ] [ROFFSET=%3d]\r\n", - CCM_ReadReg(BaseAddress, CCM_K11), - CCM_ReadReg(BaseAddress, CCM_K12), - CCM_ReadReg(BaseAddress, CCM_K13), - CCM_ReadReg(BaseAddress, CCM_ROFFSET)); - - xil_printf(" [K21=%8x, K22=%8x, K23=%8x ] [GOFFSET=%3d]\r\n", - CCM_ReadReg(BaseAddress, CCM_K21), - CCM_ReadReg(BaseAddress, CCM_K22), - CCM_ReadReg(BaseAddress, CCM_K23), - CCM_ReadReg(BaseAddress, CCM_GOFFSET)); - - xil_printf(" [K31=%8x, K32=%8x, K33=%8x ] [BOFFSET=%3d]\r\n", - CCM_ReadReg(BaseAddress, CCM_K31), - CCM_ReadReg(BaseAddress, CCM_K32), - CCM_ReadReg(BaseAddress, CCM_K33), - CCM_ReadReg(BaseAddress, CCM_BOFFSET)); - - xil_printf(" [CLIP=%3d, CLAMP=%3d]\r\n", - CCM_ReadReg(BaseAddress, CCM_CLIP), - CCM_ReadReg(BaseAddress, CCM_CLAMP)); -} - - - -/***************************************************************************/ -// Color Correction Matrix Register Update Example -// This function provides an example of the process used to update -// the coefficient and offset registers in the CCM core. -// In most video systems, it is expected that this process would be executed -// in response to an interrupt connected to the VBlank video timing signal -// or a timeout signal associated with a watchdog timer. -/***************************************************************************/ -void CCM_Update_Example(u32 BaseAddress) { - //Enable the CCM software enable - CCM_Enable(BaseAddress); - - //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. - CCM_RegUpdateDisable(BaseAddress); - - //Set the coefficients - // These values are floating point values in the range: [-4.0, 4.0) - // These are represented as integers by multiplying by 2^15, - // resulting in an integer value in the range from [-131072, 131071] - CCM_WriteReg(BaseAddress, CCM_K11, 32768); //K11 = 1.0 - CCM_WriteReg(BaseAddress, CCM_K12, 32768); //K12 = 1.0 - CCM_WriteReg(BaseAddress, CCM_K13, 32768); //K13 = 1.0 - CCM_WriteReg(BaseAddress, CCM_K21, 32768); //K21 = 1.0 - CCM_WriteReg(BaseAddress, CCM_K22, 32768); //K22 = 1.0 - CCM_WriteReg(BaseAddress, CCM_K23, 32768); //K23 = 1.0 - CCM_WriteReg(BaseAddress, CCM_K31, 32768); //K31 = 1.0 - CCM_WriteReg(BaseAddress, CCM_K32, 32768); //K32 = 1.0 - CCM_WriteReg(BaseAddress, CCM_K33, 32768); //K33 = 1.0 - - //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] - CCM_WriteReg(BaseAddress, CCM_ROFFSET, 5); //ROFFSET = 5 - CCM_WriteReg(BaseAddress, CCM_GOFFSET, 10); //GOFFSET = 10 - CCM_WriteReg(BaseAddress, CCM_BOFFSET, 15); //BOFFSET = 15 - - //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] - CCM_WriteReg(BaseAddress, CCM_CLIP, 240); //CLIP = 240 - CCM_WriteReg(BaseAddress, CCM_CLAMP, 16); //CLAMP = 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. - CCM_RegUpdateEnable(BaseAddress); - -} - - -/*****************************************************************************/ -// -// This is the main function for the CCM example. -// -/*****************************************************************************/ -int main(void) -{ - // Print the current settings for the CCM core - report_ccm_settings(XPAR_CCM_0_BASEADDR); - - // Call the CCM example, specify the Device ID generated in xparameters.h - CCM_Update_Example(XPAR_CCM_0_BASEADDR); - - return 0; -} - - diff --git a/XilinxProcessorIPLib/drivers/ccm/examples/index.html b/XilinxProcessorIPLib/drivers/ccm/examples/index.html index b14a56e7..326e1653 100755 --- a/XilinxProcessorIPLib/drivers/ccm/examples/index.html +++ b/XilinxProcessorIPLib/drivers/ccm/examples/index.html @@ -10,8 +10,8 @@
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.
- \ No newline at end of file + diff --git a/XilinxProcessorIPLib/drivers/ccm/src/ccm.h b/XilinxProcessorIPLib/drivers/ccm/src/ccm.h deleted file mode 100755 index ad555784..00000000 --- a/XilinxProcessorIPLib/drivers/ccm/src/ccm.h +++ /dev/null @@ -1,312 +0,0 @@ -/****************************************************************************** -* -* 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 -* 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 ccm.h -* -* This header file contains identifiers and register-level driver functions (or -* macros) that can be used to access the Xilinx Color Correction Matrix(CCM) device. -* -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ---- -------- ------------------------------------------------------- -* 2.00a jo 05/1/10 Updated for CCM V2.0 -* 3.00a ren 09/11/11 Updated for CCM V3.0 -* 4.00a jj 12/18/12 Converted from xio.h to xil_io.h,translating -* basic types,MB cache functions, exceptions -* and assertions to xil_io format -* 5.0 adk 19/12/13 Updated as per the New Tcl API's -******************************************************************************/ - -#ifndef CCM_DRIVER_H /* prevent circular inclusions */ -#define CCM_DRIVER_H /* by using protection macros */ - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************** Include Files *********************************/ - -#include "xil_io.h" - -/************************** Constant Definitions *****************************/ - -/** - * Register Offsets - */ -/* General Control Registers */ -#define CCM_CONTROL 0x000 /**< Control */ -#define CCM_STATUS 0x004 /**< Status */ -#define CCM_ERROR 0x008 /**< Error */ -#define CCM_IRQ_EN 0x00C /**< IRQ Enable */ -#define CCM_VERSION 0x010 /**< Version */ -#define CCM_SYSDEBUG0 0x014 /**< System Debug 0 */ -#define CCM_SYSDEBUG1 0x018 /**< System Debug 1 */ -#define CCM_SYSDEBUG2 0x01C /**< System Debug 2 */ -/* Timing Control Registers */ -#define CCM_ACTIVE_SIZE 0x020 /**< Active Size (V x H) */ -#define CCM_TIMING_STATUS 0x024 /**< Timing Measurement Status */ -/* Core Specific Registers */ -#define CCM_K11 0x100 /**< K11 Coefficient */ -#define CCM_K12 0x104 /**< K12 Coefficient */ -#define CCM_K13 0x108 /**< K13 Coefficient */ -#define CCM_K21 0x10C /**< K21 Coefficient */ -#define CCM_K22 0x110 /**< K22 Coefficient */ -#define CCM_K23 0x114 /**< K23 Coefficient */ -#define CCM_K31 0x118 /**< K31 Coefficient */ -#define CCM_K32 0x11C /**< K32 Coefficient */ -#define CCM_K33 0x120 /**< K33 Coefficient */ -#define CCM_ROFFSET 0x124 /**< Red Offset */ -#define CCM_GOFFSET 0x128 /**< Green Offset */ -#define CCM_BOFFSET 0x12C /**< Blue Offset */ -#define CCM_CLIP 0x130 /**< Clip (Max) */ -#define CCM_CLAMP 0x134 /**< Clamp (Min) */ - -/* - * CCM Control Register bit definition - */ -#define CCM_CTL_EN_MASK 0x00000001 /**< CCM Enable */ -#define CCM_CTL_RUE_MASK 0x00000002 /**< CCM Register Update Enable */ - -/* - * CCM Reset Register bit definition - */ -#define CCM_RST_RESET 0x80000000 /**< Software Reset - Instantaneous */ -#define CCM_RST_AUTORESET 0x40000000 /**< Software Reset - Auto-synchronize to SOF */ - - -/***************** Macros (Inline Functions) Definitions *********************/ - -#define CCM_In32 Xil_In32 -#define CCM_Out32 Xil_Out32 - - -/*****************************************************************************/ -/** -* -* This macro enables a CCM device. -* -* @param BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* -* @return None. -* -* @note -* C-style signature: -* void CCM_Enable(u32 BaseAddress); -* -******************************************************************************/ -#define CCM_Enable(BaseAddress) \ - CCM_WriteReg(BaseAddress, CCM_CONTROL, \ - CCM_ReadReg(BaseAddress, CCM_CONTROL) | \ - CCM_CTL_EN_MASK) - -/*****************************************************************************/ -/** -* -* This macro disables a CCM device. -* -* @param BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* -* @return None. -* -* @note -* C-style signature: -* void CCM_Disable(u32 BaseAddress); -* -******************************************************************************/ -#define CCM_Disable(BaseAddress) \ - CCM_WriteReg(BaseAddress, CCM_CONTROL, \ - CCM_ReadReg(BaseAddress, CCM_CONTROL) & \ - ~CCM_CTL_EN_MASK) - -/*****************************************************************************/ -/** -* -* This macro tells a CCM device to pick up all the register value changes -* made so far by the software. The registers will be automatically updated -* on the next rising-edge of the VBlank_in signal on the core. -* It is up to the user to manually disable the register update after a sufficient -* amount if time. -* -* This function only works when the CCM core is enabled. -* -* @param BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* -* @return None. -* -* @note -* C-style signature: -* void CCM_RegUpdateEnable(u32 BaseAddress); -* -******************************************************************************/ -#define CCM_RegUpdateEnable(BaseAddress) \ - CCM_WriteReg(BaseAddress, CCM_CONTROL, \ - CCM_ReadReg(BaseAddress, CCM_CONTROL) | \ - CCM_CTL_RUE_MASK) - -/*****************************************************************************/ -/** -* -* This macro tells a CCM device not to update it's configuration registers made -* so far by the software. When disabled, changes to other configuration registers -* are stored, but do not effect the core's behavior. -* -* This function only works when the CCM core is enabled. -* -* @param BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* -* @return None. -* -* @note -* C-style signature: -* void CCM_RegUpdateDisable(u32 BaseAddress); -* -******************************************************************************/ -#define CCM_RegUpdateDisable(BaseAddress) \ - CCM_WriteReg(BaseAddress, CCM_CONTROL, \ - CCM_ReadReg(BaseAddress, CCM_CONTROL) & \ - ~CCM_CTL_RUE_MASK) - -/*****************************************************************************/ -/** -* -* This macro resets a CCM device. This reset effects the core immediately, -* and may cause image tearing. -* -* This reset resets the CCM's configuration registers, and holds the core's outputs -* in their reset state until CCM_ClearReset() is called. -* -* -* @param BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* -* @return None. -* -* @note -* C-style signature: -* void CCM_Reset(u32 BaseAddress); -* -******************************************************************************/ -#define CCM_Reset(BaseAddress) \ - CCM_WriteReg(BaseAddress, CCM_CONTROL, CCM_RST_RESET) \ - -/*****************************************************************************/ -/** -* -* This macro clears the CCM's reset flag (which is set using CCM_Reset(), and -* returns it to normal operation. This ClearReset effects the core immediately, -* and may cause image tearing. -* -* -* @param BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* -* @return None. -* -* @note -* C-style signature: -* void CCM_ClearReset(u32 BaseAddress); -* -******************************************************************************/ -#define CCM_ClearReset(BaseAddress) \ - CCM_WriteReg(BaseAddress, CCM_CONTROL, 0) \ - - -/*****************************************************************************/ -/** -* -* This macro resets a CCM device, but differs from CCM_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 CCM_AutoSyncReset(), -* 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 BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* -* @return None. -* -* @note -* C-style signature: -* void CCM_Reset(u32 BaseAddress); -* -******************************************************************************/ -#define CCM_AutoSyncReset(BaseAddress) \ - CCM_WriteReg(BaseAddress, CCM_CONTROL, CCM_RST_AUTORESET) \ - -/*****************************************************************************/ -/** -* -* Read the given register. -* -* @param BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* @param RegOffset is the register offset of the register (defined at top of this file) -* -* @return The 32-bit value of the register -* -* @note -* C-style signature: -* u32 CCM_ReadReg(u32 BaseAddress, u32 RegOffset) -* -******************************************************************************/ -#define CCM_ReadReg(BaseAddress, RegOffset) \ - CCM_In32((BaseAddress) + (RegOffset)) - -/*****************************************************************************/ -/** -* -* Write the given register. -* -* @param BaseAddress is the Xilinx EDK base address of the CCM core (from xparameters.h) -* @param RegOffset is the register offset of the register (defined at top of this file) -* @param Data is the 32-bit value to write to the register -* -* @return None. -* -* @note -* C-style signature: -* void CCM_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data) -* -******************************************************************************/ -#define CCM_WriteReg(BaseAddress, RegOffset, Data) \ - CCM_Out32((BaseAddress) + (RegOffset), (Data)) - -/************************** Function Prototypes ******************************/ - -#ifdef __cplusplus -} -#endif - -#endif /* end of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/ccm/src/xccm.c b/XilinxProcessorIPLib/drivers/ccm/src/xccm.c new file mode 100755 index 00000000..7a24f119 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/xccm.c @@ -0,0 +1,997 @@ +/****************************************************************************** +* +* (c) Copyright 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 +* 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 xccm.c +* +* This file contains the implementation of the interface functions for CCM +* driver. Refer to the header file xccm.h for more detailed information. +* +*+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------- -------- ------------------------------------------------------ +* 2.00a jo 05/1/10 Updated for CCM V2.0 +* 3.00a ren 09/11/11 Updated for CCM v3.0 +* 4.00a jj 12/18/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 03/06/14 Changed filename ccm.c to xccm.c. +* Implemented the following functions: +* XCcm_CfgInitialize, XCcm_Setup, XCcm_GetVersion, +* XCcm_EnableDbgByPass, XCcm_IsDbgByPassEnabled, +* XCcm_DisableDbgByPass, XCcm_EnableDbgTestPattern, +* XCcm_IsDbgTestPatternEnabled, +* XCcm_DisableDbgTestPattern, XCcm_GetDbgFrameCount, +* XCcm_GetDbgLineCount, XCcm_GetDbgPixelCount, +* XCcm_SetActiveSize, XCcm_GetActiveSize, +* XCcm_SetCoefMatrix, XCcm_GetCoefMatrix, +* XCcm_SetRgbOffset, XCcm_GetRgbOffset, +* XCcm_SetClip, XCcm_GetClip, +* XCcm_SetClamp and XCcm_GetClamp XCcm_FloatToFixedConv, +* and XCcm_FixedToFloatConv. +* +*+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xccm.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + +static void StubCallBack(void *CallBackRef); +static void StubErrCallBack(void *CallBackRef, u32 ErrorMask); +static float XCcm_FixedToFloatConv(u32 Input); +static s32 XCcm_FloatToFixedConv(float Input); + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function initializes an CCM core. This function must be called +* prior to using an CCM core. Initialization of an CCM includes setting up +* the instance data and ensuring the hardware is in a quiescent state. +* +* @param InstancePtr is a pointer to the XCcm instance. +* @param CfgPtr is a reference to a structure containing information +* about a specific XCcm instance. +* @param EffectiveAddr is the device base address in the virtual memory +* address space. The caller is responsible for keeping the +* address mapping from EffectiveAddr to the device 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 XCcm_CfgInitialize(XCcm *InstancePtr, XCcm_Config *CfgPtr, + u32 EffectiveAddr) +{ + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(CfgPtr != NULL); + Xil_AssertNonvoid(EffectiveAddr != ((u32)0x0)); + + /* Setup the instance */ + (void)memset((void *)InstancePtr, 0, sizeof(XCcm)); + (void)memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr, + sizeof(XCcm_Config)); + InstancePtr->Config.BaseAddress = EffectiveAddr; + + /* + * Set all handlers to stub values, let user configure this data + * later + */ + InstancePtr->ProcStartCallBack = + (XCcm_CallBack)((void *)StubCallBack); + InstancePtr->FrameDoneCallBack = + (XCcm_CallBack)((void *)StubCallBack); + InstancePtr->ErrCallBack = + (XCcm_ErrorCallBack)((void *)StubErrCallBack); + + /* + * Reset the hardware and set the flag to indicate the driver is + * ready + */ + XCcm_Reset(InstancePtr); + InstancePtr->IsReady = (u32)(XIL_COMPONENT_IS_READY); + + return (XST_SUCCESS); +} + +/*****************************************************************************/ +/** +* +* This function sets the input/output frame size in Active Size register and +* enables the register update. +* +* @param InstancePtr is a pointer to the Xccm instance. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XCcm_Setup(XCcm *InstancePtr) +{ + u32 Data; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + + XCcm_RegUpdateDisable(InstancePtr); + + /* Write into active size register */ + Data = ((((InstancePtr->VSize)) << + (u32)(XCCM_ACTSIZE_NUM_LINE_SHIFT)) & + (XCCM_ACTSIZE_NUM_LINE_MASK)) | + (((InstancePtr->HSize)) & (u32)(XCCM_ACTSIZE_NUM_PIXEL_MASK)); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, + (XCCM_ACTIVE_SIZE_OFFSET), Data); + XCcm_RegUpdateEnable(InstancePtr); +} + +/*****************************************************************************/ +/** +* +* This function enables the bypass mode by setting bypass bit of the Control +* register to switch the core to bypass mode if debug feature is enabled in +* the core. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return None. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +void XCcm_EnableDbgByPass(XCcm *InstancePtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0); + + XCcm_WriteReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET), + ((XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET))) | + (XCCM_CTL_BPE_MASK))); +} + +/*****************************************************************************/ +/** +* +* This function returns the current bypass mode settings from Control register +* of the CCM core. +* +* @param InstancePtr is a pointer to the XCcm instance. +* +* @return Core debug bypass mode. +* - TRUE = Bypass mode is enabled. +* - FALSE = Bypass mode is not enabled. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +int XCcm_IsDbgByPassEnabled(XCcm *InstancePtr) +{ + u32 DbgByPass; + int Status; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + DbgByPass = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET))) & (XCCM_CTL_BPE_MASK); + if (DbgByPass == (XCCM_CTL_BPE_MASK)) { + Status = (TRUE); + } + else { + Status = (FALSE); + } + + return Status; +} + +/*****************************************************************************/ +/** +* +* This function disables the Bypass mode of the CCM core. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return None. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +void XCcm_DisableDbgByPass(XCcm *InstancePtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0); + + XCcm_WriteReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET), + ((XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET))) & (~(XCCM_CTL_BPE_MASK)))); +} + +/*****************************************************************************/ +/** +* +* This function enables the test-pattern mode if debug feature is enabled +* by setting test-pattern bit of the Control register of the CCM core. +* +* @param InstancePtr is a pointer to the XCcm instance. +* +* @return None. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +void XCcm_EnableDbgTestPattern(XCcm *InstancePtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0); + + XCcm_WriteReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET), + ((XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET))) | (XCCM_CTL_TPE_MASK))); +} + +/*****************************************************************************/ +/** +* +* This function returns the test-pattern mode (enabled or not) from Control +* register of the CCM core, if debug feature was enabled. +* +* @param InstancePtr is a pointer to the XCcm instance. +* +* @return Test-pattern generator mode. +* - TRUE = Test-pattern mode is enabled. +* - FALSE = Test-pattern mode is not enabled. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +int XCcm_IsDbgTestPatternEnabled(XCcm *InstancePtr) +{ + u32 DbgTestPattern; + int Status; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + DbgTestPattern = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET))) & (XCCM_CTL_TPE_MASK); + if (DbgTestPattern == (XCCM_CTL_TPE_MASK)) { + Status = (TRUE); + } + else { + Status = (FALSE); + } + + return Status; +} + +/*****************************************************************************/ +/** +* +* This function disables debug test pattern mode in Control register of the +* CCM core, if Debug feature is enabled. +* +* @param InstancePtr is a pointer to the XCcm core instance to be +* worked on. +* +* @return None. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +void XCcm_DisableDbgTestPattern(XCcm *InstancePtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0); + + XCcm_WriteReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET), + ((XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_CONTROL_OFFSET))) & (~(XCCM_CTL_TPE_MASK)))); +} + +/*****************************************************************************/ +/** +* +* This function gets the Version of the CCM core. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return Returns the contents of the Version register. +* +* @note None. +* +******************************************************************************/ +u32 XCcm_GetVersion(XCcm *InstancePtr) + +{ + u32 Data; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + /* Read version register of the CCM core. */ + Data = XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_VERSION_OFFSET)); + + return Data; +} + +/*****************************************************************************/ +/** +* +* This function gets number of frames processed since power-up or last +* time the core is reset. +* +* @param InstancePtr is a pointer to the XCcm instance. +* +* @return FrameCount is the number of frames processed since power up. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +u32 XCcm_GetDbgFrameCount(XCcm *InstancePtr) +{ + u32 FrameCount; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + /* Frame throughput monitor */ + FrameCount = XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_SYSDEBUG0_OFFSET)); + + return FrameCount; +} + +/*****************************************************************************/ +/** +* +* This function gets the number of lines processed since power-up or last +* time the core is reset. +* +* @param InstancePtr is a pointer to the XCcm instance. +* +* @return LineCount is the number of lines processed since power up. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +u32 XCcm_GetDbgLineCount(XCcm *InstancePtr) +{ + u32 LineCount; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + /* Line throughput monitor */ + LineCount = XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_SYSDEBUG1_OFFSET)); + + return LineCount; +} + +/*****************************************************************************/ +/** +* +* This function gets the number of pixels processed since power-up or last +* time the core is reset. +* +* @param InstancePtr is a pointer to the XCcm instance. +* +* @return PixelCount is the number of pixels processed since power up. +* +* @note Debug functionality should be enabled. +* +******************************************************************************/ +u32 XCcm_GetDbgPixelCount(XCcm *InstancePtr) +{ + u32 PixelCount; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0); + + /* Pixel throughput monitor */ + PixelCount = XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_SYSDEBUG2_OFFSET)); + + return PixelCount; +} + +/*****************************************************************************/ +/** +* +* This function sets the active H/V sizes in the Active Size register. +* +* @param InstancePtr is a pointer to the XCcm instance. +* @param HSize specifies the number of Active Pixels per Scan Line +* that needs to be set (Range is 32 to 7680). +* @param VSize specifies the number of Active Lines per Frame that +* needs to be set (Range is 32 to 7680). +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XCcm_SetActiveSize(XCcm *InstancePtr, u16 HSize, u16 VSize) +{ + u32 Size; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid((VSize >= (u16)(XCCM_ACT_SIZE_FIRST)) && + (VSize <= (u16)(XCCM_ACT_SIZE_LAST))); + Xil_AssertVoid((HSize >= (u16)(XCCM_ACT_SIZE_FIRST)) && + (HSize <= (u16)(XCCM_ACT_SIZE_LAST))); + + Size = (((u32)VSize) << ((u32)(XCCM_ACTSIZE_NUM_LINE_SHIFT))) | + (HSize); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, + (XCCM_ACTIVE_SIZE_OFFSET), + Size); +} + +/*****************************************************************************/ +/** +* +* This function gets the number of Active Pixels per Scan line and number of +* Active Lines per Frame from the Active Frame Size register. +* +* @param InstancePtr is a pointer to the XCcm instance. +* @param HSize is a pointer to 16-bit variable in which the number of +* Active Pixels per Scan Line is returned (Range is 32 to 7680). +* @param VSize is a pointer to 16-bit variable in which the number of +* Active Lines per Frame is returned (Range is 32 to 7680). + +* @return None. +* +* @note None. +* +******************************************************************************/ +void XCcm_GetActiveSize(XCcm *InstancePtr, u16 *HSize, u16 *VSize) +{ + u32 Data; + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(HSize != NULL); + Xil_AssertVoid(VSize != NULL); + + Data = XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_ACTIVE_SIZE_OFFSET)); + /* + * Number of active pixels per scan line. + */ + *HSize = (u16)((Data) & (XCCM_ACTSIZE_NUM_PIXEL_MASK)); + + /* + * Number of active lines per frame. + */ + *VSize = (u16)(((Data) & (XCCM_ACTSIZE_NUM_LINE_MASK)) >> + (XCCM_ACTSIZE_NUM_LINE_SHIFT)); +} + +/*****************************************************************************/ +/** +* +* This function sets the coefficients of color correction matrix in +* K11 to K33 registers of the CCM core. +* +* @param InstancePtr is a pointer to the CCM instance. +* @param CoefValues is a pointer to XCcm_Coefs structure which has +* matrix coefficients that needs to be set. +* (Range is floating point numbers [-8, 8)). +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XCcm_SetCoefMatrix(XCcm *InstancePtr, XCcm_Coefs *CoefValues) +{ + s32 Value; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CoefValues != NULL); + Xil_AssertVoid(((CoefValues->K11) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K11) <= (XCCM_COEF_LAST))); + Xil_AssertVoid(((CoefValues->K12) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K12) <= (XCCM_COEF_LAST))); + Xil_AssertVoid(((CoefValues->K13) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K13) <= (XCCM_COEF_LAST))); + Xil_AssertVoid(((CoefValues->K21) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K21) <= (XCCM_COEF_LAST))); + Xil_AssertVoid(((CoefValues->K22) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K22) <= (XCCM_COEF_LAST))); + Xil_AssertVoid(((CoefValues->K23) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K23) <= (XCCM_COEF_LAST))); + Xil_AssertVoid(((CoefValues->K31) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K31) <= (XCCM_COEF_LAST))); + Xil_AssertVoid(((CoefValues->K32) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K32) <= (XCCM_COEF_LAST))); + Xil_AssertVoid(((CoefValues->K33) >= ((XCCM_COEF_FIRST))) && + ((CoefValues->K33) <= (XCCM_COEF_LAST))); + + + /* Setting K11 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K11); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K11_OFFSET), + Value); + + /* Setting K12 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K12); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K12_OFFSET), + Value); + + /* Setting K13 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K13); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K13_OFFSET), + Value); + + /* Setting K21 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K21); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K21_OFFSET), + Value); + + /* Setting K22 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K22); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K22_OFFSET), + Value); + + /* Setting K23 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K23); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K23_OFFSET), + Value); + + /* Setting K31 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K31); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K31_OFFSET), + Value); + + /* Setting K32 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K32); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K32_OFFSET), + Value); + + /* Setting K33 register */ + Value = XCcm_FloatToFixedConv(CoefValues->K33); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_K33_OFFSET), + Value); +} + +/*****************************************************************************/ +/** +* +* This function gets the coefficient values of color correction matrix from +* K11 to K33 registers of the CCM core. +* +* @param InstancePtr is a pointer to the CCM instance +* @param CoefValues is a pointer to XCcm_Coefs structure which has +* matrix coefficients is updated with coefficient values. +* (Range is floating point numbers [-8, 8)). +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XCcm_GetCoefMatrix(XCcm *InstancePtr, XCcm_Coefs *CoefValues) +{ + u32 Data; + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CoefValues != NULL); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K11_OFFSET))); + CoefValues->K11 = XCcm_FixedToFloatConv(Data); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K12_OFFSET))); + CoefValues->K12 = XCcm_FixedToFloatConv(Data); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K13_OFFSET))); + CoefValues->K13 = XCcm_FixedToFloatConv(Data); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K21_OFFSET))); + CoefValues->K21 = XCcm_FixedToFloatConv(Data); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K22_OFFSET))); + CoefValues->K22 = XCcm_FixedToFloatConv(Data); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K23_OFFSET))); + CoefValues->K23 = XCcm_FixedToFloatConv(Data); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K31_OFFSET))); + CoefValues->K31 = XCcm_FixedToFloatConv(Data); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K32_OFFSET))); + CoefValues->K32 = XCcm_FixedToFloatConv(Data); + + Data = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_K33_OFFSET))); + CoefValues->K33 = XCcm_FixedToFloatConv(Data); +} + +/*****************************************************************************/ +/** +* +* This function sets the offset compensation for red, blue and green colors in +* corresponding Roffset, Goffset and Boffset registers of the CCM core. +* +* @param InstancePtr is a pointer to the CCM instance. +* @param ROffset specifies offset value of red color component which +* needs to be set. (Range of offset is [-256 255]). +* @param GOffset specifies offset value of green color component which +* needs to be set. (Range of offset is [-256 255]). +* @param BOffset specifies offset value of blue color component which +* needs to be set. (Range of offset is [-256 255]). +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XCcm_SetRgbOffset(XCcm *InstancePtr, s32 ROffset, s32 GOffset, + s32 BOffset) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(((s32)(ROffset) >= ((s32)(XCCM_OFFSET_FIRST))) && + ((s32)(ROffset) <= (s32)(XCCM_OFFSET_LAST))); + Xil_AssertVoid(((s32)(GOffset) >= ((s32)(XCCM_OFFSET_FIRST))) && + ((s32)(GOffset) <= (s32)(XCCM_OFFSET_LAST))); + Xil_AssertVoid(((s32)(BOffset) >= ((s32)(XCCM_OFFSET_FIRST))) && + ((s32)(BOffset) <= (s32)(XCCM_OFFSET_LAST))); + + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_ROFFSET_OFFSET), + ROffset); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_GOFFSET_OFFSET), + GOffset); + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_BOFFSET_OFFSET), + BOffset); +} + +/*****************************************************************************/ +/** +* +* This function gets the offset compensation values of red, blue, green +* colors from Roffset, Goffset and Boffset registers. +* +* @param InstancePtr is a pointer to the CCM instance. +* @param ROffset is a pointer of signed 32 bit variable in which offset +* of red color value is returned. +* (Range of offset is [-256 255]). +* @param GOffset is a pointer of signed 32 bit variable in which offset +* of green color value is returned. +* (Range of offset is [-256 255]). +* @param BOffset is a pointer of signed 32 bit variable in which offset +* of blue color value is returned. +* (Range of offset is [-256 255]). +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XCcm_GetRgbOffset(XCcm *InstancePtr, s32 *ROffset, s32 *GOffset, + s32 *BOffset) +{ + s32 Data; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(ROffset != NULL); + Xil_AssertVoid(GOffset != NULL); + Xil_AssertVoid(BOffset != NULL); + + Data = (s32)(XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_ROFFSET_OFFSET))); + *ROffset = (s32)((Data << + (XCCM_OFFSET_SIGN_SHIFT)) >> (XCCM_OFFSET_SIGN_SHIFT)); + Data = (s32)(XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_GOFFSET_OFFSET))); + *GOffset = (s32)((Data << + (XCCM_OFFSET_SIGN_SHIFT)) >> (XCCM_OFFSET_SIGN_SHIFT)); + Data = (s32)(XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_BOFFSET_OFFSET))); + *BOffset = (s32)((Data << + (XCCM_OFFSET_SIGN_SHIFT)) >> (XCCM_OFFSET_SIGN_SHIFT)); +} + +/*****************************************************************************/ +/** +* +* This function sets the clip value in the Clip register of the CCM core. +* +* @param InstancePtr is a pointer to the CCM instance. +* @param Clip is the maximum output value which needs to be set. +* (Range of Clip value is 0 to 255). +* +* @return None. +* +* @note If Output value greater than this Clip value it will be +* replaced by this Clip value. +* +******************************************************************************/ +void XCcm_SetClip(XCcm *InstancePtr, u32 Clip) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(Clip <= (XCCM_CLIP_LAST)); + + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_CLIP_OFFSET), + (((Clip)) & (XCCM_CLIP_MASK))); +} + +/*****************************************************************************/ +/** +* +* This function gets the clip value from Clip register of the CCM core. +* +* @param InstancePtr is a pointer to the CCM instance. +* +* @return Clip value is returned.(Range is 0 to 255). +* +* @note If Output value greater than this Clip value it will be +* replaced by this Clip value. +* +******************************************************************************/ +u32 XCcm_GetClip(XCcm *InstancePtr) +{ + u32 Value; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + Value = ((XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_CLIP_OFFSET)))) & (XCCM_CLIP_MASK); + + return Value; +} + +/*****************************************************************************/ +/** +* +* This function sets the clamp value in the Clamp register. +* +* @param InstancePtr is a pointer to the CCM instance +* @param Clamp is the minimum output value which needs to be set. +* (Range of Clamping value is 0 to 255). +* +* @return None. +* +* @note If Output value smaller than this Clamp value it will be +* replaced by this value. +* +******************************************************************************/ +void XCcm_SetClamp(XCcm *InstancePtr, u32 Clamp) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(Clamp <= (XCCM_CLAMP_LAST)); + + XCcm_WriteReg(InstancePtr->Config.BaseAddress, (XCCM_CLAMP_OFFSET), + (((Clamp)) & (XCCM_CLAMP_MASK))); +} + +/*****************************************************************************/ +/** +* +* This function returns the clamp value from the Clamp register. +* +* @param InstancePtr is a pointer to the CCM instance. +* +* @return Clamp Value is returned.(Range is 0 to 255). +* +* @note If Output value smaller than this clamp value it will be +* replaced by this value. +* +******************************************************************************/ +u32 XCcm_GetClamp(XCcm *InstancePtr) +{ + u32 Value; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + Value = (XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_CLAMP_OFFSET)) & (XCCM_CLAMP_MASK)); + + return Value; +} + +/*****************************************************************************/ +/** +* +* 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) +{ + /* Verify arguments. */ + 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 XCCM_IXR_* values defined +* in xccm_hw.h. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +static void StubErrCallBack(void *CallBackRef, u32 ErrorMask) +{ + /* Verify arguments. */ + Xil_AssertVoid(ErrorMask != ((u32)0x0)); + (void)CallBackRef; + Xil_AssertVoidAlways(); +} + +/*****************************************************************************/ +/** +* This function converts 18.14 fixed point format numbers to floating point +* numbers. +* +* @param Input is a 32-bit variable which should be given in 18.14 fixed +* point number. +* +* @return Value is returned after converting 18.14 to floating point. +* +* @note None. +* +******************************************************************************/ +static float XCcm_FixedToFloatConv(u32 Input) +{ + float Value; + u32 Sign; + Sign = 0; + /* + * If all bits are 0 except sign bit returning lowest number in the + * given range. + */ + if ((Input & XCCM_COEF_MASK) == XCCM_COEF_SIGN_MASK) { + return (XCCM_COEF_FIRST); + } + /* If number is negative finding 2's compliment of the number */ + if ((Input & XCCM_COEF_SIGN_MASK) != 0) { + Sign = 1; + Input = (Input << XCCM_COEF_SHIFT) >> (XCCM_COEF_SHIFT); + Input = (~Input) + 1; + } + /* Getting integer part */ + Value = (float)((Input & XCCM_COEF_DECI_MASK) >> XCCM_COEF_SHIFT); + /* Getting fractional part */ + Value = Value + + ((float)(Input & XCCM_COEFF_FRAC_MASK) / + (float)(1 << XCCM_COEF_SHIFT)); + if (Sign == 1) { + Value = (Value) * (float)(XCCM_SIGN_MUL); + } + + return Value; +} + +/*****************************************************************************/ +/** +* This function converts floating point numbers to 18.14 fixed point format. +* +* @param Input is a 32-bit variable which should be given in 18.14 fixed +* point number. +* +* @return Value is returned after converting 18.14 to floating point. +* +* @note None. +* +******************************************************************************/ +static s32 XCcm_FloatToFixedConv(float Input) +{ + s32 Value; + /* Multiplying by 16384 times */ + Value = (s32)(Input * (float)(1 << XCCM_COEF_SHIFT)); + /* If number is negative finding 2's compliment */ + if ((Value & XCCM_SIGNBIT_MASK) != 0) { + Value = XCCM_MAX_VALUE + Value + 1; + } + + return Value; +} diff --git a/XilinxProcessorIPLib/drivers/ccm/src/xccm.h b/XilinxProcessorIPLib/drivers/ccm/src/xccm.h new file mode 100755 index 00000000..ea770b91 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/xccm.h @@ -0,0 +1,664 @@ +/****************************************************************************** +* +* (c) Copyright 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 +* 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 xccm.h +* @mainpage ccm +* This header file contains identifiers and register-level driver functions (or +* macros), range macros, structure typedefs that can be used to access the +* Xilinx Color Correction Matrix (CCM) core instance. +* +* The Color Correction Matrix core offers a 3x3 matrix multiplication for a +* variety of color correction applications. +* CCM core provides following features: +* - Fully programmable coefficient matrix. +* - Offset compensation. +* - Clipping and +* - Clamping of the output. +* +* Initialization & Configuration +* +* The device driver enables higher layer software (e.g., an application) to +* communicate to the CCM core. +* +* XCcm_CfgInitialize() API is used to initialize the CCM core. +* The user needs to first call the XCcm_LookupConfig() API which returns +* the Configuration structure pointer which is passed as a parameter to the +* XCcm_CfgInitialize() API. +* +* Interrupts +* +* The driver provides an interrupt handler XCcm_IntrHandler for handling +* the interrupt from the CCM core. The users of this driver have to +* register this handler with the interrupt system and provide the callback +* functions by using XCcm_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 XCcm 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 +* ----- ------ -------- --------------------------------------------------- +* 2.00a jo 05/1/10 Updated for CCM V2.0. +* 3.00a ren 09/11/11 Updated for CCM V3.0. +* 4.00a jj 12/18/12 Converted from xio.h to xil_io.h,translating +* basic types,MB cache functions, exceptions +* and assertions to xil_io format. +* 5.0 adk 19/12/13 Updated as per the New Tcl API's. +* 6.0 adk 03/06/14 Changed file name ccm.h to xccm.h. +* Moved register offsets and bit definitions to +* xccm_hw.h file. +* Defined the following handler types as enum values: +* XCCM_HANDLER_PROCSTART ,XCCM_HANDLER_FRAMEDONE and +* XCCM_HANDLER_ERROR. +* +* Added the following range macros: +* XCCM_VSIZE_FIRST, XCCM_VSIZE_LAST +* XCCM_HSIZE_FIRST, XCCM_HSIZE_LAST +* XCCM_COEF_FIRST,XCCM_COEF_LAST +* XCCM_OFFSET_FIRST,XCCM_OFFSET_LAST +* XCCM_CLAMP_FIRST,XCCM_CLAMP_LAST +* XCCM_CLIP_FIRST,XCCM_CLIP_LAST. +* +* Added the following structure type definitions: +* XCcm_Config and XCcm. +* +* Removed the following functional macros: +* CCM_Enable, CCM_Disable, CCM_RegUpdateEnable +* CCM_RegUpdateDisable, CCM_Reset, CCM_AutoSyncReset +* CCM_ClearReset. +* +* Added the following macros: +* XCcm_Enable, XCcm_Disable,XCcm_RegUpdateEnable, +* XCcm_SyncReset, XCcm_Reset, XCcm_IntrGetPending, +* XCcm_IntrEnable, XCcm_IntrDisable, +* XCcm_StatusGetPending, XCcm_IntrClear, XCcm_Start, +* XCcm_Stop. +* +* Modification history from xccm_hw.h +* First release. +* Added the register offsets and bit masks for the +* registers. +* Added backward compatibility macros. +* +* Modifications in the file xccm.c are: +* Changed filename ccm to xccm.c. +* Implemented the following functions: +* XCcm_CfgInitialize, XCcm_Setup, XCcm_GetVersion, +* XCcm_EnableDbgByPass, XCcm_IsDbgByPassEnabled, +* XCcm_DisableDbgByPass, XCcm_EnableDbgTestPattern, +* XCcm_IsDbgTestPatternEnabled, +* XCcm_DisableDbgTestPattern, XCcm_GetDbgFrameCount, +* XCcm_GetDbgLineCount, XCcm_GetDbgPixelCount, +* XCcm_SetActiveSize, XCcm_GetActiveSize, +* XCcm_SetCoefMatrix, XCcm_GetCoefMatrix, +* XCcm_SetRgbOffset, XCcm_GetRgbOffset, +* XCcm_SetClip, XCcm_GetClip, +* XCcm_SetClamp XCcm_GetClamp XCcm_FloatToFixedConv, +* and XCcm_FixedToFloatConv. +* +* Modifications in the file xccm_selftest.c are: +* Implemented XCcm_SelfTest function. +* +* Modifications in the file xccm_sinit.c are: +* Implemented XCcm_LookupConfig function. +* +* Modifications in the file xccm_intr.c are: +* Implemented the following functions: +* XCcm_IntrHandler +* XCcm_SetCallBack +* +*+* +******************************************************************************/ + +#ifndef XCCM_H_ +#define XCCM_H_ /**< Prevent circular inclusions + * by using protection macros */ +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xccm_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 { + XCCM_HANDLER_PROCSTART = 1, /**< A processing start event interrupt + * type */ + XCCM_HANDLER_FRAMEDONE, /**< A frame done event interrupt type */ + XCCM_HANDLER_ERROR /**< An error condition interrupt type */ +} ; +/*@}*/ + +/** @name Active Size Ranges + * @{ + */ +#define XCCM_ACT_SIZE_FIRST 32 /**< Active Size starting value */ +#define XCCM_ACT_SIZE_LAST 7680 /**< Active Size ending value */ + +/*@}*/ + +/** @name Coefficient ranges + * @{ + */ +#define XCCM_COEF_FIRST -8.0 /**< Coefficient starting + * value */ +#define XCCM_COEF_LAST 8.0 /**< Coefficient ending + * value */ +/*@}*/ + +/** @name Offset ranges + * @{ + */ +#define XCCM_OFFSET_FIRST 0xFFFFFF00 /**< Offset starting value */ +#define XCCM_OFFSET_LAST 255 /**< Offset ending value */ +/*@}*/ + +/** @name Clamp ranges + * @{ + */ +#define XCCM_CLAMP_FIRST 0 /**< Clamp starting value */ +#define XCCM_CLAMP_LAST 255 /**< Clamp ending value */ +/*@}*/ + +/** @name Clip ranges + * @{ + */ +#define XCCM_CLIP_FIRST 0 /**< Clip starting value */ +#define XCCM_CLIP_LAST 255 /**< Clip ending value */ +/*@}*/ + +/***************** Macros (Inline Functions) Definitions *********************/ + +/*****************************************************************************/ +/** +* +* This macro enables the CCM core. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XCcm_Enable(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_Enable(InstancePtr) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET))) | (XCCM_CTL_SW_EN_MASK))) + +/*****************************************************************************/ +/** +* +* This macro disables the CCM core. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XCcm_Disable(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_Disable(InstancePtr) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET))) & (~(XCCM_CTL_SW_EN_MASK)))) + +/*****************************************************************************/ +/** +* +* This macro enables/starts the CCM core. +* +* @param InstancePtr is a pointer to the XCcm instance to be +* worked on +* +* @return None. +* +* @note C-style signature: +* void XCcm_Start(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_Start XCcm_Enable + +/*****************************************************************************/ +/** +* +* This macro disables/stops the CCM core. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on +* +* @return None. +* +* @note C-style signature: +* void XCcm_Stop(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_Stop XCcm_Disable + +/*****************************************************************************/ +/** +* +* This macro commits all the register value changes made so far by +* the software to the CCM core instance. +* +* This macro only works when the CCM core is enabled. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XCcm_RegUpdateEnable(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_RegUpdateEnable(InstancePtr) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET))) | (XCCM_CTL_RUE_MASK))) + +/*****************************************************************************/ +/** +* +* This macro prevents the CCM core instance from committing recent +* changes made so far by the software. When disabled, changes to other +* configuration registers are stored, but do not effect the behavior of the +* core. +* +* This macro only works when the CCM core is enabled. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XCcm_RegUpdateDisable(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_RegUpdateDisable(InstancePtr) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET))) & (~(XCCM_CTL_RUE_MASK)))) + +/*****************************************************************************/ +/** +* +* This macro resets a CCM core at the end of the frame being +* processed. It enables core automatically synchronizes to the SOF of the core +* to prevent image tearing. This macro is differ from XCcm_Reset(). +* +* On the next rising-edge of SOF following a call to XCcm_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 XCcm instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XCcm_SyncReset(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_SyncReset(InstancePtr) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + (XCCM_CTL_AUTORESET_MASK)) + +/*****************************************************************************/ +/** +* +* This macro resets a CCM core. This reset effects the core +* immediately and may cause image tearing. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XCcm_Reset(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_Reset(InstancePtr) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_CONTROL_OFFSET), \ + (XCCM_CTL_RESET_MASK)) + +/*****************************************************************************/ +/** +* +* This macro enables individual interrupts of the CCM core by updating +* the IRQ_ENABLE register. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* @param IntrType is the type of the interrupts to enable. Use OR'ing of +* XCCM_IXR_*_MASK constants defined in xccm_hw.h to create this +* parameter value. +* +* @return None. +* +* @note The existing enabled interrupt(s) will remain enabled. +* C-style signature: +* void XCcm_IntrEnable(XCcm *InstancePtr, u32 IntrType) +* +******************************************************************************/ +#define XCcm_IntrEnable(InstancePtr, IntrType) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET), \ + (((IntrType) & (XCCM_IXR_ALLINTR_MASK)) | \ + (XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET))))) + +/*****************************************************************************/ +/** +* +* This macro disables individual interrupts of the CCM core by +* updating the IRQ_ENABLE register. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* @param IntrType is the type of the interrupts to disable. Use OR'ing +* of XCCM_IXR_*_MASK constants defined in xccm_hw.h to create +* this parameter value. +* +* @return None. +* +* @note Any other interrupt not covered by parameter IntrType, +* if enabled before this macro is called, will remain enabled. +* C-style signature: +* void XCcm_IntrDisable(XCcm *InstancePtr, u32 IntrType) +* +******************************************************************************/ +#define XCcm_IntrDisable(InstancePtr, IntrType) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET), \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET))) & ((~(IntrType)) & \ + (XCCM_IXR_ALLINTR_MASK)))) + +/*****************************************************************************/ +/** +* +* This macro returns the pending interrupt status of the CCM core +* by reading from Status register. +* +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return The pending interrupts of the CCM. Use XCCM_IXR_*_MASK +* constants defined in xccm_hw.h to interpret this value. +* +* @note C-style signature: +* u32 XCcm_StatusGetPending(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_StatusGetPending(InstancePtr) \ + XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_STATUS_OFFSET)) & (XCCM_IXR_ALLINTR_MASK) + +/*****************************************************************************/ +/** +* +* This macro returns the pending interrupts of the CCM core for the +* interrupts that have been enabled. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* +* @return The pending interrupts of the CCM. Use XCCM_IXR_*_MASK +* constants defined in xccm_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 XCcm_IntrGetPending(XCcm *InstancePtr) +* +******************************************************************************/ +#define XCcm_IntrGetPending(InstancePtr) \ + XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_IRQ_EN_OFFSET)) & \ + ((XCcm_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_STATUS_OFFSET))) & (XCCM_IXR_ALLINTR_MASK)) + +/*****************************************************************************/ +/** +* +* This macro clears/acknowledges pending interrupts of the CCM core +* in the Status register. Bit positions to 1 will be cleared. +* +* @param InstancePtr is a pointer to the XCcm instance to be worked on. +* @param IntrType is the pending interrupts to clear/acknowledge. +* Use OR'ing of XCCM_IXR_*_MASK constants defined in xccm_hw.h to +* create this parameter value. +* +* @return None. +* +* @note C-style signature: +* void XCcm_IntrClear(XCcm *InstancePtr, u32 IntrType) +* +******************************************************************************/ +#define XCcm_IntrClear(InstancePtr, IntrType) \ + XCcm_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XCCM_STATUS_OFFSET), ((IntrType) & (XCCM_IXR_ALLINTR_MASK))) + +/**************************** Type Definitions *******************************/ + +/** +* This typedef contains configuration information for a CCM core. +* Each CCM core should have a configuration structure associated. +*/ +typedef struct { + u16 DeviceId; /**< DeviceId is the unique ID of the + * device */ + u32 BaseAddress; /**< BaseAddress is the physical base address + * of the device's registers */ + u32 SlaveAxisVideoFormat; /**< Slave Axis Video Format */ + u32 MasterAxisVideoFormat; /**< Master Axis Video Format */ + u32 MaxColumns; /**< Maximum Columns */ + u32 ActiveColumns; /**< Active Columns */ + u32 ActiveRows; /**< Active rows */ + u16 HasDebug; /**< Has Debug GUI specified */ + u16 HasIntcIf; /**< Has Interrupt Control */ + u16 Clip; /**< Clip value */ + u16 Clamp; /**< Clamp value */ + u32 K11; /**< Element of Coefficient matrix */ + u32 K12; /**< Element of Coefficient matrix */ + u32 K13; /**< Element of Coefficient matrix */ + u32 K21; /**< Element of Coefficient matrix */ + u32 K22; /**< Element of Coefficient matrix */ + u32 K23; /**< Element of Coefficient matrix */ + u32 K31; /**< Element of Coefficient matrix */ + u32 K32; /**< Element of Coefficient matrix */ + u32 K33; /**< Element of Coefficient matrix */ + u32 ROffset; /**< Red color offset value */ + u32 GOffset; /**< Green color offset value */ + u32 BOffset; /**< Blue color offset value */ + u32 SlaveAxiClkFreqHz; /**< Slave Clock Frequency in Hz */ +} XCcm_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. +*/ +typedef void (*XCcm_CallBack)(void *CallBackRef); + +/******************************************************************************/ +/** +* +* Callback type for 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. +* @param ErrorMask is a bit mask indicating the cause of the error. Its +* value equals 'OR'ing one or more XCCM_IXR_*_MASK values defined +* in xccm_hw.h. +*/ +typedef void (*XCcm_ErrorCallBack)(void *CallBackRef, u32 ErrorMask); + +/******************************************************************************/ +/** +* +* The XCcm 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 { + XCcm_Config Config; /**< Hardware configuration */ + u32 IsReady; /**< Device and the driver instance + * are initialized */ + u16 HSize; /**< Active Video Horizontal Size */ + u16 VSize; /**< Active Video Vertical Size */ + + /* IRQ Callbacks */ + XCcm_CallBack ProcStartCallBack;/**< Call back for Processing + * Start interrupt */ + void *ProcStartRef; /**< To be passed to the Process Start + * interrupt callback */ + XCcm_CallBack FrameDoneCallBack;/**< Call back for Frame Done + * interrupt */ + void *FrameDoneRef; /**< To be passed to the Frame Done + * interrupt callback */ + XCcm_ErrorCallBack ErrCallBack; /**< Call back for Error interrupt */ + void *ErrRef; /**< To be passed to the Error + * interrupt callback */ +} XCcm; + +/** +* This typedef contains matrix coefficients of Color Correction Matrix(CCM) +* core which can be accessed for setting coefficients by using XCcm_SetCoefMatrix +* and for getting coefficient values by using XCcm_GetCoefMatrix. +*/ +typedef struct { + float K11; /**< Matrix Coefficient */ + float K12; /**< Matrix Coefficient */ + float K13; /**< Matrix Coefficient */ + float K21; /**< Matrix Coefficient */ + float K22; /**< Matrix Coefficient */ + float K23; /**< Matrix Coefficient */ + float K31; /**< Matrix Coefficient */ + float K32; /**< Matrix Coefficient */ + float K33; /**< Matrix Coefficient */ +} XCcm_Coefs; + +/************************** Function Prototypes ******************************/ + + /* Initialization functions in xccm_sinit.c */ +XCcm_Config *XCcm_LookupConfig(u16 DeviceId); + + /* Initialization and control functions implemented in xccm.c */ +int XCcm_CfgInitialize(XCcm *InstancePtr, XCcm_Config *CfgPtr, + u32 EffectiveAddr); +u32 XCcm_GetVersion(XCcm *InstancePtr); +void XCcm_Setup(XCcm *InstancePtr); +void XCcm_EnableDbgByPass(XCcm *InstancePtr); +int XCcm_IsDbgByPassEnabled(XCcm *InstancePtr); +void XCcm_DisableDbgByPass(XCcm *InstancePtr); +void XCcm_EnableDbgTestPattern(XCcm *InstancePtr); +int XCcm_IsDbgTestPatternEnabled(XCcm *InstancePtr); +void XCcm_DisableDbgTestPattern(XCcm *InstancePtr); +u32 XCcm_GetDbgFrameCount(XCcm *InstancePtr); +u32 XCcm_GetDbgLineCount(XCcm *InstancePtr); +u32 XCcm_GetDbgPixelCount(XCcm *InstancePtr); +void XCcm_SetActiveSize(XCcm *InstancePtr, u16 HSize, u16 VSize); +void XCcm_GetActiveSize(XCcm *InstancePtr, u16 *HSize, u16 *VSize); +void XCcm_SetCoefMatrix(XCcm *InstancePtr, XCcm_Coefs *CoefValues); +void XCcm_GetCoefMatrix(XCcm *InstancePtr, XCcm_Coefs *CoefValues); +void XCcm_SetRgbOffset(XCcm *InstancePtr, s32 ROffset, s32 GOffset, + s32 BOffset); +void XCcm_GetRgbOffset(XCcm *InstancePtr, s32 *ROffset, s32 *GOffset, + s32 *BOffset); +void XCcm_SetClip(XCcm *InstancePtr, u32 Clip); +u32 XCcm_GetClip(XCcm *InstancePtr); +void XCcm_SetClamp(XCcm *InstancePtr, u32 Clamp); +u32 XCcm_GetClamp(XCcm *InstancePtr); + +/* Self - Test function implemented in xccm_selftest.c */ +int XCcm_SelfTest(XCcm *InstancePtr); + +/* Interrupt related functions implemented in xccm_intr.c */ +void XCcm_IntrHandler(void *InstancePtr); +int XCcm_SetCallBack(XCcm *InstancePtr, u32 HandlerType, + void *CallBackFunc, void *CallBackRef); + +/************************** Variable Declarations ****************************/ + + +#ifdef __cplusplus +} + +#endif + +#endif /* End of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/ccm/src/xccm_g.c b/XilinxProcessorIPLib/drivers/ccm/src/xccm_g.c new file mode 100755 index 00000000..30813d5c --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/xccm_g.c @@ -0,0 +1,53 @@ + +/******************************************************************* +* +* 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 "xccm.h" + +/* +* The configuration table for devices +*/ + +XCcm_Config XCcm_ConfigTable[] = +{ + { + XPAR_FMC_SENSOR_INPUT_V_CCM_1_DEVICE_ID, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_BASEADDR, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_S_AXIS_VIDEO_FORMAT, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_M_AXIS_VIDEO_FORMAT, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_MAX_COLS, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_ACTIVE_COLS, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_ACTIVE_ROWS, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_HAS_DEBUG, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_HAS_INTC_IF, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_CLIP, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_CLAMP, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K11, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K12, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K13, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K21, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K22, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K23, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K31, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K32, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_K33, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_ROFFSET, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_GOFFSET, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_BOFFSET, + XPAR_FMC_SENSOR_INPUT_V_CCM_1_S_AXI_CLK_FREQ_HZ + } +}; + + diff --git a/XilinxProcessorIPLib/drivers/ccm/src/xccm_hw.h b/XilinxProcessorIPLib/drivers/ccm/src/xccm_hw.h new file mode 100755 index 00000000..f3fcd36c --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/xccm_hw.h @@ -0,0 +1,299 @@ +/****************************************************************************** +* +* (c) Copyright 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 xccm_hw.h +* +* This header file contains identifiers and register-level driver functions (or +* macros) that can be used to access the Xilinx Color Correction Matrix (CCM) +* core. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------- -------- ------------------------------------------------------- +* 6.0 adk 03/06/14 First release. +* Added the register offsets and bit masks for the +* registers. +* Added backward compatibility macros. +*+* +******************************************************************************/ + +#ifndef XCCM_HW_H_ +#define XCCM_HW_H_ /**< Prevent circular inclusions + * by using protection macros */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xil_io.h" + +/************************** Constant Definitions *****************************/ + +/** @name Registers offsets + * @{ + */ +#define XCCM_CONTROL_OFFSET 0x000 /**< Control offset */ +#define XCCM_STATUS_OFFSET 0x004 /**< Status offset */ +#define XCCM_ERROR_OFFSET 0x008 /**< Error offset */ +#define XCCM_IRQ_EN_OFFSET 0x00C /**< IRQ Enable offset */ +#define XCCM_VERSION_OFFSET 0x010 /**< Version offset */ +#define XCCM_SYSDEBUG0_OFFSET 0x014 /**< System Debug 0 offset */ +#define XCCM_SYSDEBUG1_OFFSET 0x018 /**< System Debug 1 offset */ +#define XCCM_SYSDEBUG2_OFFSET 0x01C /**< System Debug 2 offset */ +#define XCCM_ACTIVE_SIZE_OFFSET 0x020 /**< Active Size (V x H) offset */ + +#define XCCM_K11_OFFSET 0x100 /**< K11 Coefficient offset */ +#define XCCM_K12_OFFSET 0x104 /**< K12 Coefficient offset */ +#define XCCM_K13_OFFSET 0x108 /**< K13 Coefficient offset */ +#define XCCM_K21_OFFSET 0x10C /**< K21 Coefficient offset */ +#define XCCM_K22_OFFSET 0x110 /**< K22 Coefficient offset */ +#define XCCM_K23_OFFSET 0x114 /**< K23 Coefficient offset */ +#define XCCM_K31_OFFSET 0x118 /**< K31 Coefficient offset */ +#define XCCM_K32_OFFSET 0x11C /**< K32 Coefficient offset */ +#define XCCM_K33_OFFSET 0x120 /**< K33 Coefficient offset */ +#define XCCM_ROFFSET_OFFSET 0x124 /**< Red Offset offset */ +#define XCCM_GOFFSET_OFFSET 0x128 /**< Green Offset offset */ +#define XCCM_BOFFSET_OFFSET 0x12C /**< Blue Offset offset */ +#define XCCM_CLIP_OFFSET 0x130 /**< Clip Offset offset */ +#define XCCM_CLAMP_OFFSET 0x134 /**< Clamp Offset offset */ +/*@}*/ + +/** @name Control register bit masks + * @{ + */ +#define XCCM_CTL_SW_EN_MASK 0x00000001 /**< Enable mask */ +#define XCCM_CTL_RUE_MASK 0x00000002 /**< Register Update Enable + * mask */ +#define XCCM_CTL_BPE_MASK 0x00000010 /**< Bypass Enable mask */ +#define XCCM_CTL_TPE_MASK 0x00000020 /**< Test Pattern Enable + * mask */ +#define XCCM_CTL_AUTORESET_MASK 0x40000000 /**< Software Auto Reset + * mask */ +#define XCCM_CTL_RESET_MASK 0x80000000 /**< Software Reset mask */ +/*@}*/ + +/** @name Interrupt register bit masks. It is applicable for + * Status and IRQ_ENABLE Registers + * @{ + */ +#define XCCM_IXR_PROCS_STARTED_MASK 0x00000001 /**< Process Started mask */ +#define XCCM_IXR_EOF_MASK 0x00000002 /**< End-Of-Frame mask */ +#define XCCM_IXR_SE_MASK 0x00010000 /**< Slave Error mask */ +#define XCCM_IXR_ALLINTR_MASK 0x00010003 /**< Interrupt all error mask + * (ORing of all interrupt + * mask) */ +/*@}*/ + +/** @name Error register bit masks + * @{ + */ +#define XCCM_ERR_EOL_EARLY_MASK 0x00000001 /**< End of Line Early mask */ +#define XCCM_ERR_EOL_LATE_MASK 0x00000002 /**< End of Line Late mask */ +#define XCCM_ERR_SOF_EARLY_MASK 0x00000004 /**< Start of Frame Early + * mask */ +#define XCCM_ERR_SOF_LATE_MASK 0x00000008 /**< Start of Frame Late + * mask */ +/*@}*/ + +/** @name Version register bit masks and shifts + * @{ + */ +#define XCCM_VER_REV_NUM_MASK 0x000000FF /**< Version Revision Number + * mask */ +#define XCCM_VER_PID_MASK 0x00000F00 /**< Version Patch ID mask */ +#define XCCM_VER_REV_MASK 0x0000F000 /**< Version Revision mask */ +#define XCCM_VER_MINOR_MASK 0x00FF0000 /**< Version Minor mask */ +#define XCCM_VER_MAJOR_MASK 0xFF000000 /**< Version Major mask */ +#define XCCM_VER_INTERNAL_SHIFT 0x00000008 /**< Version Internal shift */ +#define XCCM_VER_REV_SHIFT 0x0000000C /**< Version Revision shift */ +#define XCCM_VER_MINOR_SHIFT 0x00000010 /**< Version Minor shift */ +#define XCCM_VER_MAJOR_SHIFT 0x00000018 /**< Version Major shift */ +/*@}*/ + +/** @name Active Size register masks and shift + * @{ + */ +#define XCCM_ACTSIZE_NUM_PIXEL_MASK 0x00001FFF /**< Number of Active pixels + * per scan line (horizontal) + * mask */ +#define XCCM_ACTSIZE_NUM_LINE_MASK 0x1FFF0000 /**< Number of Active lines per + * frame (vertical) mask */ +#define XCCM_ACTSIZE_NUM_LINE_SHIFT 16 /**< Shift for number of + * lines */ +/*@}*/ + +/** @name Matrix coefficient masks and shifts + * @{ + */ +#define XCCM_COEF_MASK 0x0003FFFF /**< Matrix Coefficient mask */ +#define XCCM_COEF_DECI_MASK 0x0001C000 /**< Mask of Decimal part */ +#define XCCM_COEFF_FRAC_MASK 0x00003FFF /**< Mask of Fractional part */ +#define XCCM_COEF_SHIFT 14 /**< Coefficient shift */ +#define XCCM_COEF_SIGN_MASK 0x20000 /**< Mask for sign bit */ + +/*@}*/ + +/** @name Offsets masks and shifts + * @{ + */ +#define XCCM_OFFSET_MASK 0x0001FFFF /**< Offset mask for Red, Green + * Blue Offset registers */ +#define XCCM_OFFSET_SIGN_SHIFT 15 /**< Shift for signed bit */ +/*@}*/ + +/** @name Clip and Clamp masks + * @{ + */ +#define XCCM_CLIP_MASK 0x0000FFFF /**< Clip register mask */ +#define XCCM_CLAMP_MASK 0x0000FFFF /**< Clamp register mask */ +/*@}*/ + +/** @name General purpose macros + * @{ + */ +#define XCCM_SIGN_MUL -1 /**< Macro for sign + * multiplication */ +#define XCCM_MAX_VALUE 0xFFFFFFFF /**< 32 bit maximum value */ +#define XCCM_SIGNBIT_MASK 0x10000000 /** Mask for sign bit of 32 + * bit number */ +/*@}*/ + +/** @name Macros for backward compatibility + * @{ + */ +#define CCM_CONTROL XCCM_CONTROL_OFFSET +#define CCM_STATUS XCCM_STATUS_OFFSET +#define CCM_ERROR XCCM_ERROR_OFFSET +#define CCM_IRQ_EN XCCM_IRQ_EN_OFFSET +#define CCM_VERSION XCCM_VERSION_OFFSET +#define CCM_SYSDEBUG0 XCCM_SYSDEBUG0_OFFSET +#define CCM_SYSDEBUG1 XCCM_SYSDEBUG1_OFFSET +#define CCM_SYSDEBUG2 XCCM_SYSDEBUG2_OFFSET +#define CCM_ACTIVE_SIZE XCCM_ACTIVE_SIZE_OFFSET +#define CCM_K11 XCCM_K11_OFFSET +#define CCM_K12 XCCM_K12_OFFSET +#define CCM_K13 XCCM_K13_OFFSET +#define CCM_K21 XCCM_K21_OFFSET +#define CCM_K22 XCCM_K22_OFFSET +#define CCM_K23 XCCM_K23_OFFSET +#define CCM_K31 XCCM_K31_OFFSET +#define CCM_K32 XCCM_K32_OFFSET +#define CCM_K33 XCCM_K33_OFFSET +#define CCM_ROFFSET XCCM_ROFFSET_OFFSET +#define CCM_GOFFSET XCCM_GOFFSET_OFFSET +#define CCM_BOFFSET XCCM_BOFFSET_OFFSET +#define CCM_CLIP XCCM_CLIP_OFFSET +#define CCM_CLAMP XCCM_CLAMP_OFFSET +#define CCM_CTL_EN_MASK XCCM_CTL_SW_EN_MASK +#define CCM_CTL_RUE_MASK XCCM_CTL_RUE_MASK +#define CCM_RST_RESET XCCM_CTL_RESET_MASK +#define CCM_RST_AUTORESET XCCM_CTL_AUTORESET_MASK +#define CCM_In32 XCcm_In32 +#define CCM_Out32 XCcm_Out32 +#define XCCM_ReadReg XCcm_ReadReg +#define XCCM_WriteReg XCcm_WriteReg +/*@}*/ + +/** @name Interrupt Enable and Status Registers Offsets + * @{ + */ +/** +* Interrupt status register generates a interrupt if the corresponding bits of +* interrupt enable register bits are set. +*/ +#define XCCM_ISR_OFFSET XCCM_STATUS_OFFSET + /**< Interrupt status offset */ +#define XCCM_IER_OFFSET XCCM_IRQ_EN_OFFSET + /**< Interrupt enable Offset */ +/*@}*/ +/***************** Macros (Inline Functions) Definitions *********************/ + +#define XCcm_In32 Xil_In32 /**< Input operation */ +#define XCcm_Out32 Xil_Out32 /**< Output operation */ + +/*****************************************************************************/ +/** +* +* This macro reads the given register. +* +* @param BaseAddress is the Xilinx base address of the CCM core. +* @param RegOffset is the register offset of the register. +* +* @return The 32-bit value of the register. +* +* @note C-style signature: +* u32 XCcm_ReadReg(u32 BaseAddress, u32 RegOffset) +* +******************************************************************************/ +#define XCcm_ReadReg(BaseAddress, RegOffset) \ + XCcm_In32((BaseAddress) + (u32)(RegOffset)) + +/*****************************************************************************/ +/** +* +* This macro writes the given register. +* +* @param BaseAddress is the Xilinx base address of the CCM core. +* @param RegOffset is the register offset of the register. +* @param Data is the 32-bit value to write to the register. +* +* @return None. +* +* @note C-style signature: +* void XCcm_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data) +* +******************************************************************************/ +#define XCcm_WriteReg(BaseAddress, RegOffset, Data) \ + XCcm_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data)) + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Declarations ****************************/ + + +#ifdef __cplusplus +} + +#endif + +#endif /* End of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/ccm/src/xccm_intr.c b/XilinxProcessorIPLib/drivers/ccm/src/xccm_intr.c new file mode 100755 index 00000000..543ae4d5 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/xccm_intr.c @@ -0,0 +1,211 @@ +/****************************************************************************** +* +* (c) Copyright 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 xccm_intr.c +* +* This file contains interrupt related functions of Xilinx CCM core. +* Please see xccm.h for more details of the driver. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------- -------- ------------------------------------------------------ +* 6.0 adk 03/06/14 First release. +* Implemented the following functions: +* XCcm_IntrHandler and XCcm_SetCallBack. +* +*+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xccm.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function is the interrupt handler for the CCM core. +* +* This handler reads the pending interrupt from Status register, +* determines the source of the interrupts and calls the respective +* callbacks for the interrupts that are enabled in IRQ_ENABLE register, +* 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 +* XCcm_SetCallBack() during initialization phase. . +* +* @param InstancePtr is a pointer to the XCcm instance that just +* interrupted. +* +* @return None. +* +* @note Interrupt interface should be enabled. +* +******************************************************************************/ +void XCcm_IntrHandler(void *InstancePtr) +{ + u32 PendingIntr; + u32 ErrorStatus; + XCcm *XCcmPtr = NULL; + XCcmPtr = (XCcm *)((void *)InstancePtr); + + /* Verify arguments. */ + Xil_AssertVoid(XCcmPtr != NULL); + Xil_AssertVoid(XCcmPtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid(XCcmPtr->Config.HasIntcIf != (u16)0x0); + + /* Get pending interrupts */ + PendingIntr = (u32)(XCcm_IntrGetPending(XCcmPtr)); + + /* A Slave error interrupt has happened */ + if (((PendingIntr) & (XCCM_IXR_SE_MASK)) == (XCCM_IXR_SE_MASK)) { + ErrorStatus = (PendingIntr) & (XCCM_IXR_SE_MASK); + XCcmPtr->ErrCallBack(XCcmPtr->ErrRef, ErrorStatus); + + } + + /* A processing start has happened */ + if (((PendingIntr) & (XCCM_IXR_PROCS_STARTED_MASK)) == + (XCCM_IXR_PROCS_STARTED_MASK)) { + XCcmPtr->ProcStartCallBack(XCcmPtr->ProcStartRef); + } + + /* A frame done interrupt has happened */ + if (((PendingIntr) & (XCCM_IXR_EOF_MASK)) == + (XCCM_IXR_EOF_MASK)) { + XCcmPtr->FrameDoneCallBack(XCcmPtr->FrameDoneRef); + } + + /* Clear pending interrupt(s) */ + XCcm_IntrClear(XCcmPtr, PendingIntr); +} + +/*****************************************************************************/ +/** +* +* This routine installs an asynchronous callback function for the given +* HandlerType. +* +*
+* HandlerType Callback Function Type +* ----------------------- -------------------------------------------------- +* XCCM_HANDLER_FRAMEDONE FrameDoneCallBack +* XCCM_HANDLER_PROCSTART ProcStartCallBack +* XCCM_HANDLER_ERROR ErrCallBack +* +*+* +* @param InstancePtr is a pointer to the Xccm 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 XCcm_SetCallBack(XCcm *InstancePtr, u32 HandlerType, + void *CallBackFunc, void *CallBackRef) +{ + int Status; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(CallBackFunc != NULL); + Xil_AssertNonvoid(CallBackRef != NULL); + Xil_AssertNonvoid((HandlerType >= XCCM_HANDLER_PROCSTART) && + (HandlerType <= XCCM_HANDLER_ERROR)); + Xil_AssertNonvoid(InstancePtr->IsReady == + (u32)(XIL_COMPONENT_IS_READY)); + + /* + * Calls the respective callback function corresponding to + * the handler type + */ + switch (HandlerType) { + case XCCM_HANDLER_PROCSTART: + InstancePtr->ProcStartCallBack = + (XCcm_CallBack)((void *)CallBackFunc); + InstancePtr->ProcStartRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + case XCCM_HANDLER_FRAMEDONE: + InstancePtr->FrameDoneCallBack = + (XCcm_CallBack)((void *)CallBackFunc); + InstancePtr->FrameDoneRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + case XCCM_HANDLER_ERROR: + InstancePtr->ErrCallBack = + (XCcm_ErrorCallBack)((void *)CallBackFunc); + InstancePtr->ErrRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + default: + Status = (XST_INVALID_PARAM); + break; + + } + + return Status; +} diff --git a/XilinxProcessorIPLib/drivers/ccm/src/ccm.c b/XilinxProcessorIPLib/drivers/ccm/src/xccm_selftest.c similarity index 55% rename from XilinxProcessorIPLib/drivers/ccm/src/ccm.c rename to XilinxProcessorIPLib/drivers/ccm/src/xccm_selftest.c index 0ef6f8a4..7a6a8c4d 100755 --- a/XilinxProcessorIPLib/drivers/ccm/src/ccm.c +++ b/XilinxProcessorIPLib/drivers/ccm/src/xccm_selftest.c @@ -1,6 +1,6 @@ /****************************************************************************** * -* Copyright (C) 2011 - 2014 Xilinx, Inc. All rights reserved. +* (c) Copyright 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 @@ -29,36 +29,80 @@ * this Software without prior written authorization from Xilinx. * ******************************************************************************/ - /*****************************************************************************/ /** * -* @file ccm.c +* @file xccm_selftest.c * -* This is main code of Xilinx Color Correction Matrix (CCM) -* device driver. Please see ccm.h for more details of the driver. +* This file contains the self-test functions for the CCM core. * +*
* MODIFICATION HISTORY: * -* Ver Who Date Changes -* ----- ---- -------- ------------------------------------------------------- -* 2.00a jo 05/1/10 Updated for CCM V2.0 -* 3.00a ren 09/11/11 Updated for CCM v3.0 -* 4.00a jj 12/18/12 Converted from xio.h to xil_io.h,translating -* basic types,MB cache functions, exceptions -* and assertions to xil_io format +* Ver Who Date Changes +* ----- ------- -------- ---------------------------------------------- +* 6.0 adk 03/06/14 First Release. +* Implemented XCcm_SelfTest function. +* +*+* ******************************************************************************/ /***************************** Include Files *********************************/ -#include "ccm.h" -#include "xenv.h" +#include "xccm.h" +#include "xstatus.h" + +/************************** Constant Definitions *****************************/ +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ /*****************************************************************************/ -// Note: All functions are currently implemented as high-performance macros -// within ccm.h -/*****************************************************************************/ +/** +* +* This function reads Version register of CCM core and compares with zero +* as part of self test. +* +* @param InstancePtr is a pointer to XCcm instance. +* +* @return +* - XST_SUCCESS if the test is successful. +* - XST_FAILURE if the test is failed. +* +* @note None. +* +******************************************************************************/ +int XCcm_SelfTest(XCcm *InstancePtr) +{ + u32 Version; + int Status; + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Version = XCcm_ReadReg(InstancePtr->Config.BaseAddress, + (XCCM_VERSION_OFFSET)); + + /* Compare version with zero */ + if (Version != (u32)0x0) { + Status = (XST_SUCCESS); + } + else { + Status = (XST_FAILURE); + } + + return Status; +} diff --git a/XilinxProcessorIPLib/drivers/ccm/src/xccm_sinit.c b/XilinxProcessorIPLib/drivers/ccm/src/xccm_sinit.c new file mode 100755 index 00000000..4e0dd000 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/xccm_sinit.c @@ -0,0 +1,106 @@ +/****************************************************************************** +* +* (c) Copyright 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 xccm_sinit.c +* +* This file contains static initialization methods for Xilinx CCM core. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ------- -------- -------------------------------------------------- +* 6.0 adk 03/06/14 First release. +* Implemented XCcm_LookupConfig function. +* +*+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xccm.h" +#include "xparameters.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* XCcm_LookupConfig returns a reference to an XCcm_Config structure +* based on the unique device id, DeviceId. The return value will refer +* to an entry in the device configuration table defined in the xccm_g.c +* file. +* +* @param DeviceId is the unique device ID of the device for the lookup +* operation. +* +* @return CfgPtr is a reference to a config record in the configuration +* table (in xccm_g.c) corresponding to DeviceId, or NULL +* if no match is found. +* +* @note None. +******************************************************************************/ +XCcm_Config *XCcm_LookupConfig(u16 DeviceId) +{ + extern XCcm_Config XCcm_ConfigTable[XPAR_CCM_NUM_INSTANCES]; + XCcm_Config *CfgPtr = NULL; + u32 Index; + + /* Checks all the instances */ + for (Index = (u32)0x0; Index < (u32)(XPAR_CCM_NUM_INSTANCES); + Index++) { + if (XCcm_ConfigTable[Index].DeviceId == DeviceId) { + CfgPtr = &XCcm_ConfigTable[Index]; + break; + } + } + + return (XCcm_Config *)CfgPtr; +}