deinterlacer: Added driver source files in deinterlacer_v3_2 driver

Modified the following:
	deinterlacer_v3_2/src/
	deinterlacer_v3_2/data/
	deinterlacer_v3_2/doc/
Added the following:
	deinterlacer_v3_2/examples/

Signed-off-by: Shravan Kumar A <skumara@xilinx.com>
Acked-by: Srikanth Vemula <svemula@xilinx.com>
This commit is contained in:
Shravan Kumar A 2014-07-15 18:12:32 +05:30 committed by Jagannadha Sutradharudu Teki
parent 824c95de7b
commit d053b04a7f
12 changed files with 1447 additions and 730 deletions

View file

@ -1,9 +1,9 @@
###############################################################################
##############################################################################
#
# 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
# 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,8 +27,8 @@
# 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

View file

@ -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,20 +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.
#
###############################################################################
#
# Modification History
# Ver Who Date Changes
# -------- ------ -------- ----------------------------------------------------
# 3.0 adk 10/12/13 Updated as per the New Tcl API's
#################################################################################
#uses "xillib.tcl"
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_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" "XDeint" "DEVICE_ID" "C_BASEADDR"
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"
xdefine_canonical_xpars $drv_handle "xparameters.h" "Deinterlacer" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "XDeint" "DEVICE_ID" "C_BASEADDR"
}

View file

@ -0,0 +1,163 @@
/******************************************************************************
*
* (c) Copyright 2014 Xilinx, Inc. All rights reserved.
*
* This file contains confidential and proprietary information of Xilinx, Inc.
* and is protected under U.S. and international copyright and other
* intellectual property laws.
*
* DISCLAIMER
* This disclaimer is not a license and does not grant any rights to the
* materials distributed herewith. Except as otherwise provided in a valid
* license issued to you by Xilinx, and to the maximum extent permitted by
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE
* and (2) Xilinx shall not be liable (whether in contract or tort, including
* negligence, or under any other theory of liability) for any loss or damage
* of any kind or nature related to, arising under or in connection with these
* materials, including for any direct, or any indirect, special, incidental,
* or consequential loss or damage (including loss of data, profits, goodwill,
* or any type of loss or damage suffered as a result of any action brought by
* a third party) even if such damage or loss was reasonably foreseeable or
* Xilinx had been advised of the possibility of the same.
*
* CRITICAL APPLICATIONS
* Xilinx products are not designed or intended to be fail-safe, or for use in
* any application requiring fail-safe performance, such as life-support or
* safety devices or systems, Class III medical devices, nuclear facilities,
* applications related to the deployment of airbags, or any other applications
* that could lead to death, personal injury, or severe property or
* environmental damage (individually and collectively, "Critical
* Applications"). Customer assumes the sole risk and liability of any use of
* Xilinx products in Critical Applications, subject only to applicable laws
* and regulations governing limitations on product liability.
*
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
* AT ALL TIMES.
*
******************************************************************************/
/****************************************************************************/
/**
*
* @file deint_selftest_example.c
*
* This file contains an example using the XDeint driver to do self test
* on the device.
*
* MODIFICATION HISTORY:
* <pre>
* Ver Who Date Changes
* ----- ------ -------- -----------------------------------------------
* 1.00a drg/jz 01/13/10 First Release
* 1.03a sg 08/14/12 Updated the example for CR 666306. Modified
* the device ID to use the first Device Id
* Removed the printf at the start of the main
* 3.2 adk 01/15/14 Modified function names as per guidelines
*
* </pre>
******************************************************************************/
/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xdeint.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.
*/
/**************************** Type Definitions *******************************/
/***************** Macros (Inline Functions) Definitions *********************/
/************************** Function Prototypes ******************************/
int XDeintSelfTestExample(u16 DeviceId);
/************************** Variable Definitions *****************************/
XDeint Deint; /**<Instance of the Deinterlacer core */
/*****************************************************************************/
/**
*
* Main function to call the example.
*
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note None.
*
******************************************************************************/
int main(void)
{
int Status;
/*
* Run the self test example
*/
Status = XDeintSelfTestExample((u16)XPAR_DEINT_0_DEVICE_ID);
if (Status != XST_SUCCESS) {
xil_printf("Deinterlacer Self test Example Failed\r\n");
return XST_FAILURE;
}
xil_printf("Successfully ran Deinterlacer Self test Example\r\n");
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function does a minimal test on the XDeint driver.
*
*
* @param DeviceId is the XPAR_<DEINT_instance>_DEVICE_ID value from
* xparameters.h.
*
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note None.
*
****************************************************************************/
int XDeintSelfTestExample(u16 DeviceId)
{
int Status;
XDeint_Config *Config;
/*
* Initialize the Deinterlacer driver so that it's ready to use
* Look up the configuration in the config table,
* then initialize it.
*/
Config = XDeint_LookupConfig(DeviceId);
if (NULL == Config) {
return XST_FAILURE;
}
Status = XDeint_ConfigInitialize(&Deint, Config, Config->BaseAddress);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
/*
* Perform a self-test to check hardware build.
*/
Status = XDeint_Selftest(&Deint);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
return XST_SUCCESS;
}

View file

@ -0,0 +1,18 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Driver example applications</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body bgcolor="#FFFFFF">
<h1> Example Applications for the driver deinterlacer_v3_2 </h1>
<HR>
<ul>
<li>deint_selftest_example.c <a href="deint_selftest_example.c">(source)</a> </li>
</ul>
<p><font face="Times New Roman" color="#800000">Copyright ? 1995-2014 Xilinx, Inc. All rights reserved.</font></p>
</body>
</html>

View file

@ -32,18 +32,25 @@
/*****************************************************************************/
/**
*
* @file XDeint.c
* @file xdeint.c
*
* This is main code of Xilinx Vide Deinterlacer
* device driver. Please see xdeint.h for more details of the driver.
* This is main code of Xilinx Vide Deinterlacer core.
* Please see xdeint.h for more details of the driver.
*
* <pre>
* 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
* 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.2 adk 02/13/14 Changed the prototype of XDeint_GetVersion
* Implemented the following functions:
* XDeint_GetFramestore
* XDeint_GetVideo
* XDeint_GetThresholds
* XDeint_GetPulldown
* XDeint_GetSize
* </pre>
*
******************************************************************************/
@ -51,289 +58,475 @@
/***************************** Include Files *********************************/
#include "xdeint.h"
#include "xenv.h"
#include "xil_assert.h"
/************************** Constant Definitions *****************************/
/**************************** Type Definitions *******************************/
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type 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.
* This function initializes the Deinterlacer core. This function must be
* called prior to using a Deinterlacer core. Initialization of the
* 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 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.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param CfgPtr points to the configuration structure associated with
* the Deinterlacer core.
* @param EffectiveAddr is the base address of the core. 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 if initialization was successful.
*
* @note None.
*
******************************************************************************/
void XDeint_GetVersion(XDeint *InstancePtr, u16 *Major, u16 *Minor,
u16 *Revision)
int XDeint_ConfigInitialize(XDeint *InstancePtr, XDeint_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(XDeint));
(void)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)((void *)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 = (u32)(XIL_COMPONENT_IS_READY);
return (XST_SUCCESS);
}
/*****************************************************************************/
/**
*
* This function sets the input field buffer addresses of the Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint 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.
*
* @note None.
*
******************************************************************************/
void XDeint_SetFramestore(XDeint *InstancePtr,
u32 FieldAddr1, u32 FieldAddr2,
u32 FieldAddr3, u32 FrameSize)
{
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY));
Xil_AssertVoid(FrameSize != (u32)0x0);
Xil_AssertVoid(FieldAddr1 != (u32)0x0);
Xil_AssertVoid(FieldAddr2 != (u32)0x0);
Xil_AssertVoid(FieldAddr3 != (u32)0x0);
/* Set the input buffer addresses and size of all field stores. */
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_BUFFER0_OFFSET), FieldAddr1);
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_BUFFER1_OFFSET), FieldAddr2);
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_BUFFER2_OFFSET), FieldAddr3);
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_BUFSIZE_OFFSET), FrameSize);
}
/*****************************************************************************/
/**
*
* This function sets the video format of the Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param Packing selects the XSVI video packing mode.
* @param Color selects what color space to use.
* @param Order selects which field ordering is being used.
* @param PSF enables psf (progressive segmented frame mode).
*
* @return None.
*
* @note None.
*
******************************************************************************/
void XDeint_SetVideo(XDeint *InstancePtr,
u32 Packing, u32 Color, u32 Order, u32 PSF)
{
u32 ModeReg;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY));
/* Read modify write the mode register. */
ModeReg = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_MODE_OFFSET));
ModeReg &= ~((XDEINT_MODE_PACKING_MASK) | (XDEINT_MODE_COL_MASK) |
(XDEINT_MODE_FIELD_ORDER_MASK) |
(XDEINT_MODE_PSF_ENABLE_MASK));
ModeReg |= Packing | Color | Order | PSF;
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_MODE_OFFSET), ModeReg);
}
/*****************************************************************************/
/**
*
* This function sets the threshold used by the motion adaptive kernel of the
* Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param ThresholdT1 is the lower threshold of the motion kernel.
* @param ThresholdT2 is the upper threshold of the motion kernel.
*
* @return None.
*
* @note None.
*
******************************************************************************/
void XDeint_SetThresholds(XDeint *InstancePtr, u32 ThresholdT1,
u32 ThresholdT2)
{
u32 XFade;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY));
Xil_AssertVoid(ThresholdT1 != (u32)0x0);
Xil_AssertVoid(ThresholdT2 != (u32)0x0);
/* Determine the T1->T2 cross fade setting. */
XFade = (u32)((XDEINT_FADE_RATIO)/(ThresholdT2 - ThresholdT1));
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_THRESH1_OFFSET), ThresholdT1);
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_THRESH2_OFFSET), ThresholdT2);
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_XFADE_OFFSET), XFade);
}
/*****************************************************************************/
/**
*
* This function sets the pull down controller of the Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param Enable_32 allows detectors to automatically control
* Deinterlacer core.
* @param Enable_22 allows detectors to automatically control
* Deinterlacer core.
*
* @return None.
*
* @note None.
*
******************************************************************************/
void XDeint_SetPulldown(XDeint *InstancePtr, u32 Enable_32,
u32 Enable_22)
{
u32 ModeReg;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady ==
(u32)(XIL_COMPONENT_IS_READY));
Xil_AssertVoid((Enable_32 == (u32)0x00) || (Enable_32 == (u32)0x01));
Xil_AssertVoid((Enable_22 == (u32)0x00) || (Enable_22 == (u32)0x01));
/* Read modify write the mode register.*/
ModeReg = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_MODE_OFFSET));
ModeReg &= ~(((u32)(XDEINT_MODE_PULL_22_ENABLE)) |
((u32)(XDEINT_MODE_PULL_32_ENABLE)));
/* Checking for Enable_32 */
if (Enable_32 == 1U) {
ModeReg |= ((u32)(XDEINT_MODE_PULL_32_ENABLE));
}
/* Checking for Enable_22 */
if (Enable_22 == 1U) {
ModeReg |= ((u32)(XDEINT_MODE_PULL_22_ENABLE));
}
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_MODE_OFFSET), ModeReg);
}
/*****************************************************************************/
/**
*
* This function returns the contents of Version register.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return Returns the contents of the version register.
*
* @note None.
*
******************************************************************************/
u32 XDeint_GetVersion(XDeint *InstancePtr)
{
u32 Version;
/* Verify arguments */
/* 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);
/* Read core version. */
Version = XDeint_ReadReg(InstancePtr->Config.BaseAddress,
(XDEINT_VER_OFFSET));
/* 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;
return Version;
}
/*****************************************************************************/
/**
* 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)
*
* This function sets the input frame size of the Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param Width is the width of the frame.
* @param Height is the height of the frame.
*
* @return None.
*
* @note 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);
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY));
Xil_AssertVoid(Width != (u32)0x00);
Xil_AssertVoid(Height != (u32)0x00);
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_HEIGHT,Height);
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_WIDTH,Width);
return;
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_HEIGHT_OFFSET), Height);
XDeint_WriteReg((InstancePtr)->Config.BaseAddress,
(XDEINT_WIDTH_OFFSET), Width);
}
/*****************************************************************************/
/*
* 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.
*
*****************************************************************************/
/**
*
* This routine is a stub for the interrupt callback. The stub is here in case
* the upper layer forgot to set the handler. On initialization,
* 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();
(void)CallBackRef;
Xil_AssertVoidAlways();
}
/*****************************************************************************/
/**
*
* This function gets the video format of the Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return Returns the video format.
*
* @note None.
*
******************************************************************************/
u32 XDeint_GetVideo(XDeint *InstancePtr)
{
u32 ModeReg;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady ==
(u32)(XIL_COMPONENT_IS_READY));
/* Read modify write the mode register. */
ModeReg = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_MODE_OFFSET));
return ModeReg;
}
/*****************************************************************************/
/**
*
* This function gets the pull down controller of the Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param Enable_32 is a pointer which holds status of Enable_32 mode.
* - FALSE = Disabled.
* - TRUE = Enabled.
* @param Enable_22 is a pointer which holds status of Enable_22 mode.
* - FALSE = Disabled.
* - TRUE = Enabled.
*
* @return None.
*
* @note None.
*
******************************************************************************/
void XDeint_GetPulldown(XDeint *InstancePtr, u32 *Enable_32,
u32 *Enable_22)
{
u32 ModeReg;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady ==
(u32)(XIL_COMPONENT_IS_READY));
Xil_AssertVoid(Enable_32 != NULL);
Xil_AssertVoid(Enable_22 != NULL);
/* Read modify write the mode register.*/
ModeReg = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_MODE_OFFSET));
*Enable_32 = FALSE;
*Enable_22 = FALSE;
if (((ModeReg) & (XDEINT_MODE_PULL_32_ENABLE)) ==
XDEINT_MODE_PULL_32_ENABLE) {
*Enable_32 = TRUE;
}
if (((ModeReg) & (XDEINT_MODE_PULL_22_ENABLE)) ==
XDEINT_MODE_PULL_22_ENABLE) {
*Enable_22 = TRUE;
}
}
/*****************************************************************************/
/**
*
* This function gets the input frame size of the Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param Width is pointer to the width of the frame.
* @param Height is pointer to the height of the frame.
*
* @return None.
*
* @note None.
*
******************************************************************************/
void XDeint_GetSize(XDeint *InstancePtr, u32 *Width, u32 *Height)
{
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY));
Xil_AssertVoid(Width != NULL);
Xil_AssertVoid(Height != NULL);
*Height = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_HEIGHT_OFFSET));
*Width = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_WIDTH_OFFSET));
}
/*****************************************************************************/
/**
*
* This function gets the threshold used by the motion adaptive kernel.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param ThresholdT1 is the pointer to lower threshold of the
* motion kernel.
* @param ThresholdT2 is the pointer to upper threshold of the
* motion kernel.
*
* @return None.
*
******************************************************************************/
void XDeint_GetThresholds(XDeint *InstancePtr, u32 *ThresholdT1,
u32 *ThresholdT2)
{
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady ==
(u32)(XIL_COMPONENT_IS_READY));
Xil_AssertVoid(ThresholdT1 != NULL);
Xil_AssertVoid(ThresholdT2 != NULL);
/* Determine the T1->T2 cross fade setting.*/
*ThresholdT1 = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_THRESH1_OFFSET));
*ThresholdT2 = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_THRESH2_OFFSET));
}
/*****************************************************************************/
/**
*
* This function gets input field buffer addresses of an Deinterlacer core.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param FieldAddr1 is the pointer to the 1st input field buffer.
* @param FieldAddr2 is the pointer to the 2nd input field buffer.
* @param FieldAddr3 is the pointer to the 3rd input field buffer.
* @param FrameSize is the pointer to size in 32bit words of a single
* field buffer.
*
* @return None.
*
* @note None.
*
******************************************************************************/
void XDeint_GetFramestore(XDeint *InstancePtr,
u32 *FieldAddr1, u32 *FieldAddr2,
u32 *FieldAddr3, u32 *FrameSize)
{
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY));
Xil_AssertVoid(FrameSize != NULL);
Xil_AssertVoid(FieldAddr1 != NULL);
Xil_AssertVoid(FieldAddr2 != NULL);
Xil_AssertVoid(FieldAddr3 != NULL);
/* Get the input buffer addresses and size of all field stores. */
*FieldAddr1 = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_BUFFER0_OFFSET));
*FieldAddr2 = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_BUFFER1_OFFSET));
*FieldAddr3 = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_BUFFER2_OFFSET));
*FrameSize = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_BUFSIZE_OFFSET));
}

View file

@ -34,7 +34,7 @@
*
* @file xdeint.h
*
* This is the main header file of Xilinx Video Deinterlacer device driver
* This is the main header file of Xilinx Video Deinterlacer core.
*
* <b>Interrupt Service </b>
*
@ -42,21 +42,21 @@
* - 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
* - Deinterlacer internal FIFO error
* - Pull down activated
* - Pull down cancelled
* - Frame Tick
* - Framestore Write setup error
* - Framestore Write fifo overflow
* - Framestore Read Field underrun
* - Framestore Read Frame underrun
* - Frame store Write setup error
* - Frame store Write FIFO overflow
* - Frame store Read Field under run
* - Frame store Read Frame under run
*
* This driver provides functions to install callbacks for the interrupts and
* enable/disable/clear any of them.
*
* <b> Examples </b>
*
* Example(s) are provided with this driver to demonstrate the driver usage.
* Example(s) are provided with this driver to demonstrate the self test.
*
* <b>Limitations</b>
*
@ -65,19 +65,47 @@
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* 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.
* 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.2 adk 02/13/14 Added Doxygen support, adherence to Xilinx
* coding standards.
*
* Modification history of xdeint_sinit.c:
* Added Doxygen support, adherence to Xilinx
* coding standards.
*
* Modification history of xdeint_selftest.c:
* Added the XDeint_Selftest function.
*
* Modification history of xdeint_intr.c:
* Adherence to Xilinx coding, Doxygen guidelines.
*
* Modification history of xdeint_i.h:
* Added Doxygen support.
*
* Modification history of xdeint_hw.h:
* Suffixed "_OFFSET" to all register offset macros.
* Added bit masks for the registers and added
* backward compatibility for macros.
*
* Modification history of xdeint.c:
* Changed the prototype of XDeint_GetVersion
* Implemented the following functions:
* XDeint_GetFramestore
* XDeint_GetVideo
* XDeint_GetThresholds
* XDeint_GetPulldown
* XDeint_GetSize
* </pre>
*
******************************************************************************/
#ifndef XDeint_H /* prevent circular inclusions */
#define XDeint_H /* by using protection macros */
#ifndef XDEINT_H
#define XDEINT_H /**< Prevent circular inclusions
* by using protection macros */
#ifdef __cplusplus
extern "C" {
@ -87,380 +115,426 @@ extern "C" {
#include "xdeint_hw.h"
#include "xstatus.h"
#include "xil_assert.h"
/************************** Constant Definitions *****************************/
/** @name Interrupt types for setting up callbacks
* @{
*/
#define XDeint_HANDLER /**< Internal Register update done */
#define XDEINT_HANDLER /**< Internal Register update done */
/*@}*/
/**************************** Type Definitions *******************************/
/**
* Deinterlacer device configuration structure.
* Each Deinterlacer device should have a configuration structure associated.
* Deinterlacer core configuration structure.
* Each Deinterlacer 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 */
u16 DeviceId; /**< DeviceId is the unique ID of the core */
u32 BaseAddress; /**< BaseAddress is the physical base address
* of the core's registers */
} XDeint_Config;
/**
* Callback type for all interrupts
*
* @param none
*/
typedef void (*XDeint_CallBack) (u32 status);
typedef void (*XDeint_CallBack)(u32 status);
/**
* The XDeint driver instance data. An instance must be allocated for each
* DEINT device in use.
* Deintlerlacer core 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_Config Config; /**< Hardware configuration */
u32 IsReady; /**< Core and the driver instance
* are initialized */
u32 XSize; /**< X Input Dimension */
u32 YSize; /**< Y Input Dimension */
XDeint_CallBack IntCallBack; /**< Call back for Status interrupt */
void *IntRef; /**< To be passed to interrupt
* call back */
} XDeint;
/***************** Macros (Inline Functions) Definitions *********************/
/*****************************************************************************/
/**
*
* This macro enables the deinterlacer algorithms
* This macro enables the Deinterlacer algorithms.
*
* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_Enable(XDeint *InstancePtr);
* @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)
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET), \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET)) | (XDEINT_CTL_ENABLE))
/*****************************************************************************/
/**
*
* This macro disables the deinterlacer algorithms
* This macro disables the Deinterlacer algorithms.
*
* @param InstancePtr is a pointer to the DEINT device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_Disable(XDeint *InstancePtr);
* @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)
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET), \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET)) & (~(XDEINT_CTL_ENABLE)))
/*****************************************************************************/
/**
*
* This macro enables the deinterlacer to accept video
* This macro enables the Deinterlacer core to accept video.
*
* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_Start(XDeint *InstancePtr);
* @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)
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET), \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET)) | (XDEINT_CTL_ACCEPT_VIDEO))
/*****************************************************************************/
/**
*
* This macro halts the deinterlacer on the next frame boundary
* This macro halts the Deinterlacer core on the next frame boundary.
*
* @param InstancePtr is a pointer to the DEINT device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_Stop(XDeint *InstancePtr);
* @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)
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET), \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET)) & \
(~(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...
* 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.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_Reset(XDeint *InstancePtr);
* @note C-style signature:
* void XDeint_Reset(XDeint *InstancePtr)
*
******************************************************************************/
#define XDeint_Reset(InstancePtr) \
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_RESET,XDEINT_RESET_RESET_MASK)
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_RESET_OFFSET), (u32)(XDEINT_RESET_RESET_MASK))
/*****************************************************************************/
/**
*
* This macro returns the current soft-reset state
* This macro returns the current soft-reset state.
*
* @param InstancePtr is a pointer to the DEINT device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return 1=In Reset, 0=Ready.
* @return 1=In Reset, 0=Ready.
*
* @note
* C-style signature:
* void XDeint_InReset(XDeint *InstancePtr);
* @note C-style signature:
* u32 XDeint_InReset(XDeint *InstancePtr)
*
******************************************************************************/
#define XDeint_InReset(InstancePtr) \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_RESET)
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_RESET_OFFSET))
/*****************************************************************************/
/**
*
* 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.
* This macro tells the Deinterlacer core 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.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_RegUpdateReq(XDeint *InstancePtr);
* @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)
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET), \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_CONTROL_OFFSET)) | (XDEINT_CTL_UPDATE_REQ))
/*****************************************************************************/
/**
*
* This macro enables interrupts of an DEINT device.
* This macro enables the given individual interrupt(s) on the
* Deinterlacer core.
*
* @param InstancePtr is a pointer to the DEINT device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param IntrType is the bit-mask of the interrupts to be enabled.
* Bit positions of 1 will be enabled. Bit post ions of 0 will keep
* the previous setting.This mask is formed by OR'ing
* XDEINT_IXR_*_MASK constants defined in xdeint_hw.h to create
* this parameter value.
*
* @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.
*
* @return None
* @note The existing enabled interrupt(s) will remain enabled.
*
* @note
*
* The existing enabled interrupt(s) will remain enabled.
*
* C-style signature:
* void XDeint_IntrEnable(XDeint *InstancePtr, u32 IntrType);
* 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))
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_IER_OFFSET), ((IntrType) & \
(XDEINT_IXR_ALLINTR_MASK)) | \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, (XDEINT_IER_OFFSET)))
/*****************************************************************************/
/**
*
* This macro disables interrupts of an DEINT device.
* This macro disables the given individual interrupt(s) on the
* Deinterlacer core.
*
* @param InstancePtr is a pointer to the DEINT device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param IntrType is the bit-mask of the interrupts to be enabled.
* Bit positions of 1 will be disabled. Bit post ions of 0 will keep
* the previous setting.This mask is formed by OR'ing
* XDEINT_IXR_*_MASK constants defined in xdeint_hw.h to create
* this parameter value.
*
* @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.
*
* @return None
* @note Any other interrupt not covered by parameter IntrType, if
* enabled before this macro is called, will remain enabled.
*
* @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);
* 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))
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_IER_OFFSET), ((~(IntrType)) & \
(XDEINT_IXR_ALLINTR_MASK)) & \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, (XDEINT_ISR_OFFSET)))
/*****************************************************************************/
/**
*
* This macro returns the pending interrupts of an DEINT device.
* This macro returns the pending interrupts of the Deinterlacer core.
*
* @param InstancePtr is a pointer to the DEINT device instance to be worked on.
* @param InstancePtr is a pointer to XDeint 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.
* @return The pending interrupts of the Deinterlacer core. Use
* XDEINT_IXR_*_MASK constants defined in xdeint_hw.h to interpret
* this value.
*
* @note
*
* C-style signature:
* u32 XDeint_IntrGetPending(XDeint *InstancePtr);
* @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)
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_IER_OFFSET)) & \
(XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_ISR_OFFSET)) & (XDEINT_IXR_ALLINTR_MASK))
/*****************************************************************************/
/**
*
* This macro clears/acknowledges pending interrupts of an DEINT device.
* This macro clears/acknowledges pending interrupts of the
* Deinterlacer core.
*
* @param InstancePtr is a pointer to the DEINT device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param IntrType is the pending interrupts to clear/acknowledge.
* Use OR'ing of XDEINT_IXR_*_MASK constants defined in
* xdeint_hw.h to create this parameter value.
*
* @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.
*
* @return None
*
* @note
*
* C-style signature:
* void XDeint_IntrClear(XDeint *InstancePtr, u32 IntrType);
* @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))
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_ISR_OFFSET), (IntrType) & \
(XDeint_IntrGetPending(InstancePtr)))
/*****************************************************************************/
/**
*
* This macro set the deinterlacers colour space RGB.
* This macro sets the Deinterlacer's color space to RGB.
*
* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_Enable(XDeint *InstancePtr);
* @note C-style signature:
* void XDeint_SetRGB(XDeint *InstancePtr)
*
******************************************************************************/
#define XDeint_SetRGB(InstancePtr) \
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE, \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE) \
| XDEINT_MODE_COLOUR_RGB)
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_MODE_OFFSET), \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_MODE_OFFSET)) | (XDEINT_MODE_COLOUR_RGB))
/*****************************************************************************/
/**
*
* This macro set the deinterlacers colour space to YUV.
* This macro sets the Deinterlacer's color space to YUV.
*
* @param InstancePtr is a pointer to the Deinterlacer device instance to be worked on.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_Enable(XDeint *InstancePtr);
* @note C-style signature:
* void XDeint_SetYUV(XDeint *InstancePtr)
*
******************************************************************************/
#define XDeint_SetYUV(InstancePtr) \
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE, \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE) \
& ~XDEINT_MODE_COLOUR_RGB)
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_MODE_OFFSET), \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_MODE_OFFSET)) & (~(XDEINT_MODE_COLOUR_RGB)))
/*****************************************************************************/
/**
*
* This macro set the deinterlacers processing algorithm
* This macro sets the Deinterlacer's 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_????
* @param InstancePtr is a pointer to XDeint instance to be worked on.
* @param Alg is a algorithm setting from XDEINT_MODE_ALGORITHM_????
*
* @return None.
* @return None.
*
* @note
* C-style signature:
* void XDeint_Enable(XDeint *InstancePtr);
* @note C-style signature:
* void XDeint_SetAlgorithm(XDeint *InstancePtr, u32 Alg)
*
******************************************************************************/
#define XDeint_SetAlgorithm(InstancePtr,Alg) \
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE, \
(XDeint_ReadReg((InstancePtr)->Config.BaseAddress, XDEINT_MODE) \
& ~XDEINT_MODE_ALGORITHM_FULL) | Alg)
#define XDeint_SetAlgorithm(InstancePtr, Alg) \
XDeint_WriteReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_MODE_OFFSET), \
(XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_MODE_OFFSET)) & \
(~(XDEINT_MODE_ALGORITHM_FULL))) | \
(Alg))
/*****************************************************************************/
/**
*
* This macro gets the Deinterlacer's color space.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return Returns the color space.
* 0x00000004 - YUV color space,
* 0x00000000 - RGB color space.
*
* @note C-style signature:
* u32 XDeint_GetColorSpace(XDeint *InstancePtr)
*
******************************************************************************/
#define XDeint_GetColorSpace(InstancePtr) \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_MODE_OFFSET)) & (XDEINT_MODE_COLOUR_YUV)
/*****************************************************************************/
/**
*
* This macro gets the Deinterlacer's processing algorithm.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return Returns algorithm for deinterlacing method.
* - 0x00000000 = Pure field interpolating technique is used.
* - 0x00000001 = Diagonal engine is used.
* - 0x00000002 = Motion adaptive engine is used.
* - 0x00000003 = Motion and Diagonal engines are used.
*
* @note C-style signature:
* u32 XDeint_GetAlgorithm(XDeint *InstancePtr)
*
******************************************************************************/
#define XDeint_GetAlgorithm(InstancePtr) \
XDeint_ReadReg((InstancePtr)->Config.BaseAddress, \
(XDEINT_MODE_OFFSET)) & (~(XDEINT_MODE_ALGORITHM_FULL))
/************************** Function Prototypes ******************************/
/*
* Initialization and control functions in xdeint.c
*/
/* Initialization */
int XDeint_ConfigInitialize(XDeint *InstancePtr, XDeint_Config *CfgPtr,
u32 EffectiveAddr);
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);
/* Frame store 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 ThresholdT1,
u32 ThresholdT2);
void XDeint_SetVideo(XDeint *InstancePtr, u32 Packing, u32 Color, u32 Order,
u32 PSF);
/*
* Interrupt related functions in xdeint_intr.c
*/
void XDeint_IntrHandler(void *InstancePtr);
int XDeint_SetCallBack(XDeint *InstancePtr, void *CallBackFunc);
u32 XDeint_GetVideo(XDeint *InstancePtr);
void XDeint_GetPulldown(XDeint *InstancePtr, u32 *Enable_32, u32 *Enable_22);
void XDeint_GetSize(XDeint *InstancePtr, u32 *Width, u32 *Height);
void XDeint_GetThresholds(XDeint *InstancePtr, u32 *ThresholdT1,
u32 *ThresholdT2);
void XDeint_GetFramestore(XDeint *InstancePtr,
u32 *FieldAddr1, u32 *FieldAddr2,
u32 *FieldAddr3, u32 *FrameSize);
u32 XDeint_GetVersion(XDeint *InstancePtr);
int XDeint_Selftest(XDeint *InstancePtr);
#ifdef __cplusplus
}
#endif
#endif /* end of protection macro */
#endif /* End of protection macro */

View file

@ -34,18 +34,19 @@
*
* @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.
* 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.
*
* <pre>
* 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
* 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.2 adk 02/13/14 Adherence to Xilinx coding, Doxygen guidelines.
* </pre>
*
******************************************************************************/
@ -53,15 +54,15 @@
/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xdeint.h"
#include "xparameters.h"
/**
* The configuration table for Video Deinterlacers devices
*/
* The configuration table for Video Deinterlacers devices
*/
XDeint_Config XDeint_ConfigTable[] = {
{
XPAR_DEINTERLACER_0_DEVICE_ID,
XPAR_DEINTERLACER_0_BASEADDR
XPAR_FMC_SENSOR_INPUT_V_DEINTERLACER_1_DEVICE_ID,
XPAR_FMC_SENSOR_INPUT_V_DEINTERLACER_1__BASEADDR
}
};

View file

@ -35,25 +35,29 @@
* @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.
* macros) that can be used to access the Xilinx Video Deinterlacer core.
*
* For more information about the operation of this device, see the hardware
* specification and documentation in the higher level driver xdeint.h source
* For more information about the operation of this core, see the hardware
* specification and documentation in the higher level core xdeint.h source
* code file.
*
* <pre>
* 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
* 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.2 adk 02/13/14 Suffixed "_OFFSET" to all register offset macros.
* Added bit masks for the registers and added
* backward compatibility for macros.
* </pre>
*
******************************************************************************/
#ifndef XDeint_HW_H /* prevent circular inclusions */
#define XDeint_HW_H /* by using protection macros */
#ifndef XDEINT_HW_H
#define XDEINT_HW_H /**< Prevent circular inclusions
* by using protection macros */
#ifdef __cplusplus
extern "C" {
@ -65,180 +69,296 @@ extern "C" {
/************************** Constant Definitions *****************************/
/** @name Register Offsets
/** @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 */
#define XDEINT_CONTROL_OFFSET 0x000 /**< Deinterlacer Main
* Control */
#define XDEINT_MODE_OFFSET 0x004 /**< Deinterlacer internal
* Modes */
#define XDEINT_IER_OFFSET 0x008 /**< Interrupt Enable
* Control */
#define XDEINT_ISR_OFFSET 0x00C /**< Interrupt Enable Status */
#define XDEINT_HEIGHT_OFFSET 0x010 /**< Height */
#define XDEINT_WIDTH_OFFSET 0x014 /**< Width */
#define XDEINT_THRESH1_OFFSET 0x018 /**< T1 Threshold */
#define XDEINT_THRESH2_OFFSET 0x01C /**< T2 Threshold */
#define XDEINT_XFADE_OFFSET 0x020 /**< Cross Fade Ration */
#define XDEINT_BUFFER0_OFFSET 0x024 /**< VFBC Field Buffer 0
* Base */
#define XDEINT_BUFFER1_OFFSET 0x028 /**< VFBC Field Buffer 1
* Base */
#define XDEINT_BUFFER2_OFFSET 0x02C /**< VFBC Field Buffer 2
* Base */
#define XDEINT_BUFSIZE_OFFSET 0x030 /**< VFBC Field Buffer Page
* size in 32bit Words */
#define XDEINT_VER_OFFSET 0x0F0 /**< Hardware Version ID */
#define XDEINT_RESET_OFFSET 0x100 /**< Soft Reset */
/*@}*/
/** @name Interrupt Status/Enable Register bit definition
/** @name Interrupt Status/Enable Register bit definitions:
* @{
*/
#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_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 /**< Pull down
* activated */
#define XDEINT_IXR_PULL_OFF_MASK 0x00000020 /**< Pull down
* cancelled */
#define XDEINT_IXR_FRAME_MASK 0x00000040 /**< Frame Tick */
#define XDEINT_IXR_FS_CFG_ERROR_MASK 0x00000100 /**< Frame store Write
* setup error */
#define XDEINT_IXR_FS_WR_ERROR_MASK 0x00000200 /**< Frame store Write
* FIFO overflow */
#define XDEINT_IXR_FS_RD_FIELD_ERROR_MASK 0x00000400 /**< Frame store Read
* Field under run */
#define XDEINT_IXR_FS_RD_FRAME_ERROR_MASK 0x00000800 /**< Frame store Read
* Frame under run */
#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 */
#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
/** @name Error Status/ bit definitions:
* @{
*/
#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_STS_ERROR_OFFSET 0x00000008 /**< Deinterlacer
* internal FIFO
* error */
#define XDEINT_STS_FS_CFG_ERROR 0x00000100 /**< Frame store Write
* setup error */
#define XDEINT_STS_FS_WR_ERROR 0x00000200 /**< Frame store Write
* FIFO overflow */
#define XDEINT_STS_FS_RD_FIELD_ERROR 0x00000400 /**< Frame store Read
* Field under run */
#define XDEINT_STS_FS_RD_FRAME_ERROR 0x00000800 /**< Frame store Read
* Frame under run */
/*@}*/
#define XDEINT_RESET_RESET_MASK 0x00000001 /**< Software Reset */
#define XDEINT_RESET_RESET_MASK 0x00000001 /**< Software Reset */
/** @name Deinterlacer COntrol Fields
/** @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 */
#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
/** @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 */
#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
/** @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 */
#define XDEINT_MODE_ALGORITHM_0 0x00000001 /**< Deinterlacer
* algorithm */
#define XDEINT_MODE_ALGORITHM_1 0x00000002 /**< Deinterlacer
* algorithm */
#define XDEINT_MODE_COL 0x00000004 /**< Color 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 pass through
* enable */
#define XDEINT_MODE_PULL_32_ENABLE 0x00000080 /**< Pull down 3:2
* control enable */
#define XDEINT_MODE_PULL_22_ENABLE 0x00000100 /**< Pull down 2:2
* control enable */
#define XDEINT_MODE_PULL_22_FIELDP 0x00000200 /**< Pull down 2:2
* Field
* Precedence */
#define XDEINT_MODE_COLOUR_RGB 0x00000000 /**< Deinterlacer
* color space */
#define XDEINT_MODE_COLOUR_YUV 0x00000004 /**< Deinterlacer
* color 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 /**< Color 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 pass through
* enable */
#define XDEINT_MODE_PULL_ENABLE_MASK 0x00000180 /**< Pull down control
* enable */
/*@}*/
/** @name Deinterlacer height bit definitions:
* @{
*/
#define XDEINT_HEIGHT_MASK 0x000007FF /**< Deinterlacer height */
/*@}*/
/** @name Deinterlacer width bit definitions:
* @{
*/
#define XDEINT_WIDTH_MASK 0x000007FF /**< Deinterlacer width */
/*@}*/
/** @name Deinterlacer Threshold T1 /T2 bit definitions:
* @{
*/
#define XDEINT_THRESHOLD_MASK 0x000003FF /**< Deinterlacer threshold */
/*@}*/
/** @name Deinterlacer cross fade cycle bit definitions:
* @{
*/
#define XDEINT_XFADE_MASK 0x0000FFFF /**< Deinterlacer Cross fade
* cycle */
/*@}*/
/** @name Deinterlacer Buffer cycle bit definitions:
* @{
*/
#define XDEINT_BUF_SIZE_MASK 0x00FFFFFF /**< Deinterlacer Buffer
* size mask */
/*@}*/
/* (4096*256) */
#define XDEINT_FADE_RATIO 1048576 /**< Fade ratio */
/**@name Backward compatibility macros
* @{
*/
#define XDEINT_CONTROL XDEINT_CONTROL_OFFSET
#define XDEINT_MODE XDEINT_MODE_OFFSET
#define XDEINT_IER XDEINT_IER_OFFSET
#define XDEINT_ISR XDEINT_ISR_OFFSET
#define XDEINT_HEIGHT XDEINT_HEIGHT_OFFSET
#define XDEINT_WIDTH XDEINT_WIDTH_OFFSET
#define XDEINT_T1 XDEINT_THRESH1_OFFSET
#define XDEINT_T2 XDEINT_THRESH2_OFFSET
#define XDEINT_XFADE XDEINT_XFADE_OFFSET
#define XDEINT_FS_BASE0 XDEINT_BUFFER0_OFFSET
#define XDEINT_FS_BASE1 XDEINT_BUFFER1_OFFSET
#define XDEINT_FS_BASE2 XDEINT_BUFFER2_OFFSET
#define XDEINT_FS_WORDS XDEINT_BUFSIZE_OFFSET
#define XDEINT_VER XDEINT_VER_OFFSET
#define XDEINT_RESET XDEINT_RESET_OFFSET
/*@}*/
/***************** Macros (Inline Functions) Definitions *********************/
/** @name Core register I/O APIs:
* @{
*/
#define XDeint_In32 Xil_In32
#define XDeint_Out32 Xil_Out32
/*****************************************************************************/
/**
*
* This macro reads the given register.
*
* @param BaseAddress is the base address of the core.
* @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) + (u32)(RegOffset))
/*****************************************************************************/
/**
*
* This macro writes the given register.
*
* @param BaseAddress is the base address of the core.
* @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) + (u32)(RegOffset), (Data))
/*@}*/
/**************************** 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 ******************************/
/************************** Variable Declarations ****************************/
#ifdef __cplusplus
}
#endif
#endif /* end of protection macro */
#endif /* End of protection macro */

View file

@ -34,30 +34,47 @@
*
* @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
*
* This code contains internal functions of the Xilinx Video Deinterlacer core.
* The application should not need the functions in this code to control
* the Video Deinterlacer core. Read xdeint.h for detailed information about
* the core.
* <pre>
* Ver Who Date Changes
* ----- ---- -------- -------------------------------------------------------
* 1.00a rjh 07/10/11 First release
* 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00
* 1.00a rjh 07/10/11 First release.
* 2.00a rjh 18/01/12 Updated for v_deinterlacer 2.00.
* 3.2 adk 02/13/14 Added Doxygen support.
* </pre>
*
******************************************************************************/
#ifndef XDeint_I_H /* prevent circular inclusions */
#define XDeint_I_H /* by using protection macros */
#ifndef XDEINT_I_H
#define XDEINT_I_H /**< Prevent circular inclusions
* by using protection macros */
#ifdef __cplusplus
extern "C" {
#endif
/***************************** Include Files *********************************/
/************************** Constant Definitions *****************************/
/* Base address fetch */
#define XDeint_BaseAddr(InstancePtr) ((InstancePtr)->Config.BaseAddress)
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
#ifdef __cplusplus
}
#endif
#endif /* end of protection macro */
#endif /* End of protection macro */

View file

@ -35,27 +35,46 @@
* @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.
* Deinterlacer (DEINT) core. Please see xdeint.h for more details of the core.
*
* <pre>
* 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
* 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.2 adk 02/13/14 Adherence to Xilinx coding, Doxygen guidelines.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xdeint.h"
#include "xil_assert.h"
/************************** Constant Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
/************************** Variable Definitions *****************************/
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This function is the interrupt handler for the Deinterlacer
* This function is the interrupt handler for the Deinterlacer core.
*
* This handler reads the pending interrupt from the IER/ISR, determines the
* source of the interrupts, calls according callback, and finally clears the
@ -63,40 +82,38 @@
*
* 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.
* callbacks to handle interrupts and installing the callbacks using
* XDeint_SetCallBack() during initialization phase.
*
* @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.
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return None.
*
* @note The Error interrupt callback invoked in case an error interrupt
* or spurious interrupt happens should reset the Deinterlacer
* core that just interrupted.
*
******************************************************************************/
void XDeint_IntrHandler(void *InstancePtr)
{
XDeint *XDeintPtr;
u32 PendingIntr;
u32 ErrorStatus;
XDeint *XDeintPtr;
u32 PendingIntr;
/* Validate parameters */
XDeintPtr = (XDeint *) InstancePtr;
Xil_AssertVoid(XDeintPtr != NULL);
Xil_AssertVoid(XDeintPtr->IsReady == XIL_COMPONENT_IS_READY);
/* Verify arguments. */
XDeintPtr = (XDeint *)((void *)InstancePtr);
Xil_AssertVoid(XDeintPtr != NULL);
Xil_AssertVoid(XDeintPtr->IsReady == (u32)(XIL_COMPONENT_IS_READY));
/* Get pending interrupts */
PendingIntr = XDeint_IntrGetPending(XDeintPtr);
/* Get pending interrupts. */
PendingIntr = XDeint_IntrGetPending(XDeintPtr);
/* Clear pending interrupt(s) */
XDeint_IntrClear(XDeintPtr, PendingIntr);
/* A known interrupt has happened. */
if (PendingIntr == (u32)1) {
XDeintPtr->IntCallBack(PendingIntr);
}
/* A known interrupt has happened */
if (PendingIntr)
XDeintPtr->IntCallBack(PendingIntr);
return;
/* Clear pending interrupt(s). */
XDeint_IntrClear(XDeintPtr, PendingIntr);
}
/*****************************************************************************/
@ -104,25 +121,26 @@ void XDeint_IntrHandler(void *InstancePtr)
*
* 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.
* @param InstancePtr is a pointer to 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.
* - 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.
* @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)
int XDeint_SetCallBack(XDeint *InstancePtr, void *CallBackFunc)
{
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Xil_AssertNonvoid(CallBackFunc != NULL);
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady ==
(u32)(XIL_COMPONENT_IS_READY));
Xil_AssertNonvoid(CallBackFunc != NULL);
InstancePtr->IntCallBack = (XDeint_CallBack) CallBackFunc;
InstancePtr->IntCallBack = (XDeint_CallBack)((void *)CallBackFunc);
return XST_SUCCESS;
return (XST_SUCCESS);
}

View file

@ -0,0 +1,105 @@
/******************************************************************************
*
* Copyright (C) 2014 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
/*****************************************************************************/
/**
*
* @file xdeint_selftest.c
*
* This file contains the self-test functions for the XCfa driver.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ----- ---- -------- ----------------------------------------------
* 3.2 adk 02/13/14 First Release.
* Added the XDeint_Selftest function.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xdeint.h"
#include "xstatus.h"
/************************** Constant Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
/************************** Variable Definitions *****************************/
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This function reads Version register of Deinterlacer core and compares
* with zero as part of self test.
*
* @param InstancePtr is a pointer to XDeint instance to be worked on.
*
* @return
* - XST_SUCCESS if the test was successful.
* - XST_FAILURE if the test failed.
*
******************************************************************************/
int XDeint_Selftest(XDeint *InstancePtr)
{
u32 Version;
int Status;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Version = XDeint_ReadReg((InstancePtr)->Config.BaseAddress,
(XDEINT_VER_OFFSET));
/* Compare Version with zero */
if (Version != (u32)0x0) {
Status = (XST_SUCCESS);
}
else {
Status = (XST_FAILURE);
}
return Status;
}

View file

@ -31,66 +31,81 @@
******************************************************************************/
/*****************************************************************************/
/**
*
* @file xdeint_sinit.c
*
* This file contains static initialization methods for Xilinx Video
* Deinterlacer (DEINT) device driver.
*
* <pre>
* 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
* </pre>
*
******************************************************************************/
*
* @file xdeint_sinit.c
*
* This file contains static initialization methods for Xilinx Video
* Deinterlacer (DEINT) core driver.
*
* <pre>
* 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.2 adk 02/13/14 Added Doxygen support, adherence to Xilinx
* coding standards.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xdeint.h"
#include "xparameters.h"
/************************** Constant Definitions *****************************/
/**************************** Type Definitions *******************************/
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
/************************** Variable Definitions *****************************/
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
* XDeint_LookupConfig returns a reference to an XDeint_Config structure
* based on the unique device id, <i>DeviceId</i>. 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 <i>DeviceId</i>,
* or NULL if no match is found.
*
******************************************************************************/
*
* This function returns a reference to an XDeint_Config structure
* based on the unique device id, <i>DeviceId</i>. 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
* <i>DeviceId</i> or NULL if no match is found.
*
* @note None.
*
******************************************************************************/
XDeint_Config *XDeint_LookupConfig(u16 DeviceId)
{
extern XDeint_Config XDeint_ConfigTable[];
extern XDeint_Config XDeint_ConfigTable[XPAR_XDEINT_NUM_INSTANCES];
XDeint_Config *CfgPtr = NULL;
int i;
u32 Index;
for (i = 0; i < XPAR_XDEINT_NUM_INSTANCES; i++) {
if (XDeint_ConfigTable[i].DeviceId == DeviceId) {
CfgPtr = &XDeint_ConfigTable[i];
/* To get the reference pointer to XDeint_Config structure */
for (Index = (u32)0x0; Index < (u32)(XPAR_XDEINT_NUM_INSTANCES);
Index++) {
/* Compare device Id with configTable's device Id */
if (XDeint_ConfigTable[Index].DeviceId == DeviceId) {
CfgPtr = &XDeint_ConfigTable[Index];
break;
}
}
return (CfgPtr);
return (XDeint_Config *)(CfgPtr);
}