diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/data/deinterlacer.mdd b/XilinxProcessorIPLib/drivers/deinterlacer/data/deinterlacer.mdd new file mode 100755 index 00000000..a2673bdc --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/data/deinterlacer.mdd @@ -0,0 +1,44 @@ +############################################################################### +# +# Copyright (C) 2008 - 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 deinterlacer + + OPTION supported_peripherals = (v_deinterlacer); + OPTION driver_state = ACTIVE; + OPTION copyfiles = all; + OPTION VERSION = 3.2; + OPTION NAME = deinterlacer; + +END driver + + diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/data/deinterlacer.tcl b/XilinxProcessorIPLib/drivers/deinterlacer/data/deinterlacer.tcl new file mode 100755 index 00000000..e54f8a79 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/data/deinterlacer.tcl @@ -0,0 +1,46 @@ +############################################################################### +# +# 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. +# +############################################################################### +# +# Modification History +# Ver Who Date Changes +# -------- ------ -------- ---------------------------------------------------- +# 3.0 adk 10/12/13 Updated as per the New Tcl API's +################################################################################# + + +proc generate {drv_handle} { + xdefine_include_file $drv_handle "xparameters.h" "XDEINT" "NUM_INSTANCES" "DEVICE_ID" "C_DIAG" "C_MOTION" "C_DEPTH" "C_STREAMS" "C_TRIPLE_PORT" "C_MAX_XSIZE" "C_BASEADDR" "C_HIGHADDR" + xdefine_config_file $drv_handle "xdeint_g.c" "XDeint" "DEVICE_ID" "C_BASEADDR" + xdefine_canonical_xpars $drv_handle "xparameters.h" "Deinterlacer" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" +} + + diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/src/Makefile b/XilinxProcessorIPLib/drivers/deinterlacer/src/Makefile new file mode 100755 index 00000000..e4a7f64d --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/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 v_deinterlacer" + $(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/deinterlacer/src/xdeint.c b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint.c new file mode 100755 index 00000000..e8d5c082 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint.c @@ -0,0 +1,339 @@ +/****************************************************************************** +* +* 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 XDeint.c +* +* This is main code of Xilinx Vide Deinterlacer +* device driver. Please see xdeint.h for more details of the driver. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ---- -------- ------------------------------------------------------- +* 1.00a rjh 07/10/11 First release +* 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00 +*+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xdeint.h" +#include "xenv.h" +#include "xil_assert.h" + +/************************** Constant Definitions *****************************/ + + +/**************************** Type Definitions *******************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/************************** Function Prototypes ******************************/ + +static void StubCallBack(void *CallBackRef); + +/************************** Function Definition ******************************/ + +/*****************************************************************************/ +/** + * This function initializes an Deinterlacer device. This function must be called + * prior to using a Deinterlacer device. Initialization of an Deinterlacer includes + * setting up the instance data, and ensuring the hardware is in a quiescent + * state. + * + * @param InstancePtr is a pointer to the Deinterlacer device instance to be + * worked on. + * @param CfgPtr points to the configuration structure associated with the + * Deinterlacer device. + * @param EffectiveAddr is the base address of the device. If address + * translation is being used, then this parameter must reflect the + * virtual base address. Otherwise, the physical address should be + * used. + * @return XST_SUCCESS + * + *****************************************************************************/ +int XDeint_ConfigInitialize(XDeint *InstancePtr, XDeint_Config *CfgPtr, + u32 EffectiveAddr) +{ + /* Verify arguments */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(CfgPtr != NULL); + Xil_AssertNonvoid(EffectiveAddr != (u32)NULL); + + /* Setup the instance */ + memset((void *)InstancePtr, 0, sizeof(XDeint)); + memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr, + sizeof(XDeint_Config)); + InstancePtr->Config.BaseAddress = EffectiveAddr; + + /* Set all handlers to stub values, let user configure this data later + */ + InstancePtr->IntCallBack = (XDeint_CallBack) StubCallBack; + /* Reset the hardware and set the flag to indicate the driver is ready + */ + XDeint_Disable(InstancePtr); + /* Reset the deinterlacer + */ + XDeint_Reset(InstancePtr); + /* Wait for Soft reset to complete + */ + while(XDeint_InReset(InstancePtr)); + InstancePtr->IsReady = XIL_COMPONENT_IS_READY; + + return XST_SUCCESS; +} + +/*****************************************************************************/ +/** + * This function sets up input field buffer addresses of an Deinterlacer device. + * + * @param InstancePtr is a pointer to the DEINT device instance to be + * worked on. + * @param FieldAddr1 is the address of the 1st input field buffer. + * @param FieldAddr2 is the address of the 2nd input field buffer. + * @param FieldAddr3 is the address of the 3rd input field buffer. + * @param FrameSize is the size in 32bit words of a single field buffer + * @return None. + * + *****************************************************************************/ +void XDeint_SetFramestore(XDeint *InstancePtr, + u32 FieldAddr1, u32 FieldAddr2, + u32 FieldAddr3, u32 FrameSize) +{ + /* Verify arguments */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertVoid(FrameSize != (u32)NULL); + + /* Set the input buffer addresses amd size of all fieldstores */ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_FS_BASE0,FieldAddr1); + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_FS_BASE1,FieldAddr2); + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_FS_BASE2,FieldAddr3); + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_FS_WORDS,FrameSize); + + return; +} + + +/*****************************************************************************/ +/** + * This function sets up the video format + * + * @param Packing selects the XSVI video packing mode. + * @param Colour selects what colourspace to use + * @param Order selects which field ordering is being used + * @param psf enables psf (progressive segmented frame mode) + * @return None. + * + *****************************************************************************/ +void XDeint_SetVideo(XDeint *InstancePtr, + u32 Packing, u32 Colour, u32 Order, u32 PSF) +{ +u32 mode_reg; + + /* Verify arguments */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); + + // Read modify write the mode register. + mode_reg = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,XDEINT_MODE); + mode_reg &= ~(XDEINT_MODE_PACKING_MASK | + XDEINT_MODE_COL_MASK | + XDEINT_MODE_FIELD_ORDER_MASK | + XDEINT_MODE_PSF_ENABLE_MASK); + mode_reg |= Packing | Colour | Order | PSF; + + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE,mode_reg); + + return; +} + +/*****************************************************************************/ +/** + * This function sets up the threshold used by the motion adaptive kernel + * + * @param InstancePtr is a pointer to the DEINT device instance to be + * worked on. + * @param T1 is the lower threshold of the motion kernel + * @param T2 is the upper threshold of the motion kernel + * @return None. + * + *****************************************************************************/ +void XDeint_SetThresholds(XDeint *InstancePtr, + u32 t1, u32 t2) +{ +u32 xfade; + /* Verify arguments */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertVoid(t1 != (u32)NULL); + Xil_AssertVoid(t2 != (u32)NULL); + + // Determine the T1->T2 cross fade setting. + xfade = (256*4096)/(t2-t1); + + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_T1,t1); + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_T2,t2); + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_XFADE,xfade); + + return; +} + +/*****************************************************************************/ +/** + * This function sets up the pulldown controller + * + * @param InstancePtr is a pointer to the DEINT device instance to be + * worked on. + * @param enable + * @return None. + * + *****************************************************************************/ +void XDeint_SetPulldown(XDeint *InstancePtr, + u32 enable_32, + u32 enable_22) +{ +u32 mode_reg; + + /* Verify arguments */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); + + // Read modify write the mode register. + mode_reg = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,XDEINT_MODE); + mode_reg &= ~(XDEINT_MODE_PULL_22_ENABLE | XDEINT_MODE_PULL_32_ENABLE); + if (enable_32) + mode_reg |= XDEINT_MODE_PULL_32_ENABLE; + if (enable_22) + mode_reg |= XDEINT_MODE_PULL_22_ENABLE; + + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE,mode_reg); + + return; +} + +/*****************************************************************************/ +/** +* +* This function returns the version of a Deinterlacer device. +* +* @param InstancePtr is a pointer to the Deinterlacer device instance to be +* worked on. +* @param Major points to an unsigned 16-bit variable that will be assigned +* with the major version number after this function returns. Value +* range is from 0x0 to 0xF. +* @param Minor points to an unsigned 16-bit variable that will be assigned +* with the minor version number after this function returns. Value +* range is from 0x00 to 0xFF. +* @param Revision points to an unsigned 16-bit variable that will be assigned +* with the revision version number after this function returns. Value +* range is from 0xA to 0xF. +* @return None. +* @note Example: Device version should read v2.01.c if major version number +* is 0x2, minor version number is 0x1, and revision version number is +* 0xC. +* +******************************************************************************/ +void XDeint_GetVersion(XDeint *InstancePtr, u16 *Major, u16 *Minor, + u16 *Revision) +{ + u32 Version; + + /* Verify arguments */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(Major != NULL); + Xil_AssertVoid(Minor != NULL); + Xil_AssertVoid(Revision != NULL); + + /* Read device version */ + Version = XDeint_ReadReg(InstancePtr->Config.BaseAddress, XDEINT_VER); + + /* Parse the version and pass the info to the caller via output + * parameter + */ + *Major = (u16) + ((Version & XDEINT_VER_MAJOR_MASK) >> XDEINT_VER_MAJOR_SHIFT); + + *Minor = (u16) + ((Version & XDEINT_VER_MINOR_MASK) >> XDEINT_VER_MINOR_SHIFT); + + *Revision = (u16) + ((Version & XDEINT_VER_REV_MASK) >> XDEINT_VER_REV_SHIFT); + + return; +} + +/*****************************************************************************/ +/** + * This function sets up the input frame size of the deinterlacer + * + * @param InstancePtr is a pointer to the DEINT device instance to be + * worked on. + * @param Width + * @param Height + * @return None. + * + *****************************************************************************/ +void XDeint_SetSize(XDeint *InstancePtr, + u32 Width, u32 Height) +{ + /* Verify arguments */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertVoid(Width != (u32)NULL); + Xil_AssertVoid(Height != (u32)NULL); + + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_HEIGHT,Height); + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_WIDTH,Width); + + return; +} + + +/*****************************************************************************/ +/* + * This routine is a stub for the frame done interrupt callback. The stub is + * here in case the upper layer forgot to set the handler. On initialization, + * the frame done interrupt handler is set to this callback. It is considered + * an error for this handler to be invoked. + * + *****************************************************************************/ +static void StubCallBack(void *CallBackRef) +{ + Xil_AssertVoidAlways(); +} diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint.h b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint.h new file mode 100755 index 00000000..a7ef0d0b --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint.h @@ -0,0 +1,466 @@ +/****************************************************************************** +* +* 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 xdeint.h +* +* This is the main header file of Xilinx Video Deinterlacer device driver +* +* Interrupt Service +* +* The Deinterlacer can generate 11 interrupt sources +* - Internal Register update done +* - Deinterlacer is locked to incoming video +* - Deinterlacer has lost lock to incoming video +* - Deinterlacer internal fifo error +* - Pulldown activated +* - Pulldown cancelled +* - Frame Tick +* - Framestore Write setup error +* - Framestore Write fifo overflow +* - Framestore Read Field underrun +* - Framestore Read Frame underrun +* +* This driver provides functions to install callbacks for the interrupts and +* enable/disable/clear any of them. +* +* Examples +* +* Example(s) are provided with this driver to demonstrate the driver usage. +* +* Limitations +* +* BUS Interface +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ---- -------- ------------------------------------------------------- +* 1.00a rjh 07/10/11 First release +* 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00 +* 3.0 adk 19/12/13 Updated as per the New Tcl API's +* 3.1 adk 09/05/14 Fixed the CR:798337 driver doesn't support the IP in the +* build.Changes are made in the driver mdd file. +*+* +******************************************************************************/ + +#ifndef XDeint_H /* prevent circular inclusions */ +#define XDeint_H /* by using protection macros */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xdeint_hw.h" +#include "xstatus.h" + +/************************** Constant Definitions *****************************/ + +/** @name Interrupt types for setting up callbacks + * @{ + */ +#define XDeint_HANDLER /**< Internal Register update done */ +/*@}*/ + +/**************************** Type Definitions *******************************/ + +/** + * Deinterlacer device configuration structure. + * Each Deinterlacer device 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 */ +} XDeint_Config; + +/** + * Callback type for all interrupts + * + * @param none + */ +typedef void (*XDeint_CallBack) (u32 status); + +/** + * The XDeint driver instance data. An instance must be allocated for each + * DEINT device in use. + */ +typedef struct { + XDeint_Config Config; /**< hardware configuration */ + u32 IsReady; /**< Device and the driver instance are initialized */ + u32 xsize; /**< X Input Dimension */ + u32 ysize; /**< Y Input Dimension */ + + XDeint_CallBack IntCallBack; /**< Call back for Status interrupt */ + +} XDeint; + +/*****************************************************************************/ +/** +* +* This macro enables the deinterlacer algorithms +* +* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on. +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_Enable(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_Enable(InstancePtr) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL, \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL) | \ + XDEINT_CTL_ENABLE) + +/*****************************************************************************/ +/** +* +* This macro disables the deinterlacer algorithms +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_Disable(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_Disable(InstancePtr) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL, \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL) & \ + ~XDEINT_CTL_ENABLE) + +/*****************************************************************************/ +/** +* +* This macro enables the deinterlacer to accept video +* +* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on. +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_Start(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_Start(InstancePtr) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL, \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL) | \ + XDEINT_CTL_ACCEPT_VIDEO) + +/*****************************************************************************/ +/** +* +* This macro halts the deinterlacer on the next frame boundary +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_Stop(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_Stop(InstancePtr) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL, \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL) & \ + ~XDEINT_CTL_ACCEPT_VIDEO) + +/*****************************************************************************/ +/** +* +* This macro soft resets the deinterlacer to its default mode. This register will clear +* once the reset is complete. Software should poll here until the reset has completed +* NOTE : Attempting to alter CPU registers during a soft reset will result in no register +* changes due to the CPU interface being reset... +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_Reset(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_Reset(InstancePtr) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_RESET,XDEINT_RESET_RESET_MASK) + +/*****************************************************************************/ +/** +* +* This macro returns the current soft-reset state +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @return 1=In Reset, 0=Ready. +* +* @note +* C-style signature: +* void XDeint_InReset(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_InReset(InstancePtr) \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_RESET) + + +/*****************************************************************************/ +/** +* +* This macro tells an DEINT device to pick up all the register value changes +* made so far by the software at the next frame boundary. +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_RegUpdateReq(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_RegUpdateReq(InstancePtr) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL, \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_CONTROL) | \ + 0x00000001) + +/*****************************************************************************/ +/** +* +* This macro enables interrupts of an DEINT device. +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @param IntrType is the type of the interrupts to enable. Use OR'ing of +* XDeint_IXR_* constants defined in xdeint_hw.h to create this parameter +* value. +* +* @return None +* +* @note +* +* The existing enabled interrupt(s) will remain enabled. +* +* C-style signature: +* void XDeint_IntrEnable(XDeint *InstancePtr, u32 IntrType); +* +******************************************************************************/ +#define XDeint_IntrEnable(InstancePtr, IntrType) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_IER, \ + ((IntrType) & XDEINT_IXR_ALLINTR_MASK) | \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_IER)) + +/*****************************************************************************/ +/** +* +* This macro disables interrupts of an DEINT device. +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @param IntrType is the type of the interrupts to disable. Use OR'ing of +* XDeint_IXR_* constants defined in xdeint_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 XDeint_IntrDisable(XDeint *InstancePtr, u32 IntrType); +* +******************************************************************************/ +#define XDeint_IntrDisable(InstancePtr, IntrType) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_IER, \ + ((~(IntrType)) & XDEINT_IXR_ALLINTR_MASK) & \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_ISR)) + +/*****************************************************************************/ +/** +* +* This macro returns the pending interrupts of an DEINT device. +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @return The pending interrupts of the DEINT. Use XDEINT_IXR_* constants +* defined in xdeint_hw.h to interpret this value. +* +* @note +* +* C-style signature: +* u32 XDeint_IntrGetPending(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_IntrGetPending(InstancePtr) \ + (XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_IER) & \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_ISR) \ + & XDEINT_IXR_ALLINTR_MASK) + +/*****************************************************************************/ +/** +* +* This macro clears/acknowledges pending interrupts of an DEINT device. +* +* @param InstancePtr is a pointer to the DEINT device instance to be worked on. +* +* @param IntrType is the pending interrupts to clear/acknowledge. Use OR'ing +* of XDeint_IXR_* constants defined in xdeint_hw.h to create this +* parameter value. +* +* @return None +* +* @note +* +* C-style signature: +* void XDeint_IntrClear(XDeint *InstancePtr, u32 IntrType); +* +******************************************************************************/ +#define XDeint_IntrClear(InstancePtr, IntrType) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_ISR, \ + (IntrType) & XDeint_IntrGetPending(InstancePtr)) + +/*****************************************************************************/ +/** +* +* This macro set the deinterlacers colour space RGB. +* +* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on. +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_Enable(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_SetRGB(InstancePtr) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE, \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE) \ + | XDEINT_MODE_COLOUR_RGB) + +/*****************************************************************************/ +/** +* +* This macro set the deinterlacers colour space to YUV. +* +* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on. +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_Enable(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_SetYUV(InstancePtr) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE, \ + XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE) \ + & ~XDEINT_MODE_COLOUR_RGB) + +/*****************************************************************************/ +/** +* +* This macro set the deinterlacers processing algorithm +* +* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on. +* @param Alg is a algorthim setting from XDEINT_MODE_ALGORITHM_???? +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_Enable(XDeint *InstancePtr); +* +******************************************************************************/ +#define XDeint_SetAlgorithm(InstancePtr,Alg) \ + XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE, \ + (XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE) \ + & ~XDEINT_MODE_ALGORITHM_FULL) | Alg) + + +/************************** Function Prototypes ******************************/ + +/* + * Initialization and control functions in xdeint.c + */ + +/* Initialization */ +int XDeint_ConfigInitialize(XDeint *InstancePtr, XDeint_Config *CfgPtr, + u32 EffectiveAddr); + +/* + * Initialization functions in xdeint_sinit.c + */ +XDeint_Config *XDeint_LookupConfig(u16 DeviceId); + +// Framestore management +void XDeint_SetFramestore(XDeint *InstancePtr, + u32 FieldAddr1, u32 FieldAddr2, + u32 FieldAddr3, u32 FrameSize); + +// Deinterlacer Management +void XDeint_SetSize(XDeint *InstancePtr, + u32 Width, u32 Height); + +void XDeint_SetPulldown(XDeint *InstancePtr, + u32 enable_32, + u32 enable_22); +void XDeint_SetThresholds(XDeint *InstancePtr, + u32 t1, u32 t2); +void XDeint_SetVideo(XDeint *InstancePtr, + u32 Packing, u32 Colour, u32 Order, u32 PSF); + + +/* + * Interrupt related functions in xdeint_intr.c + */ +void XDeint_IntrHandler(void *InstancePtr); +int XDeint_SetCallBack(XDeint *InstancePtr, void *CallBackFunc); + + +#ifdef __cplusplus +} +#endif + +#endif /* end of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_g.c b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_g.c new file mode 100755 index 00000000..1d840396 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_g.c @@ -0,0 +1,67 @@ +/****************************************************************************** +* +* 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 XDeint_g.c +* +* This file contains a template for configuration table of Xilinx Video Deinterlacer +* For a real hardware system, +* Xilinx Platform Studio (XPS) will automatically generate a real configuration +* table to match the configuration of the Deinterlacer devices. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ---- -------- ------------------------------------------------------- +* 1.00a rjh 07/10/11 First release +* 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00 +*+* +******************************************************************************/ + + +/***************************** Include Files *********************************/ + +#include "xparameters.h" +#include "xdeint.h" + +/** + * The configuration table for Video Deinterlacers devices + */ +XDeint_Config XDeint_ConfigTable[] = { + { + XPAR_DEINTERLACER_0_DEVICE_ID, + XPAR_DEINTERLACER_0_BASEADDR + } +}; diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_hw.h b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_hw.h new file mode 100755 index 00000000..19c8b306 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_hw.h @@ -0,0 +1,244 @@ +/****************************************************************************** +* +* 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 xdeint_hw.h +* +* This header file contains identifiers and register-level driver functions (or +* macros) that can be used to access the Xilinx Video Deinterlacer device. +* +* For more information about the operation of this device, see the hardware +* specification and documentation in the higher level driver xdeint.h source +* code file. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ---- -------- ------------------------------------------------------- +* 1.00a rjh 07/10/11 First release +* 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00 +*+* +******************************************************************************/ + +#ifndef XDeint_HW_H /* prevent circular inclusions */ +#define XDeint_HW_H /* by using protection macros */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xil_io.h" + +/************************** Constant Definitions *****************************/ + +/** @name Register Offsets + * @{ + */ +#define XDEINT_CONTROL 0x000 /**< Deinterlacer Main Control */ +#define XDEINT_MODE 0x004 /**< Deinterlacer internal Modes */ +#define XDEINT_IER 0x008 /**< Interrupt Enable Control */ +#define XDEINT_ISR 0x00C /**< Interrupt Enable Status */ +#define XDEINT_HEIGHT 0x010 /**< Height */ +#define XDEINT_WIDTH 0x014 /**< Width */ +#define XDEINT_T1 0x018 /**< T1 Threshold */ +#define XDEINT_T2 0x01C /**< T2 Threshold */ +#define XDEINT_XFADE 0x020 /**< Cross Fade Ration */ +#define XDEINT_FS_BASE0 0x024 /**< VFBC Field Buffer 0 Base */ +#define XDEINT_FS_BASE1 0x028 /**< VFBC Field Buffer 1 Base */ +#define XDEINT_FS_BASE2 0x02C /**< VFBC Field Buffer 2 Base */ +#define XDEINT_FS_WORDS 0x030 /**< VFBC Field Buffer Page size in 32bit Words */ +#define XDEINT_VER 0x0F0 /**< Hardware Version ID */ +#define XDEINT_RESET 0x100 /**< Soft Reset */ +/*@}*/ + +/** @name Interrupt Status/Enable Register bit definition + * @{ + */ +#define XDEINT_IXR_UPDATE_MASK 0x00000001 /**< Internal Register update done */ +#define XDEINT_IXR_LOCKED_MASK 0x00000002 /**< Deinterlacer is locked to incoming video */ +#define XDEINT_IXR_UNLOCKED_MASK 0x00000004 /**< Deinterlacer has lost lock to incoming video */ +#define XDEINT_IXR_ERROR_MASK 0x00000008 /**< Deinterlacer internal fifo error */ +#define XDEINT_IXR_PULL_ON_MASK 0x00000010 /**< Pulldown activated */ +#define XDEINT_IXR_PULL_OFF_MASK 0x00000020 /**< Pulldown cancelled */ +#define XDEINT_IXR_FRAME_MASK 0x00000040 /**< Frame Tick */ +#define XDEINT_IXR_FS_CFG_ERROR_MASK 0x00000100 /**< Framestore Write setup error */ +#define XDEINT_IXR_FS_WR_ERROR_MASK 0x00000200 /**< Framestore Write fifo overflow */ +#define XDEINT_IXR_FS_RD_FIELD_ERROR_MASK 0x00000400 /**< Framestore Read Field underrun */ +#define XDEINT_IXR_FS_RD_FRAME_ERROR_MASK 0x00000800 /**< Framestore Read Frame underrun */ + +#define XDEINT_IXR_ALLINTR_MASK (XDEINT_IXR_UPDATE_MASK | \ + XDEINT_IXR_LOCKED_MASK | \ + XDEINT_IXR_UNLOCKED_MASK | \ + XDEINT_IXR_ERROR_MASK | \ + XDEINT_IXR_PULL_ON_MASK | \ + XDEINT_IXR_PULL_OFF_MASK | \ + XDEINT_IXR_FRAME_MASK | \ + XDEINT_IXR_FS_CFG_ERROR_MASK | \ + XDEINT_IXR_FS_WR_ERROR_MASK | \ + XDEINT_IXR_FS_RD_FIELD_ERROR_MASK | \ + XDEINT_IXR_FS_RD_FRAME_ERROR_MASK) /**< Mask for all interrupts */ +/*@}*/ + +/** @name Error Status bit definition + * @{ + */ +#define XDEINT_STS_ERROR 0x00000008 /**< Deinterlacer internal fifo error */ +#define XDEINT_STS_FS_CFG_ERROR 0x00000100 /**< Framestore Write setup error */ +#define XDEINT_STS_FS_WR_ERROR 0x00000200 /**< Framestore Write fifo overflow */ +#define XDEINT_STS_FS_RD_FIELD_ERROR 0x00000400 /**< Framestore Read Field underrun */ +#define XDEINT_STS_FS_RD_FRAME_ERROR 0x00000800 /**< Framestore Read Frame underrun */ +/*@}*/ + +#define XDEINT_RESET_RESET_MASK 0x00000001 /**< Software Reset */ + +/** @name Deinterlacer COntrol Fields + * @{ + */ +#define XDEINT_VER_MAJOR_MASK 0xF0000000 /**< Major Version */ +#define XDEINT_VER_MAJOR_SHIFT 28 /**< Major Bit Shift */ +#define XDEINT_VER_MINOR_MASK 0x0FF00000 /**< Minor Version */ +#define XDEINT_VER_MINOR_SHIFT 20 /**< Minor Bit Shift */ +#define XDEINT_VER_REV_MASK 0x000F0000 /**< Revision Version */ +#define XDEINT_VER_REV_SHIFT 16 /**< Revision Bit Shift */ +/*@}*/ + +/** @name Deinterlacer COntrol Fields + * @{ + */ +#define XDEINT_CTL_UPDATE_REQ 0x00000001 /**< Queue a register update request */ +#define XDEINT_CTL_ENABLE 0x00000002 /**< Enable/Disable deinterlacer algorithms*/ +#define XDEINT_CTL_ACCEPT_VIDEO 0x00000004 /**< Accept Video into the deinterlacer */ +/*@}*/ + +/** @name Deinterlacer Mode Fields + * @{ + */ +#define XDEINT_MODE_ALGORITHM_0 0x00000001 /**< Deinterlacer algorithm */ +#define XDEINT_MODE_ALGORITHM_1 0x00000002 /**< Deinterlacer algorithm */ +#define XDEINT_MODE_COL 0x00000004 /**< Colour Space */ +#define XDEINT_MODE_PACKING_0 0x00000008 /**< XSVI Packing */ +#define XDEINT_MODE_PACKING_1 0x00000010 /**< XSVI Packing */ +#define XDEINT_MODE_FIELD_ORDER 0x00000020 /**< First field order */ +#define XDEINT_MODE_PSF_ENABLE 0x00000040 /**< PSF passthrough enable */ +#define XDEINT_MODE_PULL_32_ENABLE 0x00000080 /**< Pulldown 3:2 control enable */ +#define XDEINT_MODE_PULL_22_ENABLE 0x00000100 /**< Pulldown 3:2 control enable */ + +#define XDEINT_MODE_COLOUR_RGB 0x00000000 /**< Deinterlacer colour space*/ +#define XDEINT_MODE_COLOUR_YUV 0x00000004 /**< Deinterlacer colour space*/ + +#define XDEINT_MODE_ALGORITHM_RAW 0x00000000 /**< Deinterlacer algorithm option 0*/ +#define XDEINT_MODE_ALGORITHM_DIAG 0x00000001 /**< Deinterlacer algorithm option 1*/ +#define XDEINT_MODE_ALGORITHM_MOTION 0x00000002 /**< Deinterlacer algorithm option 2*/ +#define XDEINT_MODE_ALGORITHM_FULL 0x00000003 /**< Deinterlacer algorithm option 3*/ + +#define XDEINT_MODE_PACKING_420 0x00000000 /**< XSVI Packing mode 420*/ +#define XDEINT_MODE_PACKING_422 0x00000008 /**< XSVI Packing mode 422*/ +#define XDEINT_MODE_PACKING_444 0x00000010 /**< XSVI Packing mode 444*/ + +#define XDEINT_MODE_FIELD_EVEN_FIRST 0x00000020 /**< First field of frame contains even video lines*/ +#define XDEINT_MODE_FIELD_ODD_FIRST 0x00000000 /**< First field of frame contains odd video lines*/ + +// RMW Masking Bits. +#define XDEINT_MODE_ALGORITHM_MASK 0x00000003 /**< Deinterlacer algorithm */ +#define XDEINT_MODE_COL_MASK 0x00000004 /**< Colour Space */ +#define XDEINT_MODE_PACKING_MASK 0x00000018 /**< XSVI Packing */ +#define XDEINT_MODE_FIELD_ORDER_MASK 0x00000020 /**< First field order */ +#define XDEINT_MODE_PSF_ENABLE_MASK 0x00000040 /**< PSF passthrough enable */ +#define XDEINT_MODE_PULL_ENABLE_MASK 0x00000180 /**< Pulldown control enable */ + +/*@}*/ + + + +/**************************** Type Definitions *******************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + +/** @name Device register I/O APIs + * @{ + */ + +#define XDeint_In32 Xil_In32 +#define XDeint_Out32 Xil_Out32 + +/*****************************************************************************/ +/** +* +* Read the given register. +* +* @param BaseAddress is the base address of the device +* @param RegOffset is the register offset to be read +* +* @return The 32-bit value of the register +* +* @note +* C-style signature: +* u32 XDeint_ReadReg(u32 BaseAddress, u32 RegOffset) +* +******************************************************************************/ +#define XDeint_ReadReg(BaseAddress, RegOffset) \ + XDeint_In32((BaseAddress) + (RegOffset)) + +/*****************************************************************************/ +/** +* +* Write the given register. +* +* @param BaseAddress is the base address of the device +* @param RegOffset is the register offset to be written +* @param Data is the 32-bit value to write to the register +* +* @return None. +* +* @note +* C-style signature: +* void XDeint_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data) +* +******************************************************************************/ +#define XDeint_WriteReg(BaseAddress, RegOffset, Data) \ + XDeint_Out32((BaseAddress) + (RegOffset), (Data)) + +/*@}*/ + +/************************** Function Prototypes ******************************/ + +#ifdef __cplusplus +} +#endif + +#endif /* end of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_i.h b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_i.h new file mode 100755 index 00000000..e0381317 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_i.h @@ -0,0 +1,63 @@ +/****************************************************************************** +* +* 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 xdeint_i.h +* +* This code contains internal functions of the Xilinx Video Deinterlacer device +* driver. The application should not need the functions in this code to control +* the Video Deinterlacer device. Read xdeint.h for detailed information about the driver +* +* Ver Who Date Changes +* ----- ---- -------- ------------------------------------------------------- +* 1.00a rjh 07/10/11 First release +* 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00 +* +* +******************************************************************************/ + +#ifndef XDeint_I_H /* prevent circular inclusions */ +#define XDeint_I_H /* by using protection macros */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Base address fetch */ +#define XDeint_BaseAddr(InstancePtr) ((InstancePtr)->Config.BaseAddress) + +#ifdef __cplusplus +} +#endif + +#endif /* end of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_intr.c b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_intr.c new file mode 100755 index 00000000..b5834b29 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_intr.c @@ -0,0 +1,128 @@ +/****************************************************************************** +* +* 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 xdeint_intr.c +* +* This code contains interrupt related functions of Xilinx Video +* Deinterlacer (DEINT) device driver. Please see xdeint.h for +* more details of the driver. +* +*
+* MODIFICATION HISTORY: +* +* Ver Who Date Changes +* ----- ---- -------- ------------------------------------------------------- +* 1.00a rjh 07/10/11 First release +* 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00 +*+* +******************************************************************************/ + +#include "xdeint.h" +#include "xil_assert.h" + +/*****************************************************************************/ +/** +* +* This function is the interrupt handler for the Deinterlacer +* +* This handler reads the pending interrupt from the IER/ISR, determines the +* source of the interrupts, calls according callback, 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 +* XDeint_SetCallBack() during initialization phase. An example delivered with +* this driver demonstrates how this could be done. +* +* @param InstancePtr is a pointer to the XDeint instance that just +* interrupted. +* @return None. +* @note The Error interrupt callback invoked in case an error interrupt or +* spurious interrupt happens should reset the DEINT device that just +* interrupted. +* +******************************************************************************/ +void XDeint_IntrHandler(void *InstancePtr) +{ + XDeint *XDeintPtr; + u32 PendingIntr; + u32 ErrorStatus; + + /* Validate parameters */ + XDeintPtr = (XDeint *) InstancePtr; + Xil_AssertVoid(XDeintPtr != NULL); + Xil_AssertVoid(XDeintPtr->IsReady == XIL_COMPONENT_IS_READY); + + /* Get pending interrupts */ + PendingIntr = XDeint_IntrGetPending(XDeintPtr); + + /* Clear pending interrupt(s) */ + XDeint_IntrClear(XDeintPtr, PendingIntr); + + /* A known interrupt has happened */ + if (PendingIntr) + XDeintPtr->IntCallBack(PendingIntr); + + return; +} + +/*****************************************************************************/ +/** +* +* This routine installs an asynchronous callback function. +* +* @param InstancePtr is a pointer to the XDeint instance to be worked on. +* @param CallbackFunc is the address of the callback function. +* +* @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 XDeint_SetCallBack(XDeint *InstancePtr,void *CallBackFunc) +{ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertNonvoid(CallBackFunc != NULL); + + InstancePtr->IntCallBack = (XDeint_CallBack) CallBackFunc; + + return XST_SUCCESS; +} diff --git a/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_sinit.c b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_sinit.c new file mode 100755 index 00000000..bf36b9de --- /dev/null +++ b/XilinxProcessorIPLib/drivers/deinterlacer/src/xdeint_sinit.c @@ -0,0 +1,96 @@ +/****************************************************************************** +* +* 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 xdeint_sinit.c + * + * This file contains static initialization methods for Xilinx Video + * Deinterlacer (DEINT) device driver. + * + *
+ * MODIFICATION HISTORY: + * + * Ver Who Date Changes + * ----- ---- -------- ------------------------------------------------------- + * 1.00a rjh 07/10/11 First release + * 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00 + *+ * + ******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xparameters.h" +#include "xdeint.h" + +/************************** Constant Definitions *****************************/ + + +/**************************** Type Definitions *******************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/************************** Function Prototypes ******************************/ + +/*****************************************************************************/ +/** + * XDeint_LookupConfig returns a reference to an XDeint_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 xdeint_g.c + * file. + * + * @param DeviceId is the unique device ID of the device for the lookup + * operation. + * + * @return XDeint_LookupConfig returns a reference to a config record in the + * configuration table (in xDEINT_g.c) corresponding to DeviceId, + * or NULL if no match is found. + * + ******************************************************************************/ +XDeint_Config *XDeint_LookupConfig(u16 DeviceId) +{ + extern XDeint_Config XDeint_ConfigTable[]; + XDeint_Config *CfgPtr = NULL; + int i; + + for (i = 0; i < XPAR_XDEINT_NUM_INSTANCES; i++) { + if (XDeint_ConfigTable[i].DeviceId == DeviceId) { + CfgPtr = &XDeint_ConfigTable[i]; + break; + } + } + + return (CfgPtr); +}