scaler: Modified source files.
Modified TCL file, source files, and renamed example.c as scaler_example.c Signed-off-by: Durga challa <vnsldurg@xilinx.com>
This commit is contained in:
parent
d1a911f62c
commit
264d2f6713
10 changed files with 889 additions and 924 deletions
|
@ -33,77 +33,11 @@
|
|||
# Ver Who Date Changes
|
||||
# -------- ------ -------- ------------------------------------
|
||||
# 5.0 adk 12/10/13 Updated as per the New Tcl API's
|
||||
# 7.0 adk 22/08/14 Modified config_files parameters by adding prefix C_.
|
||||
|
||||
proc generate {drv_handle} {
|
||||
xdefine_include_file $drv_handle "xparameters.h" "XSCALER" "NUM_INSTANCES" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_NUM_V_TAPS" "C_NUM_H_TAPS" "C_MAX_PHASES" "C_MAX_COEF_SETS" "C_CHROMA_FORMAT" "C_SEPARATE_YC_COEFS" "C_SEPARATE_HV_COEFS"
|
||||
xdefine_config_file $drv_handle "xscaler_g.c" "XScaler" "DEVICE_ID" "C_BASEADDR" "NUM_V_TAPS" "NUM_H_TAPS" "MAX_PHASES" "MAX_COEF_SETS" "C_CHROMA_FORMAT" "C_SEPARATE_YC_COEFS" "C_SEPARATE_HV_COEFS"
|
||||
xdefine_config_file $drv_handle "xscaler_g.c" "XScaler" "DEVICE_ID" "C_BASEADDR" "C_NUM_V_TAPS" "C_NUM_H_TAPS" "C_MAX_PHASES" "C_MAX_COEF_SETS" "C_CHROMA_FORMAT" "C_SEPARATE_YC_COEFS" "C_SEPARATE_HV_COEFS"
|
||||
xdefine_canonical_xpars $drv_handle "xparameters.h" "XScaler" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_NUM_V_TAPS" "C_NUM_H_TAPS" "C_MAX_PHASES" "C_MAX_COEF_SETS" "C_CHROMA_FORMAT" "C_SEPARATE_YC_COEFS" "C_SEPARATE_HV_COEFS"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Given a list of arguments, define each as a canonical constant name, using
|
||||
# the driver name, in an include file.
|
||||
#
|
||||
proc xdefine_canonical_xpars {drv_handle file_name drv_string args} {
|
||||
# Open include file
|
||||
set file_handle [::hsm::utils::open_include_file $file_name]
|
||||
|
||||
# Get all the peripherals connected to this driver
|
||||
set periphs [::hsm::utils::get_common_driver_ips $drv_handle]
|
||||
|
||||
# Get the names of all the peripherals connected to this driver
|
||||
foreach periph $periphs {
|
||||
set peripheral_name [string toupper [get_property NAME $periph]]
|
||||
lappend peripherals $peripheral_name
|
||||
}
|
||||
|
||||
# Get possible canonical names for all the peripherals connected to this driver
|
||||
set device_id 0
|
||||
foreach periph $periphs {
|
||||
set canonical_name [string toupper [format "%s_%s" $drv_string $device_id]]
|
||||
lappend canonicals $canonical_name
|
||||
|
||||
# Create a list of IDs of the peripherals whose hardware instance name
|
||||
# doesn't match the canonical name. These IDs can be used later to
|
||||
# generate canonical definitions
|
||||
if { [lsearch $peripherals $canonical_name] < 0 } {
|
||||
lappend indices $device_id
|
||||
}
|
||||
incr device_id
|
||||
}
|
||||
|
||||
set i 0
|
||||
foreach periph $periphs {
|
||||
set periph_name [string toupper [get_property NAME $periph]]
|
||||
|
||||
# Generate canonical definitions only for the peripherals whose
|
||||
# canonical name is not the same as hardware instance name
|
||||
if { [lsearch $canonicals $periph_name] < 0 } {
|
||||
puts $file_handle "/* Canonical definitions for peripheral $periph_name */"
|
||||
set canonical_name [format "%s_%s" $drv_string [lindex $indices $i]]
|
||||
|
||||
foreach arg $args {
|
||||
set lvalue [::hsm::utils::get_driver_param_name $canonical_name $arg]
|
||||
|
||||
# The commented out rvalue is the name of the instance-specific constant
|
||||
# set rvalue [::hsm::utils::get_ip_param_name $periph $arg]
|
||||
|
||||
# The rvalue set below is the actual value of the parameter
|
||||
set rvalue [get_property CONFIG.$arg $periph]
|
||||
if {[llength $rvalue] == 0} {
|
||||
set rvalue 0
|
||||
}
|
||||
set rvalue [::hsm::utils::format_addr_string $rvalue $arg]
|
||||
|
||||
puts $file_handle "#define $lvalue $rvalue"
|
||||
|
||||
}
|
||||
puts $file_handle ""
|
||||
incr i
|
||||
}
|
||||
}
|
||||
|
||||
puts $file_handle "\n/******************************************************************/\n"
|
||||
close $file_handle
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
<link rel="stylesheet" type="text/css" href="../help.css">
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF">
|
||||
<h1> Example Applications for the driver scaler_v5_0 </h1>
|
||||
<h1> Example Applications for the driver scaler_v7_0 </h1>
|
||||
<HR>
|
||||
<ul>
|
||||
<li>example.c <a href="example.c">(source)</a> </li>
|
||||
<li>scaler_example.c <a href="scaler_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>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file example.c
|
||||
* @file scaler_example.c
|
||||
*
|
||||
* This file demonstrates how to use Xilinx XScaler driver on Xilinx MVI Video
|
||||
* Scaler core. This code does not cover the Video DMA (VDMA) setup and any
|
||||
|
@ -46,9 +46,14 @@
|
|||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- ------------------------------------------------------
|
||||
* 1.00a xd 02/09/09 First release
|
||||
* Ver Who Date Changes
|
||||
* ----- --- -------- ------------------------------------------------------
|
||||
* 1.00a xd 02/09/09 First release
|
||||
* 7.00 adk 22/08/14 Renamed example.c to scaler_example.c
|
||||
* XPAR_SCALER_0_DEVICE_ID is changed to
|
||||
* XPAR_XSCALER_0_DEVICE_ID.
|
||||
* Chaged typecast of XScaler_CoefValueLookup from u16 to
|
||||
* s16.
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -59,7 +64,7 @@
|
|||
/*
|
||||
* Device related constants. Defined in xparameters.h.
|
||||
*/
|
||||
#define SCALER_DEVICE_ID XPAR_SCALER_0_DEVICE_ID
|
||||
#define SCALER_DEVICE_ID XPAR_XSCALER_0_DEVICE_ID
|
||||
|
||||
/*
|
||||
* Index of Coefficient Set to load and use
|
||||
|
@ -106,7 +111,7 @@ int main(void)
|
|||
if (Status != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("\n Successfully ran Scaler example \n");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -41,18 +41,31 @@
|
|||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00a xd 02/10/09 First release
|
||||
* 2.00a xd 12/14/09 Updated doxygen document tags
|
||||
* 4.01a cw 06/27/12 Updated tcl file with new parameter names (num_x_taps)
|
||||
Updated mdd file with updated supported_peripherals field.
|
||||
* 4.02a mpv 03/11/13 Updated the Driver to select the correct coeff bin.
|
||||
* Changed RegValue variable to a volatile type
|
||||
* Removed 10.x patch in the Tcl file
|
||||
* 4.03a mpv 05/28/13 Fixed version limit in MDD file
|
||||
* Updated the Driver input, output and aperture size mask
|
||||
* 5.00a mpv 12/13/13 Updated to dynamic coeff generation to reduce driver size
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00a xd 02/10/09 First release
|
||||
* 2.00a xd 12/14/09 Updated Doxygen document tags
|
||||
* 4.01a cw 06/27/12 Updated tcl file with new parameter names (num_x_taps)
|
||||
* Updated mdd file with updated supported_peripherals
|
||||
* field.
|
||||
* 4.02a mpv 03/11/13 Updated the Driver to select the correct coeff bin.
|
||||
* Changed RegValue variable to a volatile type
|
||||
* Removed 10.x patch in the Tcl file
|
||||
* 4.03a mpv 05/28/13 Fixed version limit in MDD file
|
||||
* Updated the Driver input, output and aperture size
|
||||
* mask
|
||||
* 5.00a mpv 12/13/13 Updated to dynamic coeff generation to reduce driver
|
||||
* size
|
||||
* 7.0 adk 08/22/14 Modified prototype of XScaler_GetVersion API.
|
||||
* and functionality of StubCallBack. Modified assert
|
||||
* conditions in functions XScaler_CfgInitialize,
|
||||
* XScaler_SetPhaseNum, XScaler_LoadCoeffBank.
|
||||
* Removed error callback from XScaler_CfgInitialize
|
||||
* function.
|
||||
* Uncommented XScaler_Reset in XScaler_CfgInitialize
|
||||
* function.
|
||||
* Removed ErrorMask parameter in StubCallBack as there
|
||||
* was only one interrupt.
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
@ -82,14 +95,12 @@
|
|||
* This macro calculates the integral value nearest to x rounding half-way cases
|
||||
* away from zero, regardless of the current rounding direction.
|
||||
*
|
||||
* @param x has a float type value
|
||||
* @param x has a float type value
|
||||
*
|
||||
* @return the integral value nearest to x rounding half-way cases away from
|
||||
* zero, regardless of the current rounding direction.
|
||||
* @return The integral value nearest to x rounding half-way cases away
|
||||
* from zero, regardless of the current rounding direction.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* s32 round(float x);
|
||||
* @note C-style signature: s32 round(float x);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define round(x) ((x) >= 0 ? (s32)((x) + 0.5) : (s32)((x) - 0.5))
|
||||
|
@ -99,7 +110,7 @@
|
|||
/************************** Function Prototypes ******************************/
|
||||
|
||||
static u32 XScaler_CoeffBinOffset(u32 InSize, u32 OutSize);
|
||||
static void StubCallBack(void *CallBackRef, u32 Mask);
|
||||
static void StubCallBack(void *CallBackRef);
|
||||
|
||||
/************************* Data Structure Definitions ************************/
|
||||
|
||||
|
@ -125,15 +136,18 @@ extern s16 *XScaler_GenCoefTable(u32 Tap, u32 Phase);
|
|||
* prior to using a Scaler device. Initialization of a Scaler includes setting
|
||||
* up the instance data, and ensuring the hardware is in a quiescent state.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param CfgPtr points to the configuration structure associated with the
|
||||
* Scaler 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
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param CfgPtr points to the configuration structure associated with
|
||||
* the Scaler 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
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int XScaler_CfgInitialize(XScaler *InstancePtr, XScaler_Config *CfgPtr,
|
||||
|
@ -144,16 +158,12 @@ int XScaler_CfgInitialize(XScaler *InstancePtr, XScaler_Config *CfgPtr,
|
|||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(CfgPtr != NULL);
|
||||
|
||||
Xil_AssertNonvoid(CfgPtr->MaxPhaseNum > 0);
|
||||
Xil_AssertNonvoid(CfgPtr->MaxPhaseNum <= XSCL_MAX_PHASE_NUM);
|
||||
|
||||
Xil_AssertNonvoid(CfgPtr->HoriTapNum > 0);
|
||||
Xil_AssertNonvoid(CfgPtr->HoriTapNum <= XSCL_MAX_TAP_NUM);
|
||||
|
||||
Xil_AssertNonvoid(CfgPtr->VertTapNum > 0);
|
||||
Xil_AssertNonvoid(CfgPtr->VertTapNum <= XSCL_MAX_TAP_NUM);
|
||||
|
||||
Xil_AssertNonvoid(CfgPtr->CoeffSetNum > 0);
|
||||
Xil_AssertNonvoid(CfgPtr->CoeffSetNum <= XSCL_MAX_COEFF_SET_NUM);
|
||||
|
||||
Xil_AssertNonvoid(EffectiveAddr != (u32)NULL);
|
||||
|
@ -166,13 +176,12 @@ int XScaler_CfgInitialize(XScaler *InstancePtr, XScaler_Config *CfgPtr,
|
|||
|
||||
/* Set all handlers to stub values, let user configure this data later
|
||||
*/
|
||||
InstancePtr->EventCallBack = (XScaler_CallBack)StubCallBack;
|
||||
InstancePtr->ErrorCallBack = (XScaler_CallBack)StubCallBack;
|
||||
InstancePtr->CallBack = (XScaler_CallBack)StubCallBack;
|
||||
|
||||
/* Reset the hardware and set the flag to indicate the driver is ready
|
||||
*/
|
||||
|
||||
//XScaler_Reset(InstancePtr);
|
||||
XScaler_Reset(InstancePtr);
|
||||
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
@ -185,11 +194,14 @@ int XScaler_CfgInitialize(XScaler *InstancePtr, XScaler_Config *CfgPtr,
|
|||
* calculates the scale factor accordingly based on the aperture setting and
|
||||
* sets up the Scaler appropriately.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param AperturePtr points to the aperture setting structure to set up
|
||||
* the Scaler device.
|
||||
* @return XST_SUCCESS
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param AperturePtr points to the aperture setting structure to set up
|
||||
* the Scaler device.
|
||||
*
|
||||
* @return XST_SUCCESS.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int XScaler_SetAperture(XScaler *InstancePtr, XScalerAperture *AperturePtr)
|
||||
|
@ -273,18 +285,20 @@ int XScaler_SetAperture(XScaler *InstancePtr, XScalerAperture *AperturePtr)
|
|||
& XSCL_SRCSIZE_NUMLINE_MASK;
|
||||
|
||||
/* Set up aperture related register in the Scaler */
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_APTVERT, InLine);
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_APTHORI, InPixel);
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_OUTSIZE, OutSize);
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_SRCSIZE, SrcSize);
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_HSF, (u32)(round(HoriScaleFactor)));
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_VSF, (u32)(round(VertScaleFactor)));
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_APTVERT_OFFSET), InLine);
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_APTHORI_OFFSET), InPixel);
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_OUTSIZE_OFFSET), OutSize);
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_SRCSIZE_OFFSET), SrcSize);
|
||||
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_HSF_OFFSET), (u32)(round(HoriScaleFactor)));
|
||||
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_VSF_OFFSET), (u32)(round(VertScaleFactor)));
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
@ -294,11 +308,14 @@ int XScaler_SetAperture(XScaler *InstancePtr, XScalerAperture *AperturePtr)
|
|||
* This function gets aperture of a Scaler device. The aperture setting
|
||||
* consists of input video aperture and output video size.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param AperturePtr points to the aperture structure to store the current
|
||||
* Scaler device setting after this function returns.
|
||||
* @return None
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param AperturePtr points to the aperture structure to store the
|
||||
* current Scaler device setting after this function returns.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void XScaler_GetAperture(XScaler *InstancePtr, XScalerAperture *AperturePtr)
|
||||
|
@ -338,7 +355,6 @@ void XScaler_GetAperture(XScaler *InstancePtr, XScalerAperture *AperturePtr)
|
|||
(OutSize & XSCL_OUTSIZE_NUMLINE_MASK) >>
|
||||
XSCL_OUTSIZE_NUMLINE_SHIFT;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -346,11 +362,14 @@ void XScaler_GetAperture(XScaler *InstancePtr, XScalerAperture *AperturePtr)
|
|||
* This function sets the numbers of vertical and horizontal phases to be used
|
||||
* by a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param VertPhaseNum is the number of vertical phase to set to
|
||||
* @param HoriPhaseNum is the number of horizontal phase to set to
|
||||
* @return None
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param VertPhaseNum is the number of vertical phase to set to
|
||||
* @param HoriPhaseNum is the number of horizontal phase to set to
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void XScaler_SetPhaseNum(XScaler *InstancePtr, u16 VertPhaseNum,
|
||||
|
@ -361,8 +380,6 @@ void XScaler_SetPhaseNum(XScaler *InstancePtr, u16 VertPhaseNum,
|
|||
/* Assert bad arguments and conditions */
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
Xil_AssertVoid(VertPhaseNum > 0);
|
||||
Xil_AssertVoid(HoriPhaseNum > 0);
|
||||
Xil_AssertVoid(VertPhaseNum <= InstancePtr->Config.MaxPhaseNum);
|
||||
Xil_AssertVoid(HoriPhaseNum <= InstancePtr->Config.MaxPhaseNum);
|
||||
|
||||
|
@ -373,10 +390,8 @@ void XScaler_SetPhaseNum(XScaler *InstancePtr, u16 VertPhaseNum,
|
|||
PhaseRegValue |= HoriPhaseNum & XSCL_NUMPHASE_HORI_MASK;
|
||||
|
||||
/* Set up the Scaler core using the numbers of phases */
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_NUMPHASE,
|
||||
PhaseRegValue);
|
||||
|
||||
return;
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_NUMPHASE_OFFSET), PhaseRegValue);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -384,13 +399,16 @@ void XScaler_SetPhaseNum(XScaler *InstancePtr, u16 VertPhaseNum,
|
|||
* This function gets the numbers of vertical and horizontal phases currently
|
||||
* used by a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param VertPhaseNumPtr will point to the number of vertical phases used
|
||||
* after this function returns.
|
||||
* @param HoriPhaseNumPtr will point to the number of horizontal phases used
|
||||
* after this function returns.
|
||||
* @return None
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param VertPhaseNumPtr will point to the number of vertical phases
|
||||
* used after this function returns.
|
||||
* @param HoriPhaseNumPtr will point to the number of horizontal phases
|
||||
* used after this function returns.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void XScaler_GetPhaseNum(XScaler *InstancePtr, u16 *VertPhaseNumPtr,
|
||||
|
@ -405,8 +423,8 @@ void XScaler_GetPhaseNum(XScaler *InstancePtr, u16 *VertPhaseNumPtr,
|
|||
Xil_AssertVoid(HoriPhaseNumPtr != NULL);
|
||||
|
||||
/* Get the value of "Number of Phases Register" */
|
||||
PhaseRegValue = XScaler_ReadReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_NUMPHASE);
|
||||
PhaseRegValue = XScaler_ReadReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_NUMPHASE_OFFSET));
|
||||
|
||||
/* Parse the value and store the results */
|
||||
*VertPhaseNumPtr =
|
||||
|
@ -414,7 +432,6 @@ void XScaler_GetPhaseNum(XScaler *InstancePtr, u16 *VertPhaseNumPtr,
|
|||
XSCL_NUMPHASE_VERT_SHIFT;
|
||||
*HoriPhaseNumPtr = PhaseRegValue & XSCL_NUMPHASE_HORI_MASK;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -422,11 +439,14 @@ void XScaler_GetPhaseNum(XScaler *InstancePtr, u16 *VertPhaseNumPtr,
|
|||
* This function sets up Luma and Chroma start fractional values used by a
|
||||
* Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param StartFractionPtr is a pointer to a start fractional value set to be
|
||||
* used.
|
||||
* @return None
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param StartFractionPtr is a pointer to a start fractional value set
|
||||
* to be used.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void XScaler_SetStartFraction(XScaler *InstancePtr,
|
||||
|
@ -438,11 +458,13 @@ void XScaler_SetStartFraction(XScaler *InstancePtr,
|
|||
Xil_AssertVoid(StartFractionPtr != NULL);
|
||||
|
||||
/* Set up the fractional values */
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_FRCTLUMALEFT,
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_FRCTLUMALEFT_OFFSET,
|
||||
(u32)StartFractionPtr->LumaLeftHori &
|
||||
XSCL_FRCTLUMALEFT_VALUE_MASK);
|
||||
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_FRCTLUMATOP,
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_FRCTLUMATOP_OFFSET,
|
||||
(u32)StartFractionPtr->LumaTopVert &
|
||||
XSCL_FRCTLUMATOP_VALUE_MASK);
|
||||
|
||||
|
@ -451,11 +473,11 @@ void XScaler_SetStartFraction(XScaler *InstancePtr,
|
|||
(u32)StartFractionPtr->ChromaLeftHori &
|
||||
XSCL_FRCTCHROMALEFT_VALUE_MASK);
|
||||
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_FRCTCHROMATOP,
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_FRCTCHROMATOP_OFFSET,
|
||||
(u32)StartFractionPtr->ChromaTopVert &
|
||||
XSCL_FRCTCHROMATOP_VALUE_MASK);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -463,12 +485,15 @@ void XScaler_SetStartFraction(XScaler *InstancePtr,
|
|||
* This function gets Luma and Chroma start fractional values currently used
|
||||
* by a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param StartFractionPtr is a pointer to a start fractional value structure
|
||||
* to be populated with the fractional values after this function
|
||||
* returns.
|
||||
* @return None
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param StartFractionPtr is a pointer to a start fractional value
|
||||
* structure to be populated with the fractional values after this
|
||||
* function returns.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void XScaler_GetStartFraction(XScaler *InstancePtr,
|
||||
|
@ -482,25 +507,24 @@ void XScaler_GetStartFraction(XScaler *InstancePtr,
|
|||
/* Fetch the fractional values */
|
||||
StartFractionPtr->LumaLeftHori = (s32)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_FRCTLUMALEFT)
|
||||
XSCL_FRCTLUMALEFT_OFFSET)
|
||||
& XSCL_FRCTLUMALEFT_VALUE_MASK;
|
||||
|
||||
StartFractionPtr->LumaTopVert = (s32)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_FRCTLUMATOP)
|
||||
XSCL_FRCTLUMATOP_OFFSET)
|
||||
& XSCL_FRCTLUMATOP_VALUE_MASK;
|
||||
|
||||
StartFractionPtr->ChromaLeftHori = (s32)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_FRCTCHROMALEFT)
|
||||
XSCL_FRCTCHROMALEFT_OFFSET)
|
||||
& XSCL_FRCTCHROMALEFT_VALUE_MASK;
|
||||
|
||||
StartFractionPtr->ChromaTopVert = (s32)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_FRCTCHROMATOP)
|
||||
XSCL_FRCTCHROMATOP_OFFSET)
|
||||
& XSCL_FRCTCHROMATOP_VALUE_MASK;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -508,28 +532,32 @@ void XScaler_GetStartFraction(XScaler *InstancePtr,
|
|||
* This function fetches the color space format and coefficient bank sharing
|
||||
* decisions made on a Scaler device at build-time.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param ChromaFormat points to an 8-bit variable that will be assigned with
|
||||
* the Chroma format chosen for the Scaler device at the build time
|
||||
* after this function returns. Please use XSCL_CHROMA_FORMAT_* defined
|
||||
* in xscaler_hw.h to interpret the variable value.
|
||||
* @param ChromaLumaShareCoeff points to an 8-bit variable that will be
|
||||
* assigned by this function with the decision value on coefficient
|
||||
* bank sharing between Chroma and Luma filter operations. The decision
|
||||
* is made for the Scaler device at build time and can NOT be changed
|
||||
* at run-time. Value 0 indicates that each of Chroma and Luma filter
|
||||
* operations has its own coefficient bank. Value 1 indicates that
|
||||
* Chroma and Luma filter operations share one common coefficient bank.
|
||||
* @param HoriVertShareCoeff points to an 8-bit variable that will be
|
||||
* assigned by this function with the decision value on coefficient
|
||||
* bank sharing between Horizontal and Vertical filter operations. The
|
||||
* decision is made for the Scaler device at build time and can NOT
|
||||
* be changed at run-time. Value 0 indicates that each of Horizontal
|
||||
* and Vertical filter operations has its own coefficient bank. Value 1
|
||||
* indicates that Horizontal and Vertical filter operations share one
|
||||
* common coefficient bank.
|
||||
* @return None.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param ChromaFormat points to an 8-bit variable that will be assigned
|
||||
* with the Chroma format chosen for the Scaler device at the
|
||||
* build time after this function returns. Please use
|
||||
* XSCL_CHROMA_FORMAT_* defined in xscaler_hw.h to interpret the
|
||||
* variable value.
|
||||
* @param ChromaLumaShareCoeff points to an 8-bit variable that will be
|
||||
* assigned by this function with the decision value on coefficient
|
||||
* bank sharing between Chroma and Luma filter operations. The
|
||||
* decision is made for the Scaler device at build time and can
|
||||
* NOT be changed at run-time. Value 0 indicates that each of Chroma
|
||||
* and Luma filter operations has its own coefficient bank. Value
|
||||
* 1 indicates that Chroma and Luma filter operations share one
|
||||
* common coefficient bank.
|
||||
* @param HoriVertShareCoeff points to an 8-bit variable that will be
|
||||
* assigned by this function with the decision value on coefficient
|
||||
* bank sharing between Horizontal and Vertical filter operations.
|
||||
* The decision is made for the Scaler device at build time and
|
||||
* can NOT be changed at run-time. Value 0 indicates that each of
|
||||
* Horizontal and Vertical filter operations has its own
|
||||
* coefficient bank. Value 1 indicates that Horizontal and
|
||||
* Vertical filter operations share one common coefficient bank.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* !!!IMPORTANT!!!
|
||||
|
@ -619,7 +647,6 @@ void XScaler_GetCoeffBankSharingInfo(XScaler *InstancePtr,
|
|||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -627,12 +654,15 @@ void XScaler_GetCoeffBankSharingInfo(XScaler *InstancePtr,
|
|||
* This function returns the pointer to the coefficients for a scaling
|
||||
* operation given input/output sizes and the Tap and Phase numbers.
|
||||
*
|
||||
* @param InSize indicates the size (width or height) of the input video.
|
||||
* @param OutSize indicates the size (width or height) of the output video.
|
||||
* @param Tap indicates the Tap number.
|
||||
* @param Phase indicates the Phase number.
|
||||
* @return The points to the coefficients ready for the scaling operation.
|
||||
* @note None.
|
||||
* @param InSize indicates the size (width or height) of the input video.
|
||||
* @param OutSize indicates the size (width or height) of the output
|
||||
* video.
|
||||
* @param Tap indicates the Tap number.
|
||||
* @param Phase indicates the Phase number.
|
||||
*
|
||||
* @return The points to the coefficients ready for the scaling operation.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
s16 *XScaler_CoefValueLookup(u32 InSize, u32 OutSize, u32 Tap, u32 Phase)
|
||||
|
@ -676,10 +706,12 @@ s16 *XScaler_CoefValueLookup(u32 InSize, u32 OutSize, u32 Tap, u32 Phase)
|
|||
* XScaler_LoadCoeffBank(&Scaler, &VertChromaCoeffBank);
|
||||
* </pre>
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param CoeffBankPtr is a pointer to a coefficient bank that is to be loaded
|
||||
* @return None
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param CoeffBankPtr is a pointer to a coefficient bank that is to be
|
||||
* loaded.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void XScaler_LoadCoeffBank(XScaler *InstancePtr,
|
||||
|
@ -696,16 +728,17 @@ void XScaler_LoadCoeffBank(XScaler *InstancePtr,
|
|||
Xil_AssertVoid(CoeffBankPtr != NULL);
|
||||
Xil_AssertVoid(CoeffBankPtr->SetIndex < InstancePtr->Config.CoeffSetNum);
|
||||
Xil_AssertVoid(CoeffBankPtr->CoeffValueBuf != NULL);
|
||||
Xil_AssertVoid(CoeffBankPtr->PhaseNum > 0);
|
||||
|
||||
Xil_AssertVoid(CoeffBankPtr->PhaseNum <=
|
||||
InstancePtr->Config.MaxPhaseNum);
|
||||
Xil_AssertVoid(CoeffBankPtr->TapNum > 0);
|
||||
|
||||
Xil_AssertVoid(CoeffBankPtr->TapNum <= XSCL_MAX_TAP_NUM);
|
||||
|
||||
/* Start the coefficient bank loading by writing the bank index first
|
||||
*/
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_COEFFSETADDR,
|
||||
CoeffBankPtr->SetIndex & XSCL_COEFFSETADDR_ADDR_MASK);
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_COEFFSETADDR_OFFSET), ((CoeffBankPtr->SetIndex) &
|
||||
(XSCL_COEFFSETADDR_ADDR_MASK)));
|
||||
|
||||
/* Now load the valid values */
|
||||
CoeffValueTapBase = CoeffBankPtr->CoeffValueBuf;
|
||||
|
@ -719,8 +752,8 @@ void XScaler_LoadCoeffBank(XScaler *InstancePtr,
|
|||
(((u32)CoeffValueTapBase[TapIndex++]) &
|
||||
0xFFFF) << 16;
|
||||
}
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_COEFFVALUE, CoeffValue);
|
||||
XScaler_WriteReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_COEFFVALUE_OFFSET), CoeffValue);
|
||||
}
|
||||
CoeffValueTapBase += CoeffBankPtr->TapNum;
|
||||
}
|
||||
|
@ -734,11 +767,10 @@ void XScaler_LoadCoeffBank(XScaler *InstancePtr,
|
|||
for (TapIndex = 0; TapIndex < (CoeffBankPtr->TapNum + 1) / 2;
|
||||
TapIndex++) {
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_COEFFVALUE, 0);
|
||||
XSCL_COEFFVALUE_OFFSET, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -752,22 +784,20 @@ void XScaler_LoadCoeffBank(XScaler *InstancePtr,
|
|||
* the vertical part and the Scaler device supports using the horizontal part
|
||||
* of one coefficient set w/ the vertical part of a different coefficient set.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param VertSetIndex indicates the index of the coefficient set in which
|
||||
* the vertical part will be used by the Scaler device. Valid value
|
||||
* is from 0 to (the number of the coefficient sets implemented by
|
||||
* the Scaler device - 1).
|
||||
* @param HoriSetIndex indicates the index of the coefficient set in which
|
||||
* the horizontal part will be used by the Scaler device. Valid
|
||||
* value is from 0 to (the number of the coefficient sets
|
||||
* implemented by the Scaler device - 1).
|
||||
*
|
||||
* @param VertSetIndex indicates the index of the coefficient set in which
|
||||
* the vertical part will be used by the Scaler device. Valid value
|
||||
* is from 0 to (the number of the coefficient sets implemented by the
|
||||
* Scaler device - 1)
|
||||
* @return None.
|
||||
*
|
||||
* @param HoriSetIndex indicates the index of the coefficient set in which
|
||||
* the horizontal part will be used by the Scaler device. Valid value
|
||||
* is from 0 to (the number of the coefficient sets implemented by the
|
||||
* Scaler device - 1)
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void XScaler_SetActiveCoeffSet(XScaler *InstancePtr,
|
||||
|
@ -787,9 +817,8 @@ void XScaler_SetActiveCoeffSet(XScaler *InstancePtr,
|
|||
XSCL_COEFFSETS_VERT_MASK;
|
||||
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress,
|
||||
XSCL_COEFFSETS, RegValue);
|
||||
XSCL_COEFFSETS_OFFSET, RegValue);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -803,25 +832,23 @@ void XScaler_SetActiveCoeffSet(XScaler *InstancePtr,
|
|||
* the vertical part and the Scaler device supports using the horizontal part
|
||||
* of one coefficient set w/ the vertical part of a different coefficient set.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
* @param VertSetIndexPtr points to the index of the active coefficient
|
||||
* set in which the vertical part is being used by the Scaler
|
||||
* device after this function returns.
|
||||
* @param HoriSetIndexPtr points to the index of the active coefficient
|
||||
* set in which the horizontal part is being used by the Scaler
|
||||
* device after this function returns.
|
||||
*
|
||||
* @param VertSetIndexPtr points to the index of the active coefficient set
|
||||
* in which the vertical part is being used by the Scaler device
|
||||
* after this function returns.
|
||||
* @return None.
|
||||
*
|
||||
* @param HoriSetIndexPtr points to the index of the active coefficient set
|
||||
* in which the horizontal part is being used by the Scaler device
|
||||
* after this function returns.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void XScaler_GetActiveCoeffSet(XScaler *InstancePtr,
|
||||
u8 *VertSetIndexPtr,
|
||||
u8 *HoriSetIndexPtr)
|
||||
u8 *VertSetIndexPtr,
|
||||
u8 *HoriSetIndexPtr)
|
||||
{
|
||||
u32 RegValue;
|
||||
|
||||
|
@ -840,7 +867,6 @@ void XScaler_GetActiveCoeffSet(XScaler *InstancePtr,
|
|||
|
||||
*HoriSetIndexPtr = (u8)(RegValue & XSCL_COEFFSETS_HORI_MASK);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -848,9 +874,11 @@ void XScaler_GetActiveCoeffSet(XScaler *InstancePtr,
|
|||
* This function calculates the index of the coefficient Bin to use based on
|
||||
* the input and output video size (Width or Height)
|
||||
*
|
||||
* @param InSize indicates the size (width or height) of the input video.
|
||||
* @param OutSize indicates the size (width or height) of the output video.
|
||||
* @return The index of the coefficient Bin.
|
||||
* @param InSize indicates the size (width or height) of the input video.
|
||||
* @param OutSize indicates the size (width or height) of the output
|
||||
* video.
|
||||
*
|
||||
* @return The index of the coefficient Bin.
|
||||
*
|
||||
*****************************************************************************/
|
||||
static u32 XScaler_CoeffBinOffset(u32 InSize, u32 OutSize)
|
||||
|
@ -864,7 +892,7 @@ static u32 XScaler_CoeffBinOffset(u32 InSize, u32 OutSize)
|
|||
if (OutSize > InSize)
|
||||
CoeffBinIndex = 0;
|
||||
else
|
||||
CoeffBinIndex =1 + (OutSize * 16 / InSize);
|
||||
CoeffBinIndex = 1 + (OutSize * 16 / InSize);
|
||||
|
||||
return CoeffBinIndex;
|
||||
}
|
||||
|
@ -872,63 +900,49 @@ static u32 XScaler_CoeffBinOffset(u32 InSize, u32 OutSize)
|
|||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function returns the version of a Scaler device.
|
||||
* This function returns the contents of version register of the Scaler core.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler 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 the Scaler core instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return Contents of the version register.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
//void XScaler_GetVersion(XScaler *InstancePtr, u16 *Major, u16 *Minor,
|
||||
// u16 *Revision)
|
||||
//{
|
||||
// u32 Version;
|
||||
//
|
||||
// /* Verify arguments */
|
||||
// Xil_AssertVoid(InstancePtr != NULL);
|
||||
// Xil_AssertVoid(Major != NULL);
|
||||
// Xil_AssertVoid(Minor != NULL);
|
||||
// Xil_AssertVoid(Revision != NULL);
|
||||
//
|
||||
// /* Read device version */
|
||||
// Version = XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_VER);
|
||||
//
|
||||
// /* Parse the version and pass the info to the caller via output
|
||||
// * parameters
|
||||
// */
|
||||
// *Major = (u16)
|
||||
// ((Version & XSCL_VER_MAJOR_MASK) >> XSCL_VER_MAJOR_SHIFT);
|
||||
//
|
||||
// *Minor = (u16)
|
||||
// ((Version & XSCL_VER_MINOR_MASK) >> XSCL_VER_MINOR_SHIFT);
|
||||
//
|
||||
// *Revision = (u16)
|
||||
// ((Version & XSCL_VER_REV_MASK) >> XSCL_VER_REV_SHIFT);
|
||||
//
|
||||
// return;
|
||||
//}
|
||||
u32 XScaler_GetVersion(XScaler *InstancePtr)
|
||||
{
|
||||
u32 Data;
|
||||
|
||||
/* Verify arguments. */
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
|
||||
Data = XScaler_ReadReg(InstancePtr->Config.BaseAddress,
|
||||
(XSCL_VER_OFFSET));
|
||||
|
||||
return Data;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* This routine is a stub for the frame done interrupt callback. The stub is
|
||||
* here in case the upper layer forgot to set the callback. On initialization,
|
||||
* the frame done interrupt callback is set to this stub. It is considered an
|
||||
* error for this function to be invoked.
|
||||
*
|
||||
*****************************************************************************/
|
||||
static void StubCallBack(void *CallBackRef, u32 EventMask)
|
||||
*
|
||||
* This routine is a stub for the frame done interrupt callback. The stub is
|
||||
* here in case the upper layer forgot to set the callback. On initialization,
|
||||
* the frame done interrupt callback is set to this stub. It is considered an
|
||||
* error for this function to be invoked.
|
||||
*
|
||||
* @param CallBackRef is a callback reference passed in by the upper
|
||||
* layer when setting the callback functions, and passed back
|
||||
* to the upper layer when the callback is invoked.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
static void StubCallBack(void *CallBackRef)
|
||||
{
|
||||
|
||||
(void)CallBackRef;
|
||||
Xil_AssertVoidAlways();
|
||||
}
|
||||
|
|
|
@ -97,12 +97,78 @@
|
|||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00a xd 05/14/09 First release
|
||||
* 2.00a xd 12/14/09 Updated doxygen document tags
|
||||
* 3.00a xd 07/29/10 Added device version & sharable coefficient bank support
|
||||
* 6.0 adk 19/12/13 Updated as per the New Tcl API's
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- -------------------------------------------------------
|
||||
* 1.00a xd 05/14/09 First release
|
||||
* 2.00a xd 12/14/09 Updated Doxygen document tags
|
||||
* 3.00a xd 07/29/10 Added core version & sharable coefficient bank
|
||||
* support
|
||||
* 6.0 adk 12/19/13 Updated as per the New Tcl API's
|
||||
* 7.0 adk 08/22/14 Removed XSCL_HANDLER_ERROR and XSCL_HANDLER_EVENT macros.
|
||||
* Removed ErrorCallBack and its ref ErrorRef from XScaler
|
||||
* structure.
|
||||
* Modified EventCallBack as CallBack and
|
||||
* EventRef as CallBackRef.
|
||||
* Modified XSCL_STSDONE to XSCL_STATUS_OFFSET,
|
||||
* XSCL_STS to XSCL_STATUS_OFFSET, XSCL_STSERR to
|
||||
* XSCL_ERROR_OFFSET.
|
||||
* Removed the following functional macros
|
||||
* XScaler_IntrGetPending,
|
||||
* XScaler_IntrEnableGlobal and XScaler_IntrDisableGlobal.
|
||||
* uncommented interrupt related macros.
|
||||
* Modified prototypes of the following functions by removing IntrType
|
||||
* parameter as there was only one interrupt :XScaler_IntrEnable,
|
||||
* XScaler_IntrDisable and XScaler_IntrClear.
|
||||
*
|
||||
* Modifications from xscalar_hw.h file are:
|
||||
* Appended register offset macros with _OFFSET and
|
||||
* Bit definition with _MASK.
|
||||
* Provided backward compatibility for changed macros.
|
||||
* Defined the following macros XSCL_CTL_MEMRD_EN_MASK.
|
||||
* Modified XSCL_CTL_ENABLE to XSCL_CTL_SW_EN_MASK,
|
||||
* XSCL_RESET_RESET_MASK to XSCL_CTL_RESET_MASK,
|
||||
* XSCL_CTL_REGUPDATE to XSCL_CTL_RUE_MASK,
|
||||
* XSCL_STSDONE_DONE and XSCL_STS_COEF_W_RDY_MASK to
|
||||
* XSCL_IXR_COEF_W_RDY_MASK.
|
||||
* Added XSCL_ERR_*_MASK s.
|
||||
* Removed XSCL_GIER_GIE_MASK.
|
||||
* Removed following macros as they were not defined in
|
||||
* latest product guide(v 8.1):
|
||||
* XSCL_STSERR_CODE*_MASK, XSCL_IXR_OUTPUT_FRAME_DONE_MASK,
|
||||
* XSCL_IXR_COEF_FIFO_READY_MASK, XSCL_IXR_INPUT_ERROR_MASK
|
||||
* XSCL_IXR_COEF_WR_ERROR_MASK,
|
||||
* XSCL_IXR_REG_UPDATE_DONE_MASK,
|
||||
* XSCL_IXR_OUTPUT_ERROR_MASK, XSCL_IXR_EVENT_MASK,
|
||||
* XSCL_IXR_ERROR_MASK, XSCL_IXR_ALLINTR_MASK,
|
||||
* XSCL_HSF_INT_MASK, XSCL_VSF_INT_MASK,
|
||||
* XSCL_COEFFVALUE_BASE_SHIFT and XSCL_COEFVALUE_BASE_MASK.
|
||||
* Modified bits of the following macros:
|
||||
* XSCL_HSF_FRAC_MASK and XSCL_VSF_FRAC_MASK.
|
||||
*
|
||||
* Modifications from xscalar.c file are:
|
||||
* Modified prototype of XScaler_GetVersion API.
|
||||
* and functionality of StubCallBack. Modified assert
|
||||
* conditions in functions XScaler_CfgInitialize,
|
||||
* XScaler_SetPhaseNum, XScaler_LoadCoeffBank.
|
||||
* Removed error callback from XScaler_CfgInitialize
|
||||
* function.
|
||||
* Uncommented XScaler_Reset in XScaler_CfgInitialize
|
||||
* function.
|
||||
*
|
||||
* Modifications from file xscalar_coefs.c file are
|
||||
* Removed typedef unsigned short s16 as it was already
|
||||
* defined in xil_types.h.
|
||||
* Modified coefs_struct to Coefs_Struct.
|
||||
* Updated doxygen document tags.
|
||||
* XScaler_coef_table is made as a global variable.
|
||||
* Memory allocated was freed after usage.
|
||||
*
|
||||
* Modifications from xscalar_intr.c file are
|
||||
* XScaler_IntrHandler and XScaler_SetCallBack APIs were
|
||||
* modified
|
||||
*
|
||||
* Added XScaler_LookupConfig in xscalar_sinit.c file and
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
@ -119,19 +185,13 @@ extern "C" {
|
|||
#include "stdio.h"
|
||||
#include "math.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
#include "xil_assert.h"
|
||||
#include "xscaler_hw.h"
|
||||
#include "xil_types.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/** @name Interrupt Types for setting up Callbacks
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_HANDLER_EVENT 1 /**< Normal Event Interrupt Type */
|
||||
#define XSCL_HANDLER_ERROR 2 /**< Error Interrupt Type */
|
||||
/*@}*/
|
||||
|
||||
/** @name Minimum and Maximum Tap Numbers
|
||||
* @{
|
||||
|
@ -210,7 +270,7 @@ typedef struct {
|
|||
* either normal events or errors. The value is created by "OR'ing"
|
||||
* XSCL_IXR_* constants defined in xscaler_hw.h
|
||||
*/
|
||||
typedef void (*XScaler_CallBack) (void *CallBackRef, u32 EventMask);
|
||||
typedef void (*XScaler_CallBack) (void *CallBackRef);
|
||||
|
||||
/**
|
||||
* The XScaler driver instance data. An instance must be allocated for each
|
||||
|
@ -221,15 +281,10 @@ typedef struct {
|
|||
u32 IsReady; /**< Device and the driver instance are
|
||||
initialized */
|
||||
|
||||
XScaler_CallBack EventCallBack; /**< Call back for Normal Event
|
||||
XScaler_CallBack CallBack; /**< Call back for
|
||||
interrupt */
|
||||
void *EventRef; /**< To be passed to the Normal Event
|
||||
void *CallBackRef; /**< To be passed to the
|
||||
interrupt callback */
|
||||
|
||||
XScaler_CallBack ErrorCallBack; /**< Call back for Error interrupt */
|
||||
void *ErrorRef; /**< To be passed to the Error
|
||||
interrupt callback */
|
||||
|
||||
} XScaler;
|
||||
|
||||
/**
|
||||
|
@ -287,20 +342,20 @@ typedef struct {
|
|||
*
|
||||
* This macro enables a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* void XScaler_Enable(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* void XScaler_Enable(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_Enable(InstancePtr) \
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_CTL, \
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_CTL) \
|
||||
| XSCL_CTL_ENABLE)
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET), \
|
||||
((XScaler_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET))) | (XSCL_CTL_SW_EN_MASK)))
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -308,58 +363,60 @@ typedef struct {
|
|||
*
|
||||
* This macro disables a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return None.
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* void XScaler_Disable(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* void XScaler_Disable(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_Disable(InstancePtr) \
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_CTL, \
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_CTL) \
|
||||
& (~XSCL_CTL_ENABLE))
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET), \
|
||||
((XScaler_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET)) & (~(XSCL_CTL_SW_EN_MASK)))))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro checks if a Scaler device is enabled.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return TRUE if the Scaler device is enabled; FALSE otherwise.
|
||||
* @return - TRUE if the Scaler device is enabled.
|
||||
* - FALSE otherwise.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* boolean XScaler_IsEnabled(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* boolean XScaler_IsEnabled(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_IsEnabled(InstancePtr) \
|
||||
((XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_CTL) & \
|
||||
XSCL_CTL_ENABLE) ? TRUE : FALSE)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET)) & (XSCL_CTL_SW_EN_MASK) ? TRUE : FALSE
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro checks if a Scaler operation is finished
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return TRUE if the Scaler operation is finished; FALSE otherwise.
|
||||
* @return
|
||||
* - TRUE if the Scaler operation is finished.
|
||||
* - FALSE otherwise.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* boolean XScaler_CheckDone(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* boolean XScaler_CheckDone(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_CheckDone(InstancePtr) \
|
||||
((XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_STSDONE) & \
|
||||
XSCL_STSDONE_DONE) ? TRUE : FALSE)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_STATUS_OFFSET)) & \
|
||||
(XSCL_STS_COEF_W_RDY_MASK) ? TRUE : FALSE
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
|
@ -367,20 +424,20 @@ typedef struct {
|
|||
* This macro tells a Scaler device to pick up the register value changes made
|
||||
* so far.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* void XScaler_EnableRegUpdate(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* void XScaler_EnableRegUpdate(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_EnableRegUpdate(InstancePtr) \
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_CTL, \
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_CTL) \
|
||||
| XSCL_CTL_REGUPDATE)
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET), \
|
||||
((XScaler_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET))) | (XSCL_CTL_RUE_MASK)))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
|
@ -390,20 +447,20 @@ typedef struct {
|
|||
* multiple registers need to be updated. All register updates could be made
|
||||
* with no tight time constraints with the help of this macro.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return None.
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* void XScaler_DisableRegUpdate(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* void XScaler_DisableRegUpdate(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_DisableRegUpdate(InstancePtr) \
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_CTL, \
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_CTL) \
|
||||
& ~XSCL_CTL_REGUPDATE)
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET), \
|
||||
((XScaler_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET))) & (~(XSCL_CTL_RUE_MASK))))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
|
@ -411,89 +468,90 @@ typedef struct {
|
|||
* This macro checks if a Scaler device is ready to accept the coefficients
|
||||
* the software is going to load.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return TRUE if the Scaler device is ready for the coefficient load; FALSE
|
||||
otherwise
|
||||
* @return
|
||||
* - TRUE if the Scaler device is ready for the coefficient load.
|
||||
* - FALSE otherwise.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* boolean XScaler_CoeffLoadReady(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* boolean XScaler_CoeffLoadReady(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_CoeffLoadReady(InstancePtr) \
|
||||
((XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_STS) & \
|
||||
XSCL_STS_COEF_W_RDY_MASK) ? TRUE : FALSE)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_STATUS_OFFSET)) & \
|
||||
(XSCL_STS_COEF_W_RDY_MASK) ? TRUE : FALSE
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro checks the error status of a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return The error type, if any. Use XSCL_STSERR_* defined in xscaler_hw.h
|
||||
* to interpret the value.
|
||||
* @return The error type, if any. Use XSCL_STSERR_* defined in
|
||||
* xscaler_hw.h to interpret the value.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* u32 XScaler_GetError(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* u32 XScaler_GetError(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_GetError(InstancePtr) \
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_STSERR)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, (XSCL_ERROR_OFFSET))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro resets a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return None.
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* void XScaler_Reset(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* void XScaler_Reset(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_Reset(InstancePtr) \
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_CTL, \
|
||||
XSCL_RESET_RESET_MASK)
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET), (XSCL_CTL_RESET_MASK))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro checks if the reset on a Scaler device is done.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return TRUE if the reset is done; FALSE otherwise.
|
||||
* @return
|
||||
* - TRUE if the reset is done;
|
||||
* - FALSE otherwise.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* boolean XScaler_IsResetDone(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* boolean XScaler_IsResetDone(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_IsResetDone(InstancePtr) \
|
||||
((XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_RESET) & \
|
||||
XSCL_RESET_RESET_MASK) ? FALSE : TRUE)
|
||||
XScaler_ReadReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_CTL_OFFSET)) & \
|
||||
(XSCL_CTL_RESET_MASK) ? FALSE : TRUE
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This macro calculates the N-th Triangular number: 1 + 2 + ... + N
|
||||
*
|
||||
* @param N indicates the positive integer number to calculate the N-th
|
||||
* Triangular number.
|
||||
* @return The N-th triangular number.
|
||||
* @param N indicates the positive integer number to calculate the N-th
|
||||
* Triangular number.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* u32 XScaler_TriangularNumber(u32 N);
|
||||
* @return The N-th triangular number.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* u32 XScaler_TriangularNumber(u32 N);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XScaler_TriangularNumber(N) ((N) * ((N) + 1) / 2)
|
||||
|
@ -503,13 +561,13 @@ typedef struct {
|
|||
* This macro calculates the offset of a coefficient Tap from the beginning of
|
||||
* a coefficient Bin.
|
||||
*
|
||||
* @param Tap indicates the index of the coefficient tap in the coefficient
|
||||
* Bin
|
||||
* @return The offset of the coefficient TAP from the beginning of a
|
||||
* coefficient Bin
|
||||
* @note
|
||||
* C-style signature:
|
||||
* u32 XScaler_CoefTapOffset(u32 Tap);
|
||||
* @param Tap indicates the index of the coefficient tap in the
|
||||
* coefficient Bin.
|
||||
*
|
||||
* @return The offset of the coefficient TAP from the beginning of a
|
||||
* coefficient Bin.
|
||||
* @note C-style signature:
|
||||
* u32 XScaler_CoefTapOffset(u32 Tap);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XScaler_CoefTapOffset(Tap) \
|
||||
|
@ -522,13 +580,14 @@ typedef struct {
|
|||
* beginning of a coefficient Tap given the currently used Phase and Tap
|
||||
* numbers for scaling operation.
|
||||
*
|
||||
* @param Tap indicates the number of Taps used for the scaling operation
|
||||
* @param Phase indicates the number of Phases used for the scaling operation
|
||||
* @return The offset of the first coefficient Phase from the beginning of a
|
||||
* coefficient Tap.
|
||||
* @note
|
||||
* C-style signature:
|
||||
* u32 XScaler_CoefPhaseOffset(u32 Tap, u32 Phase);
|
||||
* @param Tap indicates the number of Taps used for the scaling operation.
|
||||
* @param Phase indicates the number of Phases used for the scaling
|
||||
* operation.
|
||||
*
|
||||
* @return The offset of the first coefficient Phase from the beginning of
|
||||
* a coefficient Tap.
|
||||
* @note C-style signature:
|
||||
* u32 XScaler_CoefPhaseOffset(u32 Tap, u32 Phase);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XScaler_CoefPhaseOffset(Tap, Phase) \
|
||||
|
@ -538,144 +597,60 @@ typedef struct {
|
|||
(Tap) * (XScaler_TriangularNumber(16) - 1) : \
|
||||
(Tap) * (XScaler_TriangularNumber(16) - 1 + 32))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro enables the global interrupt on a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* void XScaler_IntrEnableGlobal(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
//#define XScaler_IntrEnableGlobal(InstancePtr) \
|
||||
// XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_GIER, \
|
||||
// XSCL_GIER_GIE_MASK)
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro disables the global interrupt on a Scaler device.
|
||||
* This macro enables the Coef_FIFO_Ready interrupt on a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @return None.
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* void XScaler_IntrDisableGlobal(XScaler *InstancePtr);
|
||||
* @note C-style signature:
|
||||
* void XScaler_IntrEnable(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
//#define XScaler_IntrDisableGlobal(InstancePtr) \
|
||||
// XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_GIER, 0)
|
||||
#define XScaler_IntrEnable(InstancePtr) \
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_IRQ_EN_OFFSET),(XSCL_IXR_COEF_W_RDY_MASK)) \
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro enables the given individual interrupt(s) on a Scaler device.
|
||||
* This macro disables the Coef_FIFO_Ready interrupt on a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @param IntrType is the type of the interrupts to enable. Use OR'ing of
|
||||
* XSCL_IXR_* constants defined in xscaler_hw.h to create this parameter
|
||||
* value.
|
||||
* @return None.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* The existing enabled interrupt(s) will remain enabled.
|
||||
*
|
||||
* C-style signature:
|
||||
* void XScaler_IntrEnable(XScaler *InstancePtr, u32 IntrType);
|
||||
* @note C-style signature:
|
||||
* void XScaler_IntrDisable(XScaler *InstancePtr);
|
||||
*
|
||||
******************************************************************************/
|
||||
//#define XScaler_IntrEnable(InstancePtr, IntrType) \
|
||||
// XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_IER, \
|
||||
// ((IntrType) & XSCL_IXR_ALLINTR_MASK) | \
|
||||
// XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_IER))
|
||||
#define XScaler_IntrDisable(InstancePtr) \
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_IRQ_EN_OFFSET), 0)
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro disables the given individual interrupt(s) on a Scaler device.
|
||||
* This macro clears/acknowledges Coef_FIFO_Ready interrupt of a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be
|
||||
* worked on.
|
||||
*
|
||||
* @param IntrType is the type of the interrupts to disable. Use OR'ing of
|
||||
* XSCL_IXR_* constants defined in xscaler_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.
|
||||
*
|
||||
* C-style signature:
|
||||
* void XScaler_IntrDisable(XScaler *InstancePtr, u32 IntrType);
|
||||
* @note C-style signature:
|
||||
* void XScaler_IntrClear(XScaler *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
//#define XScaler_IntrDisable(InstancePtr, IntrType) \
|
||||
// XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_IER, \
|
||||
// (~(IntrType)) & XSCL_IXR_ALLINTR_MASK & \
|
||||
// XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_IER))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro returns the pending interrupts of a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
*
|
||||
* @return The pending interrupts of the Scaler. Use XSCL_IXR_* constants
|
||||
* defined in xscaler_hw.h to interpret this value.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* C-style signature:
|
||||
* u32 XScaler_IntrGetPending(XScaler *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
//#define XScaler_IntrGetPending(InstancePtr) \
|
||||
// (XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_IER) & \
|
||||
// XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_ISR) & \
|
||||
// XSCL_IXR_ALLINTR_MASK)
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This macro clears/acknowledges pending interrupts of a Scaler device.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the Scaler device instance to be worked
|
||||
* on.
|
||||
*
|
||||
* @param IntrType is the pending interrupts to clear/acknowledge. Use OR'ing
|
||||
* of XSCL_IXR_* constants defined in xscaler_hw.h to create this
|
||||
* parameter value.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* C-style signature:
|
||||
* void XScaler_IntrClear(XScaler *InstancePtr, u32 IntrType)
|
||||
*
|
||||
******************************************************************************/
|
||||
//#define XScaler_IntrClear(InstancePtr, IntrType) \
|
||||
// XScaler_WriteReg((InstancePtr)->Config.BaseAddress, XSCL_ISR, \
|
||||
// (IntrType) & XSCL_IXR_ALLINTR_MASK & \
|
||||
// XScaler_ReadReg((InstancePtr)->Config.BaseAddress, XSCL_ISR))
|
||||
#define XScaler_IntrClear(InstancePtr) \
|
||||
XScaler_WriteReg((InstancePtr)->Config.BaseAddress, \
|
||||
(XSCL_STATUS_OFFSET), (XSCL_IXR_COEF_W_RDY_MASK))
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
@ -719,10 +694,7 @@ void XScaler_GetCoeffBankSharingInfo(XScaler *InstancePtr,
|
|||
u8 *ChromaFormat,
|
||||
u8 *ChromaLumaShareCoeff,
|
||||
u8 *HoriVertShareCoeff);
|
||||
|
||||
/* Version functions */
|
||||
//void XScaler_GetVersion(XScaler *InstancePtr, u16 *Major, u16 *Minor,
|
||||
// u16 *Revision);
|
||||
u32 XScaler_GetVersion(XScaler *InstancePtr);
|
||||
|
||||
/*
|
||||
* Initialization functions in xscaler_sinit.c
|
||||
|
@ -733,7 +705,7 @@ XScaler_Config *XScaler_LookupConfig(u16 DeviceId);
|
|||
* Interrupt related functions in xscaler_intr.c
|
||||
*/
|
||||
void XScaler_IntrHandler(void *InstancePtr);
|
||||
int XScaler_SetCallBack(XScaler *InstancePtr, u32 IntrType,
|
||||
void XScaler_SetCallBack(XScaler *InstancePtr,
|
||||
void *CallBackFunc, void *CallBackRef);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -43,10 +43,15 @@
|
|||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00a xd 06/15/09 First release. Coefficients are auto-generated in
|
||||
* Matlab using
|
||||
* /Video_Scaler/reference_model/src/CreateCoefficients.m
|
||||
* Matlab using
|
||||
* /Video_Scaler/reference_model/src/CreateCoefficients.m
|
||||
* 2.00a xd 12/14/09 Updated doxygen document tags
|
||||
* 5.00a mpv 12/13/13 Updated to dynamic coeff generation to reduce driver size
|
||||
* 7.0 adk 08/22/14 Removed typedef unsigned short s16 as it was already
|
||||
* defined in xil_types.h.
|
||||
* Updated doxygen document tags.
|
||||
* XScaler_coef_table is made as a global variable.
|
||||
* Memory allocated was freed after usage.
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
@ -54,8 +59,11 @@
|
|||
#include "xscaler.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
/** @name PI definition
|
||||
* @{
|
||||
*/
|
||||
#define PI 3.14159265358979
|
||||
/*@}*/
|
||||
|
||||
/************************* Data Structure Definitions ************************/
|
||||
|
||||
|
@ -86,96 +94,180 @@ u16 XScaler_CoefficientBinScalingFactors[XSCL_NUM_COEF_BINS] = {
|
|||
6666
|
||||
};
|
||||
|
||||
/**
|
||||
* XScaler_GenCoefTable generates a table that contains the coefficient values
|
||||
* for scaling operations
|
||||
* @param Tap is the number of taps configured
|
||||
* @param Phase is the number of phase configured
|
||||
* the Scaler device.
|
||||
* @return XScaler_coef_table
|
||||
*
|
||||
************ new coef generation************
|
||||
*/
|
||||
#define PI 3.14159265358979
|
||||
typedef unsigned short uint16;
|
||||
s16* XScaler_coef_table = NULL; /**< Coefficients table */
|
||||
|
||||
/**
|
||||
* This structure contains a pointer to double dimensional array which will be
|
||||
* filled by coefficients.
|
||||
*/
|
||||
struct coefs_struct{
|
||||
short int** coefficients;
|
||||
}SingleFrameCoefs;
|
||||
|
||||
/*memory allocation*/
|
||||
int XScaler_AllocCoefsBuff(struct coefs_struct* coefs, int max_taps, int max_phases)
|
||||
|
||||
/************************** Function Definitions ******************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function allocates memory to a double dimensional array.
|
||||
*
|
||||
* @param Coefs is a pointer to Coefs_Struct structure which has a
|
||||
* double dimensional array which needs to be allocated memory.
|
||||
* @param Max_Taps indicates the number of taps which is used to allocate
|
||||
* that number of columns.
|
||||
* @param Max_Phases indicates the number of phases which is used to
|
||||
* allocate that number of rows.
|
||||
*
|
||||
* @return
|
||||
* 1 - Indicates allocation of memory is failed.
|
||||
* 0 - Indicates allocation of memory is success.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int XScaler_AllocCoefsBuff(struct coefs_struct* Coefs, u32 Max_Taps,
|
||||
u32 Max_Phases)
|
||||
{
|
||||
int phase, tap;
|
||||
if ((coefs->coefficients = (short int **) ((uint16**)calloc(max_phases, sizeof(uint16*)))) == 0) return(1);
|
||||
for (phase = 0; phase <max_phases; phase++) {
|
||||
if ((coefs->coefficients[phase] = (short int *) ((uint16*)calloc(max_taps, sizeof(uint16)))) == 0) return(1);
|
||||
u32 Phase;
|
||||
if ((Coefs->coefficients =
|
||||
(s16 **) ((s16**)calloc(Max_Phases, sizeof(s16*)))) == 0) {
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
for (Phase = 0; Phase < Max_Phases; Phase++) {
|
||||
if ((Coefs->coefficients[Phase] =
|
||||
(s16 *) ((s16*)calloc(Max_Taps, sizeof(s16)))) == 0) {
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Sine generation
|
||||
* This Sine generation algorithm implements Taylor series decomposition of the
|
||||
* Sine function according to http://en.wikipedia.org/wiki/Taylor_series#Approximation_and_convergence
|
||||
*/
|
||||
* This Sine generation algorithm implements Taylor series decomposition of the
|
||||
* Sine function.
|
||||
*
|
||||
* @param x is a float variable which needs to be set.
|
||||
*
|
||||
* @return Returns Taylor series.
|
||||
*
|
||||
* @note It works according to
|
||||
* http://en.wikipedia.org/wiki/Taylor_series#Approximation_and_convergence
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
float XScaler_Sine(float x)
|
||||
{
|
||||
int n, fac=1;
|
||||
float px, taylor=0;
|
||||
int n, fac=1;
|
||||
float px, taylor=0;
|
||||
float rng = ((x-PI)/PI);
|
||||
x = x - rng*PI;
|
||||
px = x;
|
||||
for (n=0;n<6;n++)
|
||||
{
|
||||
taylor += (px / fac);
|
||||
px *= -(x*x);
|
||||
fac *= (2*n+2)*(2*n+3);
|
||||
}
|
||||
return taylor;
|
||||
}
|
||||
|
||||
|
||||
/*coef generation*/
|
||||
float XScaler_Lanczos(float x, int a)
|
||||
for (n=0;n<6;n++)
|
||||
{
|
||||
return((x<-a) ? 0 : ((x>a) ? 0 : ((x==0) ? 1.0 : ( a*XScaler_Sine(PI*x)*XScaler_Sine(PI*x/a)/(PI*PI*x*x)))));
|
||||
|
||||
taylor += (px / fac);
|
||||
px *= -(x*x);
|
||||
fac *= (2*n+2)*(2*n+3);
|
||||
}
|
||||
return taylor;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This coefficient generation algorithm implements the Lanczos coefficients: http://en.wikipedia.org/wiki/Lanczos_resampling
|
||||
* For a particular scaling ratio, the coefficients can be pre-canned to memory
|
||||
*/
|
||||
* This function generates coffficient.
|
||||
*
|
||||
* @param x is a float varaible based on which coefficient is
|
||||
* generated.
|
||||
* @param a is a 32 bit variable which holds half of the number of taps.
|
||||
*
|
||||
* @return Returns Coefficient value depending on inputs.
|
||||
*
|
||||
* @note It works according to
|
||||
* http://en.wikipedia.org/wiki/Taylor_series#Approximation_and_convergence
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
float XScaler_Lanczos(float x, int a)
|
||||
{
|
||||
return((x<-a) ? 0 : ((x>a) ? 0 : ((x==0) ?
|
||||
1.0 : ( a*XScaler_Sine(PI*x)*XScaler_Sine(PI*x/a)/(PI*PI*x*x)))));
|
||||
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This coefficient generation algorithm implements the Lanczos coefficients.
|
||||
* For a particular scaling ratio, the coefficients can be pre-canned to memory.
|
||||
*
|
||||
* @param p is a float variable.
|
||||
* @param icoeffs is a pointer to a single row of Coefficients array
|
||||
* which is in SingleFrameCoefs structure.
|
||||
* @param NCOEFF is variable which holds number of taps which indicates
|
||||
* the number of columns
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note It works according to
|
||||
* http://en.wikipedia.org/wiki/Lanczos_resampling.
|
||||
*
|
||||
******************************************************************************/
|
||||
void XScaler_GetLanczosCoeffs(float p, short int icoeffs[], int NCOEFF)
|
||||
{
|
||||
float s=0;
|
||||
float coeff[64];
|
||||
int i;
|
||||
|
||||
for (i=0; i<NCOEFF; i++) s+=(coeff[i] = XScaler_Lanczos( i-(NCOEFF>>1)+p, (NCOEFF>>1))); /* To implement convolution using the 2D FIR kernel, coefficient order is reversed*/
|
||||
for (i=0; i<NCOEFF; i++) icoeffs[i]=(int) (0.5+coeff[i]*16384/s); /* Normalize coefficients, so sum()=1 for all phases.*/
|
||||
/* To implement convolution using the
|
||||
* 2D FIR kernel, coefficient order is reversed
|
||||
*/
|
||||
for (i=0; i<NCOEFF; i++) {
|
||||
s+=(coeff[i] =
|
||||
XScaler_Lanczos( i-(NCOEFF>>1)+p, (NCOEFF>>1)));
|
||||
}
|
||||
/* Normalize coefficients, so sum()=1 for all phases.*/
|
||||
for (i=0; i<NCOEFF; i++) {
|
||||
icoeffs[i]=(int) (0.5+coeff[i]*16384/s);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function generates a table that contains the coefficient values
|
||||
* for scaling operations
|
||||
*
|
||||
* @param Tap indicates the number of taps configured to the
|
||||
* Scaler device.
|
||||
* @param Phase indicates the number of phase configured to
|
||||
* the Scaler device.
|
||||
*
|
||||
* @return The pointer to XScaler_Coef_Table.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
s16 *XScaler_GenCoefTable(u32 Tap, u32 Phase)
|
||||
{
|
||||
int phase, i , j;
|
||||
short int *current_phase_ptr;
|
||||
double dy;
|
||||
u32 i , j;
|
||||
s16 *current_phase_ptr;
|
||||
float dy;
|
||||
|
||||
XScaler_AllocCoefsBuff(&SingleFrameCoefs, Tap, Phase);
|
||||
|
||||
s16* XScaler_coef_table;
|
||||
XScaler_coef_table = calloc(Tap*Phase, sizeof(uint16));
|
||||
if (XScaler_coef_table != NULL) {
|
||||
free(XScaler_coef_table);
|
||||
}
|
||||
XScaler_coef_table = calloc(Tap*Phase, sizeof(s16));
|
||||
|
||||
for (i=0; i<Phase; i++) {
|
||||
dy=((double) i)/Phase;
|
||||
for (i = 0; i < Phase; i++) {
|
||||
dy = ((float) i)/ (float)Phase;
|
||||
current_phase_ptr = SingleFrameCoefs.coefficients[i];
|
||||
XScaler_GetLanczosCoeffs(dy,current_phase_ptr, Tap);
|
||||
for (j=0; j<Tap; j++){
|
||||
XScaler_coef_table[((i*Tap) + j)] = SingleFrameCoefs.coefficients[i][j];
|
||||
XScaler_coef_table[((i*Tap) + j)] =
|
||||
SingleFrameCoefs.coefficients[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
free(SingleFrameCoefs.coefficients);
|
||||
return (XScaler_coef_table);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,72 +1,36 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xscaler_g.c
|
||||
*
|
||||
* This file contains a template for configuration table of Xilinx MVI Video
|
||||
* Scaler devices.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00a xd 05/14/09 First release
|
||||
* 2.00a xd 12/14/09 Updated doxygen document tags
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* CAUTION: This file is automatically generated by HSM.
|
||||
* Version:
|
||||
* DO NOT EDIT.
|
||||
*
|
||||
* v (64-bit)
|
||||
SW Build (by ) on
|
||||
Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
|
||||
*
|
||||
* Description: Driver configuration
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xscaler.h"
|
||||
|
||||
/**
|
||||
* The configuration table for Scaler devices
|
||||
*/
|
||||
XScaler_Config XScaler_ConfigTable[] = {
|
||||
/*
|
||||
* The configuration table for devices
|
||||
*/
|
||||
|
||||
XScaler_Config XScaler_ConfigTable[] =
|
||||
{
|
||||
{
|
||||
XPAR_SCALER_0_DEVICE_ID,
|
||||
XPAR_SCALER_0_BASEADDR,
|
||||
XPAR_SCALER_0_VERT_TAP_NUM,
|
||||
XPAR_SCALER_0_HORI_TAP_NUM,
|
||||
XPAR_SCALER_0_MAX_PHASE_NUM,
|
||||
XPAR_SCALER_0_MAX_COEF_SETS,
|
||||
XPAR_SCALER_0_CHROMA_FORMAT,
|
||||
XPAR_SCALER_0_SEPARATE_YC_COEFS,
|
||||
XPAR_SCALER_0_SEPARATE_HV_COEFS
|
||||
XPAR_V_SCALER_1_DEVICE_ID,
|
||||
XPAR_V_SCALER_1_BASEADDR,
|
||||
XPAR_V_SCALER_1_NUM_V_TAPS,
|
||||
XPAR_V_SCALER_1_NUM_H_TAPS,
|
||||
XPAR_V_SCALER_1_MAX_PHASES,
|
||||
XPAR_V_SCALER_1_MAX_COEF_SETS,
|
||||
XPAR_V_SCALER_1_CHROMA_FORMAT,
|
||||
XPAR_V_SCALER_1_SEPARATE_YC_COEFS,
|
||||
XPAR_V_SCALER_1_SEPARATE_HV_COEFS
|
||||
}
|
||||
};
|
||||
|
|
|
@ -48,6 +48,29 @@
|
|||
* 1.00a xd 05/14/09 First release
|
||||
* 2.00a xd 12/14/09 Updated doxygen document tags
|
||||
* 4.03a mpv 05/28/13 Updated the Driver input, output and aperture size mask
|
||||
* 7.0 adk 08/22/14 Appended register offset macros with _OFFSET and
|
||||
* Bit definition with _MASK.
|
||||
* Provided backward compatibility for changed macros.
|
||||
* Defined the following macros XSCL_CTL_MEMRD_EN_MASK.
|
||||
* Modified XSCL_CTL_ENABLE to XSCL_CTL_SW_EN_MASK,
|
||||
* XSCL_RESET_RESET_MASK to XSCL_CTL_RESET_MASK,
|
||||
* XSCL_CTL_REGUPDATE to XSCL_CTL_RUE_MASK,
|
||||
* XSCL_STSDONE_DONE and XSCL_STS_COEF_W_RDY_MASK to
|
||||
* XSCL_IXR_COEF_W_RDY_MASK.
|
||||
* Added XSCL_ERR_*_MASK s.
|
||||
* Removed XSCL_GIER_GIE_MASK.
|
||||
* Removed following macros as they were not defined in
|
||||
* latest product guide(v 8.1):
|
||||
* XSCL_STSERR_CODE*_MASK, XSCL_IXR_OUTPUT_FRAME_DONE_MASK,
|
||||
* XSCL_IXR_COEF_FIFO_READY_MASK, XSCL_IXR_INPUT_ERROR_MASK
|
||||
* XSCL_IXR_COEF_WR_ERROR_MASK,
|
||||
* XSCL_IXR_REG_UPDATE_DONE_MASK,
|
||||
* XSCL_IXR_OUTPUT_ERROR_MASK, XSCL_IXR_EVENT_MASK,
|
||||
* XSCL_IXR_ERROR_MASK, XSCL_IXR_ALLINTR_MASK,
|
||||
* XSCL_HSF_INT_MASK, XSCL_VSF_INT_MASK,
|
||||
* XSCL_COEFFVALUE_BASE_SHIFT and XSCL_COEFVALUE_BASE_MASK.
|
||||
* Modified bits of the following macros:
|
||||
* XSCL_HSF_FRAC_MASK and XSCL_VSF_FRAC_MASK.
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
@ -68,261 +91,278 @@ extern "C" {
|
|||
/** @name Device Register Offsets
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_CTL 0x000 /**< Control */
|
||||
#define XSCL_STATUS 0x004 /**< Status */
|
||||
#define XSCL_ERROR 0x008 /**< Error status */
|
||||
#define IRQ_ENABLE 0x00C /**< For detecting operation status */
|
||||
#define XSCL_VER 0x010 /**< Version Register */
|
||||
|
||||
#define XSCL_HSF 0x100 /**< Horizontal Shrink Factor */
|
||||
#define XSCL_VSF 0x104 /**< Vertical Shrink Factor */
|
||||
#define XSCL_SRCSIZE 0x108 /**< Source-video resolution */
|
||||
#define XSCL_APTHORI 0x10C /**< First and last subject pixels in input line */
|
||||
#define XSCL_APTVERT 0x110 /**< First and last subject lines in input image */
|
||||
#define XSCL_OUTSIZE 0x114 /**< Output image size:width and height */
|
||||
#define XSCL_NUMPHASE 0x118 /**< The numbers of phases in current filter */
|
||||
#define XSCL_COEFFSETS 0x11C /**< Active horizontal and vertical coefficient sets to use */
|
||||
#define XSCL_FRCTLUMALEFT 0x120 /**< Fractional value used to initialize horizontal accumulator
|
||||
at rectangle left edge for luma */
|
||||
#define XSCL_FRCTCHROMALEFT 0x124 /**< Fractional value used to initialize horizontal accumulator
|
||||
at rectangle left edge for chroma */
|
||||
#define XSCL_FRCTLUMATOP 0x128 /**< Fractional value used to initialize horizontal accumulator
|
||||
at rectangle top edge for luma */
|
||||
#define XSCL_FRCTCHROMATOP 0x12C /**< Fractional value used to initialize horizontal accumulator
|
||||
at rectangle top edge for chroma */
|
||||
#define XSCL_COEFFSETADDR 0x130 /**< Address of Coefficient set to write */
|
||||
#define XSCL_COEFFVALUE 0x134 /**< Coefficient values to write */
|
||||
#define XSCL_COEFF_SET_BANK 0x138 /**< Coefficient set/bank read address */
|
||||
#define XSCL_COEFF_MEM 0x13C /**< Coefficient mem read address */
|
||||
|
||||
#define XSCL_CTL_OFFSET 0x000 /**< Control Offset */
|
||||
#define XSCL_STATUS_OFFSET 0x004 /**< Status Offset */
|
||||
#define XSCL_ERROR_OFFSET 0x008 /**< Error Status Offset */
|
||||
#define XSCL_IRQ_EN_OFFSET 0x00C /**< For detecting operation
|
||||
* status Offset */
|
||||
#define XSCL_VER_OFFSET 0x010 /**< Version Register Offset */
|
||||
#define XSCL_HSF_OFFSET 0x100 /**< Horizontal Shrink Factor
|
||||
* Offset */
|
||||
#define XSCL_VSF_OFFSET 0x104 /**< Vertical Shrink Factor
|
||||
* Offset */
|
||||
#define XSCL_SRCSIZE_OFFSET 0x108 /**< Source-video resolution
|
||||
* Offset */
|
||||
#define XSCL_APTHORI_OFFSET 0x10C /**< First and last subject
|
||||
* pixels in input line
|
||||
* Offset */
|
||||
#define XSCL_APTVERT_OFFSET 0x110 /**< First and last subject
|
||||
* lines in input image
|
||||
* Offset */
|
||||
#define XSCL_OUTSIZE_OFFSET 0x114 /**< Output image size: width
|
||||
* and height Offset */
|
||||
#define XSCL_NUMPHASE_OFFSET 0x118 /**< The numbers of phases in
|
||||
* current filter Offset */
|
||||
#define XSCL_COEFFSETS_OFFSET 0x11C /**< Active horizontal and
|
||||
* vertical coefficient sets
|
||||
* to use Offset */
|
||||
#define XSCL_FRCTLUMALEFT_OFFSET 0x120 /**< Fractional value used to
|
||||
* initialize horizontal
|
||||
* accumulator at rectangle
|
||||
* left edge for luma
|
||||
* Offset */
|
||||
#define XSCL_FRCTCHROMALEFT_OFFSET 0x124 /**< Fractional value used to
|
||||
* initialize horizontal
|
||||
* accumulator at rectangle
|
||||
* left edge for chroma
|
||||
* Offset */
|
||||
#define XSCL_FRCTLUMATOP_OFFSET 0x128 /**< Fractional value used to
|
||||
* initialize horizontal
|
||||
* accumulator at rectangle
|
||||
* top edge for luma
|
||||
* Offset */
|
||||
#define XSCL_FRCTCHROMATOP_OFFSET 0x12C /**< Fractional value used to
|
||||
* initialize horizontal
|
||||
* accumulator at rectangle
|
||||
* top edge for chroma
|
||||
* Offset */
|
||||
#define XSCL_COEFFSETADDR_OFFSET 0x130 /**< Address of Coefficient
|
||||
* set to write Offset */
|
||||
#define XSCL_COEFFVALUE_OFFSET 0x134 /**< Coefficient values to
|
||||
* write Offset */
|
||||
#define XSCL_COEFF_SET_BANK_OFFSET 0x138 /**< Coefficient set/bank
|
||||
* read address Offset */
|
||||
#define XSCL_COEFF_MEM_OFFSET 0x13C /**< Coefficient mem read
|
||||
* address Offset */
|
||||
/*@}*/
|
||||
|
||||
/** @name Control Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_CTL_REGUPDATE 0x00000002 /**< Register Update Enable for
|
||||
register HSF thru
|
||||
FRCTCHROMATOP */
|
||||
#define XSCL_CTL_ENABLE 0x00000001 /**< Enable the scaler on the next
|
||||
video frame */
|
||||
#define XSCL_CTL_SW_EN_MASK 0x00000001 /**< Enable the Scaler on the
|
||||
* next video frame Mask */
|
||||
#define XSCL_CTL_RUE_MASK 0x00000002 /**< Register Update Enable
|
||||
* Mask */
|
||||
#define XSCL_CTL_MEMRD_EN_MASK 0x00000008 /**< Coefficient Memory Read
|
||||
* Enable Mask */
|
||||
#define XSCL_CTL_RESET_MASK 0x80000000 /**< Software reset
|
||||
* bit Mask */
|
||||
/*@}*/
|
||||
|
||||
/** @name Status Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_STS_COEF_W_RDY_MASK 0x00000001 /**< If 1, Coefficient values can
|
||||
be written into the core */
|
||||
#define XSCL_IXR_COEF_W_RDY_MASK 0x00000001 /**< If 1, Coefficient
|
||||
* values can
|
||||
* be written into the
|
||||
* core Mask */
|
||||
/*@}*/
|
||||
|
||||
/** @name Error Status Register bit definition (to be defined)
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_STSERR_CODE3_MASK 0xFF000000 /**< code 3 */
|
||||
#define XSCL_STSERR_CODE2_MASK 0x00FF0000 /**< code 2 */
|
||||
#define XSCL_STSERR_CODE1_MASK 0x0000FF00 /**< code 1 */
|
||||
#define XSCL_STSERR_CODE0_MASK 0x000000FF /**< code 0 */
|
||||
#define XSCL_ERR_EOL_MASK 0x00000001 /**< End of line Mask */
|
||||
#define XSCL_ERR_SOF_MASK 0x00000004 /**< Error in starting a frame
|
||||
* Mask */
|
||||
#define XSCL_ERR_COEFF_WR_MASK 0x00000010 /**< Error while Writing a
|
||||
* Coefficient into core */
|
||||
/*@}*/
|
||||
|
||||
/** @name Done Status Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_STSDONE_DONE 0x00000001 /**< indicator of end of scaler
|
||||
operation */
|
||||
/*@}*/
|
||||
|
||||
/** @name Horizontal Shrink Factor Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_HSF_INT_MASK 0x00F00000 /**< Horizontal Shrink Factor
|
||||
integer */
|
||||
#define XSCL_HSF_FRAC_MASK 0x000FFFFF /**< Horizontal Shrink Factor
|
||||
fractional */
|
||||
#define XSCL_HSF_FRAC_MASK 0x00FFFFFF /**< Horizontal Shrink Factor
|
||||
* fractional Mask */
|
||||
/*@}*/
|
||||
|
||||
/** @name Vertical Shrink Factor Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_VSF_INT_MASK 0x00F00000 /**< Vertical Shrink Factor integer
|
||||
*/
|
||||
#define XSCL_VSF_FRAC_MASK 0x000FFFFF /**< Vertical Shrink Factor
|
||||
fractional */
|
||||
#define XSCL_VSF_FRAC_MASK 0x00FFFFFF /**< Vertical Shrink Factor
|
||||
* fractional Mask */
|
||||
/*@}*/
|
||||
|
||||
/** @name Aperture Horizontal Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_APTHORI_LASTPXL_MASK 0x1FFF0000 /**< Location of last pixel
|
||||
in line */
|
||||
#define XSCL_APTHORI_LASTPXL_SHIFT 16 /**< Shift for location of
|
||||
last pixel */
|
||||
#define XSCL_APTHORI_FIRSTPXL_MASK 0x00001FFF /**< Location of first pixel
|
||||
in line */
|
||||
#define XSCL_APTHORI_LASTPXL_MASK 0x1FFF0000 /**< Location of last pixel
|
||||
* in line */
|
||||
#define XSCL_APTHORI_LASTPXL_SHIFT 16 /**< Shift for location of
|
||||
* last pixel */
|
||||
#define XSCL_APTHORI_FIRSTPXL_MASK 0x00001FFF /**< Location of first pixel
|
||||
* in line */
|
||||
/*@}*/
|
||||
|
||||
/** @name Aperture Vertical Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_APTVERT_LASTLINE_MASK 0x1FFF0000 /**< Location of last line
|
||||
in active video */
|
||||
#define XSCL_APTVERT_LASTLINE_SHIFT 16 /**< Shift for location of
|
||||
last line */
|
||||
#define XSCL_APTVERT_FIRSTLINE_MASK 0x00001FFF /**< Location of first line
|
||||
in active video */
|
||||
#define XSCL_APTVERT_LASTLINE_MASK 0x1FFF0000 /**< Location of last line
|
||||
* in active video */
|
||||
#define XSCL_APTVERT_LASTLINE_SHIFT 16 /**< Shift for location of
|
||||
* last line */
|
||||
#define XSCL_APTVERT_FIRSTLINE_MASK 0x00001FFF /**< Location of first line
|
||||
* in active video */
|
||||
/*@}*/
|
||||
|
||||
/** @name Output Size Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_OUTSIZE_NUMLINE_MASK 0x1FFF0000 /**< The number of lines in
|
||||
output rectangle */
|
||||
#define XSCL_OUTSIZE_NUMLINE_SHIFT 16 /**< Shift for the number of
|
||||
lines */
|
||||
#define XSCL_OUTSIZE_NUMPXL_MASK 0x00001FFF /**< The number of pixels in
|
||||
output rectangle */
|
||||
#define XSCL_OUTSIZE_NUMLINE_MASK 0x1FFF0000 /**< The number of lines in
|
||||
* output rectangle */
|
||||
#define XSCL_OUTSIZE_NUMLINE_SHIFT 16 /**< Shift for the number of
|
||||
* lines */
|
||||
#define XSCL_OUTSIZE_NUMPXL_MASK 0x00001FFF /**< The number of pixels in
|
||||
* output rectangle */
|
||||
/*@}*/
|
||||
|
||||
/** @name Source Size Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_SRCSIZE_NUMLINE_MASK 0x1FFF0000 /**< The number of lines in
|
||||
source image */
|
||||
#define XSCL_SRCSIZE_NUMLINE_SHIFT 16 /**< Shift for the number of
|
||||
lines */
|
||||
#define XSCL_SRCSIZE_NUMPXL_MASK 0x00001FFF /**< The number of pixels in
|
||||
source image */
|
||||
#define XSCL_SRCSIZE_NUMLINE_MASK 0x1FFF0000 /**< The number of lines in
|
||||
* source image */
|
||||
#define XSCL_SRCSIZE_NUMLINE_SHIFT 16 /**< Shift for the number of
|
||||
* lines */
|
||||
#define XSCL_SRCSIZE_NUMPXL_MASK 0x00001FFF /**< The number of pixels in
|
||||
* source image */
|
||||
/*@}*/
|
||||
|
||||
|
||||
/** @name Number of Phases Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_NUMPHASE_VERT_MASK 0x00007F00 /**< The number of vertical
|
||||
phases */
|
||||
#define XSCL_NUMPHASE_VERT_SHIFT 8 /**< Shift for the number of
|
||||
vertical phases */
|
||||
#define XSCL_NUMPHASE_HORI_MASK 0x0000007F /**< The number of
|
||||
horizontal phases */
|
||||
#define XSCL_NUMPHASE_VERT_MASK 0x00007F00 /**< The number of vertical
|
||||
* phases */
|
||||
#define XSCL_NUMPHASE_VERT_SHIFT 8 /**< Shift for the number of
|
||||
* vertical phases */
|
||||
#define XSCL_NUMPHASE_HORI_MASK 0x0000007F /**< The number of
|
||||
* horizontal phases */
|
||||
/*@}*/
|
||||
|
||||
/** @name Active Coefficient Set Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_COEFFSETS_VERT_MASK 0x000000F0 /**< Active vertical
|
||||
coefficient set */
|
||||
#define XSCL_COEFFSETS_VERT_SHIFT 4 /**< Active vertical
|
||||
coefficient set
|
||||
shift */
|
||||
#define XSCL_COEFFSETS_HORI_MASK 0x0000000F /**< Active horizontal
|
||||
coefficient set */
|
||||
#define XSCL_COEFFSETS_VERT_MASK 0x000000F0 /**< Active vertical
|
||||
* coefficient set */
|
||||
#define XSCL_COEFFSETS_VERT_SHIFT 4 /**< Active vertical
|
||||
* coefficient set
|
||||
* shift */
|
||||
#define XSCL_COEFFSETS_HORI_MASK 0x0000000F /**< Active horizontal
|
||||
* coefficient set */
|
||||
/*@}*/
|
||||
|
||||
/** @name Luma left edge horizontal accumulator fractional value register
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_FRCTLUMALEFT_VALUE_MASK 0x001FFFFF /**< Fractional value to
|
||||
initialize horizontal
|
||||
accumulator for luma */
|
||||
#define XSCL_FRCTLUMALEFT_VALUE_MASK 0x001FFFFF /**< Fractional value to
|
||||
* initialize horizontal
|
||||
.....*..accumulator for luma */
|
||||
/*@}*/
|
||||
|
||||
/** @name Chroma left edge horizontal accumulator fractional value register
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_FRCTCHROMALEFT_VALUE_MASK 0x001FFFFF /**< Fractional value to
|
||||
initialize horizontal
|
||||
accumulator for
|
||||
chroma */
|
||||
#define XSCL_FRCTCHROMALEFT_VALUE_MASK 0x001FFFFF/**< Fractional value to
|
||||
* initialize horizontal
|
||||
* accumulator for
|
||||
* chroma */
|
||||
/*@}*/
|
||||
|
||||
/** @name Luma top edge vertical accumulator fractional value register
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_FRCTLUMATOP_VALUE_MASK 0x001FFFFF /**< Fractional value to
|
||||
initialize vertical
|
||||
accumulator for luma */
|
||||
#define XSCL_FRCTLUMATOP_VALUE_MASK 0x001FFFFF /**< Fractional value to
|
||||
* initialize vertical
|
||||
* accumulator for luma */
|
||||
/*@}*/
|
||||
|
||||
/** @name Chroma top edge vertical accumulator fractional value register
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_FRCTCHROMATOP_VALUE_MASK 0x001FFFFF /**< Fractional value to
|
||||
initialize vertical
|
||||
accumulator for
|
||||
chroma */
|
||||
#define XSCL_FRCTCHROMATOP_VALUE_MASK 0x001FFFFF /**< Fractional value to
|
||||
* initialize vertical
|
||||
* accumulator for
|
||||
* chroma */
|
||||
/*@}*/
|
||||
|
||||
/** @name Coefficient band address register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_COEFFSETADDR_ADDR_MASK 0x0000000F /**< Address of the
|
||||
Coefficient bank to
|
||||
write next */
|
||||
#define XSCL_COEFFSETADDR_ADDR_MASK 0x0000000F /**< Address of the
|
||||
* Coefficient bank to
|
||||
* write next */
|
||||
/*@}*/
|
||||
|
||||
/** @name Coefficient Value Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_COEFFVALUE_NPLUS1_MASK 0xFFFF0000 /**< Second value in the
|
||||
pair */
|
||||
#define XSCL_COEFFVALUE_N_MASK 0x0000FFFF /**< First value in the
|
||||
pair */
|
||||
#define XSCL_COEFFVALUE_NPLUS1_MASK 0xFFFF0000 /**< Second value in the
|
||||
* pair */
|
||||
#define XSCL_COEFFVALUE_N_MASK 0x0000FFFF /**< First value in the
|
||||
* pair */
|
||||
/*@}*/
|
||||
|
||||
/** @name Reset Register bit definition
|
||||
/** @name Coefficient Set Bank Read bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_RESET_RESET_MASK 0x80000000 /**< Software reset bit */
|
||||
/*@}*/
|
||||
|
||||
/** @name Global Interrupt Enable Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_GIER_GIE_MASK 0x80000000 /**< Global interrupt
|
||||
enable */
|
||||
/*@}*/
|
||||
|
||||
/** @name Interrupt Status/Enable Register bit definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_IXR_REG_UPDATE_DONE_MASK 0x00000020 /**< Shadow Register
|
||||
Update Interrupt */
|
||||
#define XSCL_IXR_COEF_WR_ERROR_MASK 0x00000010 /**< Coefficient FIFO
|
||||
Write Error
|
||||
Interrupt */
|
||||
#define XSCL_IXR_OUTPUT_ERROR_MASK 0x00000008 /**< Output Error
|
||||
Interrupt */
|
||||
#define XSCL_IXR_INPUT_ERROR_MASK 0x00000004 /**< Input Error
|
||||
Interrupt */
|
||||
#define XSCL_IXR_COEF_FIFO_READY_MASK 0x00000002 /**< Coefficient FIFO
|
||||
Ready Interrupt */
|
||||
#define XSCL_IXR_OUTPUT_FRAME_DONE_MASK 0x00000001 /**< Video Frame Done
|
||||
Interrupt */
|
||||
|
||||
#define XSCL_IXR_EVENT_MASK (XSCL_IXR_OUTPUT_FRAME_DONE_MASK | \
|
||||
XSCL_IXR_COEF_FIFO_READY_MASK | \
|
||||
XSCL_IXR_REG_UPDATE_DONE_MASK)
|
||||
/**< Mask for all
|
||||
normal event
|
||||
interrupts */
|
||||
#define XSCL_IXR_ERROR_MASK (XSCL_IXR_INPUT_ERROR_MASK | \
|
||||
XSCL_IXR_OUTPUT_ERROR_MASK | \
|
||||
XSCL_IXR_COEF_WR_ERROR_MASK)
|
||||
/**< Mask for all
|
||||
error interrupts */
|
||||
#define XSCL_IXR_ALLINTR_MASK (XSCL_IXR_EVENT_MASK | \
|
||||
XSCL_IXR_ERROR_MASK) /**< Mask for all
|
||||
interrupts */
|
||||
#define XSCL_COEFF_SELECT_BANK_MASK 0x00000003 /**< Select require
|
||||
* bank Mask */
|
||||
#define XSCL_COEFF_SELECT_SET_MASK 0x00000F00 /**< Select require
|
||||
* Set Mask */
|
||||
/*@}*/
|
||||
|
||||
/** @name Chroma Format Type Definition
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_CHROMA_FORMAT_420 1 /**< YUV4:2:0 */
|
||||
#define XSCL_CHROMA_FORMAT_422 2 /**< YUV4:2:2 */
|
||||
#define XSCL_CHROMA_FORMAT_444 3 /**< YUV4:4:4 */
|
||||
#define XSCL_CHROMA_FORMAT_420 1 /**< YUV4:2:0 */
|
||||
#define XSCL_CHROMA_FORMAT_422 2 /**< YUV4:2:2 */
|
||||
#define XSCL_CHROMA_FORMAT_444 3 /**< YUV4:4:4 */
|
||||
/*@}*/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
/** @name Backward compatibility macros
|
||||
* @{
|
||||
*/
|
||||
#define XSCL_CTL XSCL_CTL_OFFSET
|
||||
#define XSCL_STATUS XSCL_STATUS_OFFSET
|
||||
#define XSCL_ERROR XSCL_ERROR_OFFSET
|
||||
#define XSCL_IER XSCL_IRQ_EN_OFFSET
|
||||
#define XSCL_VER XSCL_VER_OFFSET
|
||||
#define XSCL_HSF XSCL_HSF_OFFSET
|
||||
#define XSCL_VSF XSCL_VSF_OFFSET
|
||||
#define XSCL_SRCSIZE XSCL_SRCSIZE_OFFSET
|
||||
#define XSCL_APTHORI XSCL_APTHORI_OFFSET
|
||||
#define XSCL_APTVERT XSCL_APTVERT_OFFSET
|
||||
#define XSCL_OUTSIZE XSCL_OUTSIZE_OFFSET
|
||||
#define XSCL_NUMPHASE XSCL_NUMPHASE_OFFSET
|
||||
#define XSCL_COEFFSETS XSCL_COEFFSETS_OFFSET
|
||||
#define XSCL_FRCTLUMALEFT XSCL_FRCTLUMALEFT_OFFSET
|
||||
#define XSCL_FRCTCHROMALEFT XSCL_FRCTCHROMALEFT_OFFSET
|
||||
#define XSCL_FRCTLUMATOP XSCL_FRCTLUMATOP_OFFSET
|
||||
#define XSCL_FRCTCHROMATOP XSCL_FRCTCHROMATOP_OFFSET
|
||||
#define XSCL_COEFFSETADDR XSCL_COEFFSETADDR_OFFSET
|
||||
#define XSCL_COEFFVALUE XSCL_COEFFVALUE_OFFSET
|
||||
#define XSCL_COEFF_SET_BANK XSCL_COEFF_SET_BANK_OFFSET
|
||||
#define XSCL_COEFF_MEM XSCL_COEFF_MEM_OFFSET
|
||||
|
||||
#define XSCL_CTL_REGUPDATE XSCL_CTL_RUE_MASK
|
||||
#define XSCL_CTL_ENABLE XSCL_CTL_SW_EN_MASK
|
||||
#define XSCL_RESET_RESET_MASK XSCL_CTL_RESET_MASK
|
||||
|
||||
#define XSCL_STSDONE_DONE XSCL_IXR_COEF_W_RDY_MASK
|
||||
#define XSCL_STS_COEF_W_RDY_MASK XSCL_IXR_COEF_W_RDY_MASK
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
|
@ -337,37 +377,35 @@ extern "C" {
|
|||
*
|
||||
* Read the given register.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
* @param RegOffset is the register offset to be read
|
||||
* @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
|
||||
* @return The 32-bit value of the register
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* u32 XScaler_ReadReg(u32 BaseAddress, u32 RegOffset)
|
||||
* @note C-style signature:
|
||||
* u32 XScaler_ReadReg(u32 BaseAddress, u32 RegOffset)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_ReadReg(BaseAddress, RegOffset) \
|
||||
XScaler_In32((BaseAddress) + (RegOffset))
|
||||
#define XScaler_ReadReg(BaseAddress, RegOffset) \
|
||||
XScaler_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
|
||||
* @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.
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* C-style signature:
|
||||
* void XScaler_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)
|
||||
* @note C-style signature:
|
||||
* void XScaler_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScaler_WriteReg(BaseAddress, RegOffset, Data) \
|
||||
XScaler_Out32((BaseAddress) + (RegOffset), (Data))
|
||||
#define XScaler_WriteReg(BaseAddress, RegOffset, Data) \
|
||||
XScaler_Out32((BaseAddress) + (RegOffset), (Data))
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
|
|
@ -41,10 +41,12 @@
|
|||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00a xd 02/10/09 First release
|
||||
* 2.00a xd 12/14/09 Updated doxygen document tags
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- ------------------------------------------------------
|
||||
* 1.00a xd 02/10/09 First release.
|
||||
* 2.00a xd 12/14/09 Updated Doxygen document tags.
|
||||
* 7.0 adk 08/22/14 XScaler_IntrHandler and XScaler_SetCallBack APIs were
|
||||
* modified
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
@ -56,121 +58,65 @@
|
|||
*
|
||||
* This function is the interrupt handler for the Scaler driver.
|
||||
*
|
||||
* This handler reads the pending interrupt from the IER/ISR, determines the
|
||||
* source of the interrupts, calls according callbacks, and finally clears the
|
||||
* interrupts.
|
||||
* This handler calls callback, and finally clears the interrupts.
|
||||
*
|
||||
* The application is responsible for connecting this function to the interrupt
|
||||
* system. Application beyond this driver is also responsible for providing
|
||||
* callbacks to handle interrupts and installing the callbacks using
|
||||
* XScaler_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
|
||||
* XScaler_SetCallBack() during initialization phase.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScaler instance that just
|
||||
* interrupted.
|
||||
* @return None.
|
||||
* @note None.
|
||||
* @param InstancePtr is a pointer to the XScaler instance that just
|
||||
* interrupted.
|
||||
* @return None.
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void XScaler_IntrHandler(void *InstancePtr)
|
||||
{
|
||||
XScaler *XScalerPtr;
|
||||
u32 PendingIntr;
|
||||
u32 ErrorMask;
|
||||
u32 EventMask;
|
||||
|
||||
XScalerPtr = (XScaler *)InstancePtr;
|
||||
XScaler *XScalerPtr = (XScaler *)((void *)InstancePtr);
|
||||
|
||||
/* Validate parameters */
|
||||
Xil_AssertVoid(XScalerPtr != NULL);
|
||||
Xil_AssertVoid(XScalerPtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
/* Get pending interrupts */
|
||||
PendingIntr = XScaler_IntrGetPending(XScalerPtr);
|
||||
|
||||
XScalerPtr->CallBack(XScalerPtr->CallBackRef);
|
||||
|
||||
/* Clear pending interrupt(s) */
|
||||
XScaler_IntrClear(XScalerPtr, PendingIntr);
|
||||
XScaler_IntrClear(XScalerPtr);
|
||||
|
||||
/* Error interrupt is occurring or spurious interrupt */
|
||||
if ((0 == (PendingIntr & XSCL_IXR_ALLINTR_MASK)) ||
|
||||
(PendingIntr & XSCL_IXR_ERROR_MASK)) {
|
||||
ErrorMask = PendingIntr & XSCL_IXR_ERROR_MASK;
|
||||
XScalerPtr->ErrorCallBack(XScalerPtr->ErrorRef, ErrorMask);
|
||||
|
||||
/* The Error Interrupt Callback should reset the Scaler device
|
||||
* and so there is no need to handle other pending interrupts
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/* A normal event just happened */
|
||||
if ((PendingIntr & XSCL_IXR_EVENT_MASK)) {
|
||||
EventMask = PendingIntr & XSCL_IXR_EVENT_MASK;
|
||||
XScalerPtr->EventCallBack(XScalerPtr->EventRef, EventMask);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This routine installs an asynchronous callback function for the given
|
||||
* HandlerType:
|
||||
*
|
||||
* <pre>
|
||||
* HandlerType Callback Function Type
|
||||
* ----------------------- ---------------------------
|
||||
* XSCL_HANDLER_EVENT XScaler_CallBack
|
||||
* XSCL_HANDLER_ERROR XScaler_CallBack
|
||||
*
|
||||
* HandlerType Invoked by this driver when:
|
||||
* ----------------------- --------------------------------------------------
|
||||
* XSCL_HANDLER_EVENT A normal event just happened. Normal events include
|
||||
* frame done, Coefficient FIFO Ready and Shadow
|
||||
* Register updated.
|
||||
*
|
||||
* XSCL_HANDLER_ERROR An error just happened.
|
||||
*
|
||||
* </pre>
|
||||
* This routine installs an asynchronous callback function.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScaler instance to be worked
|
||||
* on.
|
||||
* @param HandlerType specifies which callback is to be attached.
|
||||
* @param CallBackFunc is the address of the callback function.
|
||||
* @param CallBackRef is a user data item that will be passed to the
|
||||
* callback function when it is invoked.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS when handler is installed.
|
||||
* - XST_INVALID_PARAM when HandlerType is invalid.
|
||||
* @return None.
|
||||
*
|
||||
* @note
|
||||
* Invoking this function for a handler that already has been installed replaces
|
||||
* it with the new handler.
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int XScaler_SetCallBack(XScaler *InstancePtr, u32 HandlerType,
|
||||
void XScaler_SetCallBack(XScaler *InstancePtr,
|
||||
void *CallBackFunc, void *CallBackRef)
|
||||
{
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
Xil_AssertNonvoid(CallBackFunc != NULL);
|
||||
Xil_AssertNonvoid(CallBackRef != NULL);
|
||||
|
||||
switch (HandlerType) {
|
||||
case XSCL_HANDLER_EVENT:
|
||||
InstancePtr->EventCallBack = (XScaler_CallBack)CallBackFunc;
|
||||
InstancePtr->EventRef = CallBackRef;
|
||||
break;
|
||||
/* Validate arguments. */
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
Xil_AssertVoid(CallBackFunc != NULL);
|
||||
Xil_AssertVoid(CallBackRef != NULL);
|
||||
|
||||
case XSCL_HANDLER_ERROR:
|
||||
InstancePtr->ErrorCallBack = (XScaler_CallBack)CallBackFunc;
|
||||
InstancePtr->ErrorRef = CallBackRef;
|
||||
break;
|
||||
/* Setting the HandlerType */
|
||||
InstancePtr->CallBack =
|
||||
(XScaler_CallBack)((void *)CallBackFunc);
|
||||
InstancePtr->CallBackRef = CallBackRef;
|
||||
|
||||
default:
|
||||
return XST_INVALID_PARAM;
|
||||
}
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00a xd 05/14/09 First release
|
||||
* 2.00a xd 12/14/09 Updated doxygen document tags
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------- -------------------------------------------------------
|
||||
* 1.00a xd 05/14/09 First release
|
||||
* 2.00a xd 12/14/09 Updated doxygen document tags
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
|
Loading…
Add table
Reference in a new issue