diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/data/dual_splitter.mdd b/XilinxProcessorIPLib/drivers/dual_splitter/data/dual_splitter.mdd new file mode 100644 index 00000000..20a5484f --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/data/dual_splitter.mdd @@ -0,0 +1,40 @@ +############################################################################## +# +# Copyright (C) 2014 - 2015 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 +# XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Except as contained in this notice, the name of the Xilinx shall not be used +# in advertising or otherwise to promote the sale, use or other dealings in +# this Software without prior written authorization from Xilinx. +############################################################################### + +OPTION psf_version = 2.1; + +BEGIN driver dual_splitter + OPTION supported_peripherals = (v_dual_splitter); + OPTION driver_state = ACTIVE; + OPTION copyfiles = all; + OPTION VERSION = 1.0; + OPTION NAME = dual_splitter; +END driver diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/data/dual_splitter.tcl b/XilinxProcessorIPLib/drivers/dual_splitter/data/dual_splitter.tcl new file mode 100644 index 00000000..00a7f62b --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/data/dual_splitter.tcl @@ -0,0 +1,36 @@ +############################################################################## +# +# Copyright (C) 2014 - 2015 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 +# XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Except as contained in this notice, the name of the Xilinx shall not be used +# in advertising or otherwise to promote the sale, use or other dealings in +# this Software without prior written authorization from Xilinx. +############################################################################### + +proc generate {drv_handle} { + ::hsi::utils::define_include_file $drv_handle "xparameters.h" "XDualSplitter" "NUM_INSTANCES" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_MAX_SEGMENTS" "C_AXIS_VIDEO_MAX_TDATA_WIDTH" "C_AXIS_VIDEO_MAX_ITDATASMPLS_PER_CLK" "C_AXIS_VIDEO_MAX_OTDATASMPLS_PER_CLK" "C_MAX_OVRLAP" "C_MAX_SMPL_WIDTH" "C_HAS_AXI4_LITE" "C_HAS_IRQ" + ::hsi::utils::define_config_file $drv_handle "xdualsplitter_g.c" "XDualSplitter" "DEVICE_ID" "C_BASEADDR" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_MAX_SEGMENTS" "C_AXIS_VIDEO_MAX_TDATA_WIDTH" "C_AXIS_VIDEO_MAX_ITDATASMPLS_PER_CLK" "C_AXIS_VIDEO_MAX_OTDATASMPLS_PER_CLK" "C_MAX_OVRLAP" "C_MAX_SMPL_WIDTH" "C_HAS_AXI4_LITE" "C_HAS_IRQ" + ::hsi::utils::define_canonical_xpars $drv_handle "xparameters.h" "DualSplitter" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_ACTIVE_COLS" "C_ACTIVE_ROWS" "C_MAX_SEGMENTS" "C_AXIS_VIDEO_MAX_TDATA_WIDTH" "C_AXIS_VIDEO_MAX_ITDATASMPLS_PER_CLK" "C_AXIS_VIDEO_MAX_OTDATASMPLS_PER_CLK" "C_MAX_OVRLAP" "C_MAX_SMPL_WIDTH" "C_HAS_AXI4_LITE" "C_HAS_IRQ" +} diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/src/Makefile b/XilinxProcessorIPLib/drivers/dual_splitter/src/Makefile new file mode 100644 index 00000000..22b63f9e --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/src/Makefile @@ -0,0 +1,40 @@ +COMPILER= +ARCHIVER= +CP=cp +COMPILER_FLAGS= +EXTRA_COMPILER_FLAGS= +LIB=libxil.a + +CC_FLAGS = $(COMPILER_FLAGS) +ECC_FLAGS = $(EXTRA_COMPILER_FLAGS) + +RELEASEDIR=../../../lib +INCLUDEDIR=../../../include +INCLUDES=-I./. -I${INCLUDEDIR} + +OUTS = *.o + +LIBSOURCES:=*.c +INCLUDEFILES:=*.h + +OBJECTS = $(addsuffix .o, $(basename $(wildcard *.c))) + +libs: banner xdual_splitter_libs clean + +%.o: %.c + ${COMPILER} $(CC_FLAGS) $(ECC_FLAGS) $(INCLUDES) -o $@ $< + +banner: + echo "Compiling dual_splitter" + +xdual_splitter_libs: ${OBJECTS} + $(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OBJECTS} + +.PHONY: include +include: xdual_splitter_includes + +xdual_splitter_includes: + ${CP} ${INCLUDEFILES} ${INCLUDEDIR} + +clean: + rm -rf ${OBJECTS} diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter.c b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter.c new file mode 100644 index 00000000..7e4c8aac --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter.c @@ -0,0 +1,352 @@ +/****************************************************************************** +* +* Copyright (C) 2014 - 2015 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 +* XILINX 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 xdualsplitter.c +* +* This file contains the implementation of the interface functions for +* Dual Splitter core. Please refer to the header file xdualsplitter.h for +* more detailed information. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who Date     Changes
+* ----- --- -------- --------------------------------------------------
+* 1.00  sha 07/21/14 Initial release.
+* 
+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xdualsplitter.h" +#include "string.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + +static void StubErrCallback(void *CallbackRef, u32 ErrorMask); + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function initializes the Dual Splitter core. This function must be +* called prior to using the Dual Splitter core. Initialization of the core +* includes setting up the instance data and ensuring the hardware is in a +* quiescent state. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @param CfgPtr points to the configuration structure associated with +* the Dual Splitter core. +* @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 if XDualSplitter_CfgInitialize was successful. +* +* @note None. +* +******************************************************************************/ +s32 XDualSplitter_CfgInitialize(XDualSplitter *InstancePtr, + XDualSplitter_Config *CfgPtr, + u32 EffectiveAddr) +{ + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(CfgPtr != NULL); + Xil_AssertNonvoid(EffectiveAddr != (u32)0x0); + + + /* Setup the instance */ + (void)memset((void *)InstancePtr, 0, sizeof(XDualSplitter)); + (void)memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr, + sizeof(XDualSplitter_Config)); + InstancePtr->Config.BaseAddress = EffectiveAddr; + + /* Set all handlers to stub values, let user configure + * this data later + */ + InstancePtr->ErrCallback = + (XDualSplitter_ErrCallback)((void *)StubErrCallback); + + /* Reset the hardware and set the flag to indicate the driver is + * ready + */ + XDualSplitter_Reset(InstancePtr); + InstancePtr->IsReady = XIL_COMPONENT_IS_READY; + + return XST_SUCCESS; +} + +/*****************************************************************************/ +/** +* +* This function resets the Dual Splitter core instance. This reset effects the +* core immediately and may cause image tearing. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XDualSplitter_Reset(XDualSplitter *InstancePtr) +{ + u32 Reset; + + /* Verify argument. */ + Xil_AssertVoid(InstancePtr != NULL); + + /* Read General Control register */ + Reset = XDualSplitter_ReadReg(InstancePtr->Config.BaseAddress, + XDUSP_GENR_CTL_OFFSET) | XDUSP_GENR_CTL_RST_MASK; + + /* Write into General Control register */ + XDualSplitter_WriteReg(InstancePtr->Config.BaseAddress, + XDUSP_GENR_CTL_OFFSET, Reset); +} + +/*****************************************************************************/ +/** +* +* This function sets the image size (width x height) of the Dual Splitter core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @param Height specifies the height of the input image that needs to +* be set within the range [0, 2160]. +* @param Width specifies the width of the input image that needs to be +* set within the range [0, 3840]. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XDualSplitter_SetImageSize(XDualSplitter *InstancePtr, u16 Height, + u16 Width) +{ + u32 ImageSize; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(Height <= XDUSP_MAX_IMG_HEIGHT); + Xil_AssertVoid(Width <= XDUSP_MAX_IMG_WIDTH); + + /* Calculate image size to fit into 32-bit register. */ + ImageSize = Width & XDUSP_TIME_CTL_WIDTH_MASK; + ImageSize |= ((u32)Height << XDUSP_TIME_CTL_HEIGHT_SHIFT) & + XDUSP_TIME_CTL_HEIGHT_MASK; + + /* Write into Time Control register */ + XDualSplitter_WriteReg(InstancePtr->Config.BaseAddress, + XDUSP_TIME_CTL_OFFSET, ImageSize); +} + +/*****************************************************************************/ +/** +* +* This function gets the image size (width x height) of the Dual Splitter core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @param Height specifies a pointer to the 16-bit variable that will be +* filled with height which is in the range [0, 2160]. +* @param Width specifies a pointer to the 16-bit variable that will be +* filled with width which is in the range [0, 3840]. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XDualSplitter_GetImageSize(XDualSplitter *InstancePtr, u16 *Height, + u16 *Width) +{ + u32 ImageSize; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(Height != NULL); + Xil_AssertVoid(Width != NULL); + + /* Read from Time Control register */ + ImageSize = XDualSplitter_ReadReg(InstancePtr->Config.BaseAddress, + XDUSP_TIME_CTL_OFFSET); + + *Width = (u16)(ImageSize & XDUSP_TIME_CTL_WIDTH_MASK); + *Height = (u16)((ImageSize >> XDUSP_TIME_CTL_HEIGHT_SHIFT) & + XDUSP_TIME_CTL_WIDTH_MASK); +} + +/*****************************************************************************/ +/** +* +* This function sets the image parameters to split into multiple segments. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @param InputSamples specifies the number of input samples per clock +* that needs to be set within the range [0, 4]. +* @param OutputSamples specifies the number of output samples per clock +* that needs to be set within the range [0, 4]. +* @param ImageSegments specifies the number of image segments +* that needs to be set within the range [0, 4]. +* @param Overlap specifies the overlap of the samples in the segments. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XDualSplitter_SetImgParam(XDualSplitter *InstancePtr, u8 InputSamples, + u8 OutputSamples, u8 ImageSegments, u8 Overlap) +{ + u32 Data; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InputSamples <= XDUSP_MAX_INPUT_SAMPLES); + Xil_AssertVoid(OutputSamples <= XDUSP_MAX_OUTPUT_SAMPLES); + Xil_AssertVoid(ImageSegments <= XDUSP_MAX_SEGMENTS); + + /* Calculate Image parameters to fit into 32-bit register. */ + Data = InputSamples & XDUSP_CORE_CTL_IN_SAMPLES_MASK; + Data |= ((u32)OutputSamples << + XDUSP_CORE_CTL_OUT_SAMPLES_SHIFT) & + XDUSP_CORE_CTL_OUT_SAMPLES_MASK; + Data |= ((u32)ImageSegments << + XDUSP_CORE_CTL_IMG_SEG_SHIFT) & + XDUSP_CORE_CTL_IMG_SEG_MASK; + Data |= ((u32)Overlap << + XDUSP_CORE_CTL_OVRLAP_SEG_SHIFT) & + XDUSP_CORE_CTL_OVRLAP_SEG_MASK; + + /* Write into Core Control register */ + XDualSplitter_WriteReg(InstancePtr->Config.BaseAddress, + XDUSP_CORE_CTL_OFFSET, Data); +} + +/*****************************************************************************/ +/** +* +* This function gets the image parameters of the Dual Splitter core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @param InputSamples specifies a pointer to the 8-bit variable that +* will be filled with number of input samples which is in the +* range [0, 4] +* @param OutputSamples specifies a pointer to the 8-bit variable that +* will be filled with number of output samples which is in the +* range [0, 4] +* @param ImageSegments specifies a pointer to the 8-bit variable that +* will be filled with number of image segments which is in the +* range [0, 4] +* @param Overlap specifies a pointer to the 8-bit variable that will be +* filled with number of samples overlapping the segments. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XDualSplitter_GetImgParam(XDualSplitter *InstancePtr, u8 *InputSamples, + u8 *OutputSamples, u8 *ImageSegments, + u8 *Overlap) +{ + u32 Data; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InputSamples != NULL); + Xil_AssertVoid(OutputSamples != NULL); + Xil_AssertVoid(ImageSegments != NULL); + Xil_AssertVoid(Overlap != NULL); + + /* Read from Core Control register */ + Data = XDualSplitter_ReadReg(InstancePtr->Config.BaseAddress, + XDUSP_CORE_CTL_OFFSET); + + /* Extract Image parameters. */ + *InputSamples = (u8)(Data & XDUSP_CORE_CTL_IN_SAMPLES_MASK); + *OutputSamples = (u8)((Data & + XDUSP_CORE_CTL_OUT_SAMPLES_MASK) >> + XDUSP_CORE_CTL_OUT_SAMPLES_SHIFT); + *ImageSegments = (u8)((Data & + XDUSP_CORE_CTL_IMG_SEG_MASK) >> + XDUSP_CORE_CTL_IMG_SEG_SHIFT); + *Overlap = (u8)((Data & + XDUSP_CORE_CTL_OVRLAP_SEG_MASK) >> + XDUSP_CORE_CTL_OVRLAP_SEG_SHIFT); +} + +/*****************************************************************************/ +/** +* +* This routine is a stub for the asynchronous error interrupt callback. The +* stub is here in case the upper layer forgot to set the handler. On +* initialization, error interrupt handler is set to this callback. It is +* considered as an error for this handler to be invoked. +* +* @param CallbackRef is a callback reference passed in by the upper +* layer when setting the callback functions and passed back +* to the upper layer when the callback is invoked. +* @param ErrorMask is a bit mask indicating the cause of the error. Its +* value equals 'OR'ing one or more XDUSP_ERR_*_MASK values +* defined in xdualsplitter_hw.h. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +static void StubErrCallback(void *CallbackRef, u32 ErrorMask) +{ + (void)CallbackRef; + (void)ErrorMask; + Xil_AssertVoidAlways(); +} diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter.h b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter.h new file mode 100644 index 00000000..44797169 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter.h @@ -0,0 +1,400 @@ +/****************************************************************************** +* +* Copyright (C) 2014 - 2015 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 +* XILINX 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 xdualsplitter.h +* +* This header file contains identifiers and register-level core functions (or +* macros), range macros, structure typedefs that can be used to access the +* Xilinx Dual Splitter core. +* +* Core Features +* +* For full description of Dual Splitter features, please see the hardware +* specification. +* +* Initialization & Configuration +* +* The application needs to do the following steps in order to use +* Dual Splitter core. +* +* - Call XDualSplitter_LookupConfig using a device ID to find the core +* configuration. +* - Call XDualSplitter_CfgInitialize to initialize the device and the driver +* instance associated with it. +* +* Interrupts +* +* The driver provides an interrupt handler XDualSplitter_IntrHandler for +* handling the interrupt from the Dual Splitter core. The users of this driver +* have to register this handler with the interrupt system and provide the +* callback functions by using XDualSplitter_SetCallBack API. +* +* Virtual Memory +* +* This driver supports Virtual Memory. The RTOS is responsible for calculating +* the correct device base address in Virtual Memory space. +* +* Threads +* +* This driver is not thread safe. Any needs for threads or thread mutual +* exclusion must be satisfied by the layer above this driver. +* +* Asserts +* +* Asserts are used within all Xilinx drivers to enforce constraints on argument +* values. Asserts can be turned off on a system-wide basis by defining, at +* compile time, the NDEBUG identifier. By default, asserts are turned on and it +* is recommended that users leave asserts on during development. +* +* Building the driver +* +* The Dual Splitter driver is composed of several source files. This allows +* the user to build and link only those parts of the driver that are necessary. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who Date     Changes
+* ----- --- -------- --------------------------------------------------
+* 1.00  sha 07/21/14 Initial release.
+* 
+* +******************************************************************************/ + +#ifndef XDUALSPLITTER_H_ +#define XDUALSPLITTER_H_ /**< Prevent circular inclusions by using + * protection macros */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xdualsplitter_hw.h" +#include "xil_assert.h" +#include "xstatus.h" + +/************************** Constant Definitions *****************************/ + +#define XDUSP_MAX_INPUT_SAMPLES 4 /**< Maximum input samples per + * clock */ +#define XDUSP_MAX_OUTPUT_SAMPLES 4 /**< Maximum output samples + * per clock */ + +#define XDUSP_MAX_SEGMENTS 4 /**< Maximum number of segments + * in an image */ + +#define XDUSP_MAX_IMG_WIDTH 3840 /**< Maximum image width */ +#define XDUSP_MAX_IMG_HEIGHT 2160 /**< Maximum image height */ + +/**************************** Type Definitions *******************************/ + +/** +* This typedef contains configuration information for the Dual Splitter +* core. Each Dual Splitter device should have a configuration structure +* associated. +*/ +typedef struct { + u16 DeviceId; /**< DeviceId is the unique ID of the Dual + * Splitter core */ + u32 BaseAddress; /**< BaseAddress is the physical base address + * of the core's registers */ + u32 ActiveCols; /**< Active Maximum Image Width */ + u32 ActiveRows; /**< Active Maximum Image Height */ + u8 MaxSegments; /**< Maximum number of segments in an image */ + u8 MaxTDataWidth; /**< Maximum Data bus Width. It is the + * multiplication of maximum input sample + * width and maximum input samples per + * clock */ + u8 MaxITDataSamples; /**< Maximum Input Data Samples per clock */ + u8 MaxOTDataSamples; /**< Maximum Output Data Samples per clock */ + u8 MaxOverlap; /**< Maximum Overlap of the samples in the + * segments */ + u8 MaxSampleWidth; /**< Maximum number of bits in a Sample */ + u8 HasAxi4Lite; /**< Axi4-Lite support */ + u8 HasIntrReq; /**< IRQ support */ +} XDualSplitter_Config; + +/** +* +* Callback type for error interrupt. +* +* @param CallbackRef is a callback reference passed in by the upper +* layer when setting the callback functions and passed back +* to the upper layer when the callback is invoked. +* @param ErrorMask is a bit mask indicating the cause of the error. +* Its value equals 'OR'ing one or more XDUSP_ERR_*_MASK values +* defined in xdualsplitter_hw.h. +* +******************************************************************************/ +typedef void (*XDualSplitter_ErrCallback)(void *CallbackRef, u32 ErrorMask); + +/** +* The XDualSplitter driver instance data. An instance must be allocated for +* each Dual Splitter core in use. +*/ +typedef struct { + XDualSplitter_Config Config; /**< Hardware Configuration */ + u32 IsReady; /**< Core and the driver instance are + * initialized */ + XDualSplitter_ErrCallback ErrCallback; /**< Callback for error + * interrupt */ + void *ErrRef; /**< To be passed to the error + * interrupt callback */ +} XDualSplitter; + +/***************** Macros (Inline Functions) Definitions *********************/ + +/*****************************************************************************/ +/** +* +* This macro commits all the register value changes made so far by the +* software to the Dual Splitter core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* +* @return None. +* +* @note C-style signature: +* void XDualSplitter_RegUpdateEnable(XDualSplitter *InstancePtr) +* +******************************************************************************/ +#define XDualSplitter_RegUpdateEnable(InstancePtr) \ + XDualSplitter_WriteReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_CTL_OFFSET, \ + XDualSplitter_ReadReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_CTL_OFFSET) | XDUSP_GENR_CTL_RUE_MASK) + +/*****************************************************************************/ +/** +* +* This macro prevents the Dual Splitter core from committing recent changes +* made so far by the software. When disabled, changes to other configuration +* registers are stored but do not effect the behavior of the core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* +* @return None. +* +* @note C-style signature: +* void XDualSplitter_RegUpdateDisable(XDualSplitter *InstancePtr) +* +******************************************************************************/ +#define XDualSplitter_RegUpdateDisable(InstancePtr) \ + XDualSplitter_WriteReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_CTL_OFFSET, \ + XDualSplitter_ReadReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_CTL_OFFSET) & (~XDUSP_GENR_CTL_RUE_MASK)) + +/*****************************************************************************/ +/** +* +* This macro enables the Dual Splitter core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* +* @return None. +* +* @note C-style signature: +* void XDualSplitter_Enable(XDualSplitter *InstancePtr) +* +******************************************************************************/ +#define XDualSplitter_Enable(InstancePtr) \ + XDualSplitter_WriteReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_CTL_OFFSET, \ + XDualSplitter_ReadReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_CTL_OFFSET) | XDUSP_GENR_CTL_EN_MASK) + +/*****************************************************************************/ +/** +* +* This macro disables the Dual Splitter core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* +* @return None. +* +* @note C-style signature: +* void XDualSplitter_Disable(XDualSplitter *InstancePtr) +* +******************************************************************************/ +#define XDualSplitter_Disable(InstancePtr) \ + XDualSplitter_WriteReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_CTL_OFFSET, \ + XDualSplitter_ReadReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_CTL_OFFSET) & \ + ~(XDUSP_GENR_CTL_EN_MASK)) + +/*****************************************************************************/ +/** +* +* This macro enables the given individual interrupt(s) on the Dual Splitter +* core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @param IntrType is the bit-mask of the interrupts to be enabled. +* Bit positions of 1 will be enabled. Bit positions of 0 will +* keep the previous setting. This mask is formed by OR'ing +* XDUSP_ERR_*_MASK bits defined in xdualsplitter_hw.h. +* +* @return None. +* +* @note The existing enabled interrupt(s) will remain enabled. +* C-style signature: +* void XDualSplitter_IntrEnable(XDualSplitter *InstancePtr, +* u32 IntrType) +* +******************************************************************************/ +#define XDualSplitter_IntrEnable(InstancePtr, IntrType) \ + XDualSplitter_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XDUSP_IRQ_EN_OFFSET), (IntrType & \ + XDUSP_ALL_ERR_MASK) | \ + XDualSplitter_ReadReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_IRQ_EN_OFFSET)) + +/*****************************************************************************/ +/** +* +* This macro disables the given individual interrupt(s) on the Dual Splitter +* core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @param IntrType is the bit-mask of the interrupts to be disabled. +* Bit positions of 1 will be enabled. Bit positions of 0 will +* keep the previous setting. This mask is formed by OR'ing +* XDUSP_ERR_*_MASK bits defined in xdualsplitter_hw.h. +* +* @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 XDualSplitter_IntrDisable(XDualSplitter *InstancePtr, +* u32 IntrType) +* +******************************************************************************/ +#define XDualSplitter_IntrDisable(InstancePtr, IntrType) \ + XDualSplitter_WriteReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_IRQ_EN_OFFSET, \ + XDualSplitter_ReadReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_IRQ_EN_OFFSET) & ((~IntrType) & \ + XDUSP_ALL_ERR_MASK)) + +/*****************************************************************************/ +/** +* +* This macro returns the pending interrupts of the Dual Splitter core. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* +* @return The pending interrupts of the Dual Splitter. Use +* XDUSP_ERR_*_MASK constants defined in xdualsplitter_hw.h to +* interpret this value. The returned value is a logical AND of +* the contents of the GENR_ERROR Register and the IRQ_ENABLE +* Register. +* +* @note C-style signature: +* u32 XDualSplitter_IntrGetPending(XDualSplitter *InstancePtr) +* +******************************************************************************/ +#define XDualSplitter_IntrGetPending(InstancePtr) \ + XDualSplitter_ReadReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_IRQ_EN_OFFSET) & \ + XDualSplitter_ReadReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_ERR_OFFSET) & \ + XDUSP_ALL_ERR_MASK + +/*****************************************************************************/ +/** +* +* This macro clears/acknowledges pending interrupts of the Dual Splitter core. +* in the General error register. Bit positions of 1 will be cleared. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @param IntrType is the pending interrupts to clear/acknowledge. +* Use OR'ing of XDUSP_ERR_*_MASK constants defined in +* xdualsplitter_hw.h to create this parameter value. +* +* @return None. +* +* @note C-style signature: +* void XDualSplitter_IntrClear(XDualSplitter *InstancePtr, +* u32 IntrType) +* +******************************************************************************/ +#define XDualSplitter_IntrClear(InstancePtr, IntrType) \ + XDualSplitter_WriteReg((InstancePtr)->Config.BaseAddress, \ + XDUSP_GENR_ERR_OFFSET, IntrType & XDUSP_ALL_ERR_MASK) + +/************************** Function Prototypes ******************************/ + +/* Initialization function in xdualsplitter_sinit.c */ +XDualSplitter_Config *XDualSplitter_LookupConfig(u16 DeviceId); + +/* Initialization and control functions in xdualsplitter.c */ +s32 XDualSplitter_CfgInitialize(XDualSplitter *InstancePtr, + XDualSplitter_Config *CfgPtr, + u32 EffectiveAddr); + +void XDualSplitter_Reset(XDualSplitter *InstancePtr); + +void XDualSplitter_SetImageSize(XDualSplitter *InstancePtr, u16 Height, + u16 Width); +void XDualSplitter_GetImageSize(XDualSplitter *InstancePtr, u16 *Height, + u16 *Width); + +void XDualSplitter_SetImgParam(XDualSplitter *InstancePtr, + u8 InputSamples, u8 OutputSamples, + u8 ImageSegments, u8 Overlap); +void XDualSplitter_GetImgParam(XDualSplitter *InstancePtr, + u8 *InputSamples, u8 *OutputSamples, + u8 *ImageSegments, u8 *Overlap); + +/* Self test function in xdualsplitter_selftest.c */ +s32 XDualSplitter_SelfTest(XDualSplitter *InstancePtr); + +/* Interrupt related functions in xdualsplitter_intr.c */ +void XDualSplitter_IntrHandler(void *InstancePtr); +void XDualSplitter_SetCallback(XDualSplitter *InstancePtr, + void *CallbackFunc, void *CallbackRef); + +/************************** Variable Declarations ****************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* End of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_g.c b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_g.c new file mode 100644 index 00000000..b5fc89fe --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_g.c @@ -0,0 +1,63 @@ + +/******************************************************************* +* +* CAUTION: This file is automatically generated by HSI. +* Version: +* DO NOT EDIT. +* +* Copyright (C) 2010-2015 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 +*XILINX 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. +* + +* +* Description: Driver configuration +* +*******************************************************************/ + +#include "xparameters.h" +#include "xdualsplitter.h" + +/* +* The configuration table for devices +*/ + +XDualSplitter_Config XDualSplitter_ConfigTable[] = +{ + { + XPAR_DUALSPLITTER_0_DEVICE_ID, + XPAR_DUALSPLITTER_0_BASEADDR, + XPAR_DUALSPLITTER_0_ACTIVE_COLS, + XPAR_DUALSPLITTER_0_ACTIVE_ROWS, + XPAR_DUALSPLITTER_0_MAX_SEGMENTS, + XPAR_DUALSPLITTER_0_AXIS_VIDEO_MAX_TDATA_WIDTH, + XPAR_DUALSPLITTER_0_AXIS_VIDEO_MAX_ITDATASMPLS_PER_CLK, + XPAR_DUALSPLITTER_0_AXIS_VIDEO_MAX_OTDATASMPLS_PER_CLK, + XPAR_DUALSPLITTER_0_MAX_OVRLAP, + XPAR_DUALSPLITTER_0_MAX_SMPL_WIDTH, + XPAR_DUALSPLITTER_0_HAS_AXI4_LITE, + XPAR_DUALSPLITTER_0_HAS_IRQ + } +}; diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_hw.h b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_hw.h new file mode 100644 index 00000000..4f57ccbd --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_hw.h @@ -0,0 +1,210 @@ +/****************************************************************************** +* +* Copyright (C) 2014 - 2015 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 +* XILINX 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 xdualsplitter_hw.h +* +* This header file contains identifiers and register-level driver functions (or +* macros) that can be used to access the Xilinx Dual Splitter core. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who Date     Changes
+* ----- --- -------- --------------------------------------------------
+* 1.00  sha 07/21/14 Initial release.
+* 
+* +******************************************************************************/ + +#ifndef XDUALSPLITTER_HW_H_ +#define XDUALSPLITTER_HW_H_ /**< Prevent circular inclusions + * by using protection macros */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xil_io.h" + +/************************** Constant Definitions *****************************/ + +/** @name Core registers offsets +* @{ +*/ +#define XDUSP_GENR_CTL_OFFSET 0x0000 /**< General Control register + * offset */ +#define XDUSP_GENR_ERR_OFFSET 0x0008 /**< General Error register + * offset */ +#define XDUSP_IRQ_EN_OFFSET 0x000C /**< IRQ Enable register + * offset */ +#define XDUSP_TIME_CTL_OFFSET 0x0020 /**< Time Control register + * offset */ +#define XDUSP_CORE_CTL_OFFSET 0x0100 /**< Core Control register + * offset */ +/*@}*/ + +/** @name General control register bit masks +* @{ +*/ +#define XDUSP_GENR_CTL_EN_MASK 0x00000001 /**< Enable mask */ +#define XDUSP_GENR_CTL_RUE_MASK 0x00000002 /**< Register update + * enable mask */ +#define XDUSP_GENR_CTL_RST_MASK 0x80000000 /**< Reset mask */ +/*@}*/ + +/** @name Error register bit masks +* @{ +*/ +#define XDUSP_ERR_EOL_EARLY_MASK 0x00000001 /**< Error: End of line + * early mask */ +#define XDUSP_ERR_EOL_LATE_MASK 0x00000002 /**< Error: End of line + * late mask */ +#define XDUSP_ERR_SOF_EARLY_MASK 0x00000004 /**< Error: Start of + * frame early + * mask */ +#define XDUSP_ERR_SOF_LATE_MASK 0x00000008 /**< Error: Start of + * frame late mask */ +#define XDUSP_ALL_ERR_MASK (XDUSP_ERR_EOL_EARLY_MASK | \ + XDUSP_ERR_EOL_LATE_MASK | \ + XDUSP_ERR_SOF_EARLY_MASK | \ + XDUSP_ERR_SOF_LATE_MASK) /**< All + * error + * mask */ +/*@}*/ + +/** @name Time control register bit masks and shifts +* @{ +*/ +#define XDUSP_TIME_CTL_WIDTH_MASK 0x0000FFFF /**< Image width + * mask */ +#define XDUSP_TIME_CTL_HEIGHT_MASK 0xFFFF0000 /**< Image height + * mask */ +#define XDUSP_TIME_CTL_HEIGHT_SHIFT 16 /**< Image height + * shift */ +/*@}*/ + +/** @name Core control register masks and shifts +* @{ +*/ +#define XDUSP_CORE_CTL_IN_SAMPLES_MASK 0x000000FF /**< Input + * samples + * mask */ +#define XDUSP_CORE_CTL_OUT_SAMPLES_MASK 0x0000FF00 /**< Output + * samples + * mask */ +#define XDUSP_CORE_CTL_IMG_SEG_MASK 0x00FF0000 /**< No of + * image + * segments + * mask */ +#define XDUSP_CORE_CTL_OVRLAP_SEG_MASK 0xFF000000 /**< No of + * over- + * lapping + * segments + * mask */ +#define XDUSP_CORE_CTL_OUT_SAMPLES_SHIFT 8 /**< Output samples + * shift */ +#define XDUSP_CORE_CTL_IMG_SEG_SHIFT 16 /**< No of image + * segments shift */ +#define XDUSP_CORE_CTL_OVRLAP_SEG_SHIFT 24 /**< No of overlapping + * segments shift */ +/*@}*/ + +/**************************** Type Definitions *******************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + +/** @name Device register I/O APIs +* @{ +*/ +#define XDualSplitter_In32 Xil_In32 /**< Input operation. */ +#define XDualSplitter_Out32 Xil_Out32 /**< Output operation. */ + +/*****************************************************************************/ +/** +* +* This macro reads a value from a Dual Splitter core's register. +* A 32 bit read is performed. If the component is implemented in a smaller +* width, only the least significant data is read from the register. The most +* significant data will be read as 0. +* +* @param BaseAddress is the base address of the XDualSplitter core. +* @param RegOffset is the register offset of the register (defined at +* the top of this file). +* +* @return The 32-bit value of the register. +* +* @note C-style signature: +* u32 XDualSplitter_ReadReg(u32 BaseAddress, u32 RegOffset) +* +******************************************************************************/ +#define XDualSplitter_ReadReg(BaseAddress, RegOffset) \ + XDualSplitter_In32((BaseAddress) + (u32)(RegOffset)) + +/*****************************************************************************/ +/** +* +* This macro writes a value into a Dual Splitter core's register. +* A 32 bit write is performed. If the component is implemented in a smaller +* width, only the least significant data is written. +* +* @param BaseAddress is the base address of the XDualSplitter core. +* @param RegOffset is the register offset of the register (defined at +* the top of this file) to be written. +* @param Data is the 32-bit value to write into the register. +* +* @return None. +* +* @note C-style signature: +* void XDualSplitter_WriteReg(u32 BaseAddress, u32 RegOffset, +* u32 Data) +* +******************************************************************************/ +#define XDualSplitter_WriteReg(BaseAddress, RegOffset, Data) \ + XDualSplitter_Out32((BaseAddress) + (u32)(RegOffset), (Data)) +/*@}*/ + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Declarations ****************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* End of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_intr.c b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_intr.c new file mode 100644 index 00000000..025215c8 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_intr.c @@ -0,0 +1,147 @@ +/****************************************************************************** +* +* Copyright (C) 2014 - 2015 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 +* XILINX 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 xdualsplitter_intr.c +* +* This file contains interrupt related functions for Xilinx Dual Splitter +* core. Please see xdualsplitter.h for more details of the core. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who Date     Changes
+* ----- --- -------- --------------------------------------------------
+* 1.00  sha 07/21/14 Initial release.
+* 
+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xdualsplitter.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function is the interrupt handler for the Dual Splitter core. +* +* This handler reads the pending interrupt from the GENR_ERROR register, +* determines the source of the interrupts and calls the respective +* callbacks for the interrupts that are enabled in IRQ_ENABLE register, +* and finally clears the interrupts. +* +* The application is responsible for connecting this function to the interrupt +* system. Application beyond this core is also responsible for providing +* callbacks to handle interrupts and installing the callbacks using +* XDualSplitter_SetCallBack() during initialization phase. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* +* @return None. +* +* @note Interrupt should be enabled to execute interrupt handler. +* +******************************************************************************/ +void XDualSplitter_IntrHandler(void *InstancePtr) +{ + u32 PendingIntr; + u32 ErrorStatus; + + XDualSplitter *XDualSpltrPtr = (XDualSplitter *)((void *)InstancePtr); + + /* Verify arguments. */ + Xil_AssertVoid(XDualSpltrPtr != NULL); + Xil_AssertVoid(XDualSpltrPtr->IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertVoid(XDualSpltrPtr->Config.HasIntrReq == 0x1); + + /* Get pending interrupts */ + PendingIntr = XDualSplitter_IntrGetPending(XDualSpltrPtr); + + /* Interrupt has happened due to error(s) */ + if (PendingIntr & XDUSP_ALL_ERR_MASK) { + ErrorStatus = PendingIntr & (u32)XDUSP_ALL_ERR_MASK; + XDualSpltrPtr->ErrCallback(XDualSpltrPtr->ErrRef, ErrorStatus); + } + + /* Clear pending interrupt(s) */ + XDualSplitter_IntrClear(XDualSpltrPtr, PendingIntr); +} + +/*****************************************************************************/ +/** +* +* This function installs an asynchronous callback function. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* @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 None. +* +* @note Invoking this function for a callback that already has been +* installed replaces it with the new callback. +* +******************************************************************************/ +void XDualSplitter_SetCallback(XDualSplitter *InstancePtr, + void *CallbackFunc, void *CallbackRef) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertVoid(CallbackFunc != NULL); + Xil_AssertVoid(CallbackRef != NULL); + + /* sets user provided callback and callback reference */ + InstancePtr->ErrCallback = + (XDualSplitter_ErrCallback)CallbackFunc; + InstancePtr->ErrRef = CallbackRef; +} diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_selftest.c b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_selftest.c new file mode 100644 index 00000000..2e2b2a78 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_selftest.c @@ -0,0 +1,104 @@ +/****************************************************************************** +* +* Copyright (C) 2014 - 2015 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 +* XILINX 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 xdualsplitter_selftest.c +* +* This file contains self test function for the Dual Splitter core. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who Date     Changes
+* ----- --- -------- --------------------------------------------------
+* 1.00  sha 07/21/14 Initial release.
+* 
+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xdualsplitter.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function performs self test on DualSplitter core registers. +* +* @param InstancePtr is a pointer to the XDualSplitter core instance. +* +* @return +* - XST_SUCCESS if self test passed. +* - XST_FAILURE if self test failed. +* +* @note None. +* +******************************************************************************/ +s32 XDualSplitter_SelfTest(XDualSplitter *InstancePtr) +{ + s32 Status = XST_SUCCESS; + u16 Width; + u16 Height; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + /* set image size width x height */ + XDualSplitter_SetImageSize(InstancePtr, 2160, 1920); + + /* Retrieve image size width x height set previously */ + XDualSplitter_GetImageSize(InstancePtr, &Height, &Width); + + if ((Width != 1920) && (Height != 2160)) { + Status = XST_FAILURE; + } + + return Status; +} diff --git a/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_sinit.c b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_sinit.c new file mode 100644 index 00000000..5ee204e0 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/dual_splitter/src/xdualsplitter_sinit.c @@ -0,0 +1,111 @@ +/****************************************************************************** +* +* Copyright (C) 2014 - 2015 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 +* XILINX 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 xdualsplitter_sinit.c +* +* This file contains static initialization function for Xilinx Dual Splitter +* core. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who Date     Changes
+* ----- --- -------- --------------------------------------------------
+* 1.00  sha 07/21/14 Initial release.
+* 
+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xdualsplitter.h" +#include "xparameters.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function returns a reference to the XDualSplitter_Config structure +* based on the core id, DeviceId. The return value will refer to an +* entry in the device configuration table defined in the xdualsplitter_g.c +* file. +* +* @param DeviceId is the unique core ID of the Dual Splitter core for +* the lookup operation. +* +* @return XDualSplitter_LookupConfig returns a reference to a config +* record in the configuration table (in xdaulsplitter_g.c) +* corresponding to DeviceId, or NULL if no match is found. +* +* @note None. +* +******************************************************************************/ +XDualSplitter_Config *XDualSplitter_LookupConfig(u16 DeviceId) +{ + extern XDualSplitter_Config + XDualSplitter_ConfigTable[XPAR_XDUALSPLITTER_NUM_INSTANCES]; + XDualSplitter_Config *CfgPtr = NULL; + u32 Index; + + /* Checking for device id for which instance it is matching */ + for (Index = 0x0; Index < (u32)XPAR_XDUALSPLITTER_NUM_INSTANCES; + Index++) { + + /* Assigning address of config table if both device ids + * are matched + */ + if (XDualSplitter_ConfigTable[Index].DeviceId == DeviceId) { + CfgPtr = &XDualSplitter_ConfigTable[Index]; + break; + } + } + + return (XDualSplitter_Config *)CfgPtr; +}