diff --git a/XilinxProcessorIPLib/drivers/ccm/data/ccm.mdd b/XilinxProcessorIPLib/drivers/ccm/data/ccm.mdd new file mode 100755 index 00000000..61852fca --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/data/ccm.mdd @@ -0,0 +1,45 @@ +############################################################################### +# +# 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. +# +############################################################################### + +OPTION psf_version = 2.1; + +BEGIN driver ccm + + OPTION supported_peripherals = (v_ccm); + OPTION driver_state = ACTIVE; + OPTION copyfiles = all; + OPTION VERSION = 6.0; + OPTION NAME = ccm; + +END driver + + diff --git a/XilinxProcessorIPLib/drivers/ccm/data/ccm.tcl b/XilinxProcessorIPLib/drivers/ccm/data/ccm.tcl new file mode 100755 index 00000000..f5d6ef26 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/data/ccm.tcl @@ -0,0 +1,37 @@ +############################################################################### +# +# 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. +# +############################################################################### + +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_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" +} diff --git a/XilinxProcessorIPLib/drivers/ccm/examples/example.c b/XilinxProcessorIPLib/drivers/ccm/examples/example.c new file mode 100755 index 00000000..10c55f35 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/examples/example.c @@ -0,0 +1,176 @@ +/****************************************************************************** +* +* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ + +/*****************************************************************************/ +/** + * + * @file example.c + * + * This file demonstrates how to use Xilinx Color Correction Matrix (CCM) + * driver on Xilinx Color Correction Matrix (CCM) core. This code does not + * cover the Xilinx TimeBase setup and any other configuration which might be + * required to get the CCM device working properly. + * + *
+ * 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 new file mode 100755 index 00000000..b14a56e7 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/examples/index.html @@ -0,0 +1,17 @@ + + + + + +
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.
+ + \ No newline at end of file diff --git a/XilinxProcessorIPLib/drivers/ccm/src/Makefile b/XilinxProcessorIPLib/drivers/ccm/src/Makefile new file mode 100755 index 00000000..3d75e2ae --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/Makefile @@ -0,0 +1,29 @@ +COMPILER= +ARCHIVER= +CP=cp +COMPILER_FLAGS= +EXTRA_COMPILER_FLAGS= +LIB=libxil.a +LEVEL=0 + +RELEASEDIR=../../../lib +INCLUDEDIR=../../../include +INCLUDES=-I./. -I${INCLUDEDIR} + +INCLUDEFILES=*.h +LIBSOURCES=*.c + +OUTS = *.o + +libs: + echo "Compiling ccm" + $(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $(LIBSOURCES) + $(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OUTS} + make clean + +include: + ${CP} $(INCLUDEFILES) $(INCLUDEDIR) + +clean: + rm -rf ${OUTS} + diff --git a/XilinxProcessorIPLib/drivers/ccm/src/ccm.c b/XilinxProcessorIPLib/drivers/ccm/src/ccm.c new file mode 100755 index 00000000..0ef6f8a4 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/ccm.c @@ -0,0 +1,64 @@ +/****************************************************************************** +* +* 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.c +* +* This is main code of Xilinx Color Correction Matrix (CCM) +* device driver. Please see ccm.h for more details of the driver. +* +* 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 +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "ccm.h" +#include "xenv.h" + + + +/*****************************************************************************/ +// Note: All functions are currently implemented as high-performance macros +// within ccm.h +/*****************************************************************************/ + + diff --git a/XilinxProcessorIPLib/drivers/ccm/src/ccm.h b/XilinxProcessorIPLib/drivers/ccm/src/ccm.h new file mode 100755 index 00000000..ad555784 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/ccm/src/ccm.h @@ -0,0 +1,312 @@ +/****************************************************************************** +* +* 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 */