From 10caed69b124c7229ca7cfd88b87bdeae1f128a3 Mon Sep 17 00:00:00 2001 From: Rohit Consul Date: Thu, 4 Jun 2015 05:49:45 +0800 Subject: [PATCH] v_hcresampler: Update tcl to include model parameters Updated the tcl and mdd files to define model parameters. Updated the code to use new parameters instead of hard-coded values defined earlier Signed-off-by: Rohit Consul --- .../v_hcresampler/data/v_hcresampler.mdd | 1 + .../v_hcresampler/data/v_hcresampler.tcl | 25 ++++++++++++++++--- .../v_hcresampler/src/xv_hcresampler.c | 6 +++++ .../v_hcresampler/src/xv_hcresampler.h | 23 ++++++++++++++--- 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/v_hcresampler/data/v_hcresampler.mdd b/XilinxProcessorIPLib/drivers/v_hcresampler/data/v_hcresampler.mdd index e333e88b..ece02ea7 100644 --- a/XilinxProcessorIPLib/drivers/v_hcresampler/data/v_hcresampler.mdd +++ b/XilinxProcessorIPLib/drivers/v_hcresampler/data/v_hcresampler.mdd @@ -11,6 +11,7 @@ BEGIN driver v_hcresampler OPTION supported_peripherals = (v_hcresampler_v1_0 ); OPTION driver_state = ACTIVE; + OPTION DEPENDS = (video_common_v1_1); OPTION copyfiles = all; OPTION name = v_hcresampler; OPTION version = 1.0; diff --git a/XilinxProcessorIPLib/drivers/v_hcresampler/data/v_hcresampler.tcl b/XilinxProcessorIPLib/drivers/v_hcresampler/data/v_hcresampler.tcl index 856c361e..e8440c79 100644 --- a/XilinxProcessorIPLib/drivers/v_hcresampler/data/v_hcresampler.tcl +++ b/XilinxProcessorIPLib/drivers/v_hcresampler/data/v_hcresampler.tcl @@ -10,14 +10,33 @@ proc generate {drv_handle} { "NUM_INSTANCES" \ "DEVICE_ID" \ "C_S_AXI_CTRL_BASEADDR" \ - "C_S_AXI_CTRL_HIGHADDR" + "C_S_AXI_CTRL_HIGHADDR" \ + "SAMPLES_PER_CLOCK" \ + "MAX_COLS" \ + "MAX_ROWS" \ + "MAX_DATA_WIDTH" \ + "CONVERT_TYPE" \ + "NUM_H_TAPS" xdefine_config_file $drv_handle "xv_hcresampler_g.c" "XV_hcresampler" \ "DEVICE_ID" \ - "C_S_AXI_CTRL_BASEADDR" + "C_S_AXI_CTRL_BASEADDR" \ + "SAMPLES_PER_CLOCK" \ + "MAX_COLS" \ + "MAX_ROWS" \ + "MAX_DATA_WIDTH" \ + "CONVERT_TYPE" \ + "NUM_H_TAPS" xdefine_canonical_xpars $drv_handle "xparameters.h" "XV_hcresampler" \ "DEVICE_ID" \ "C_S_AXI_CTRL_BASEADDR" \ - "C_S_AXI_CTRL_HIGHADDR" + "C_S_AXI_CTRL_HIGHADDR" \ + "SAMPLES_PER_CLOCK" \ + "MAX_COLS" \ + "MAX_ROWS" \ + "MAX_DATA_WIDTH" \ + "CONVERT_TYPE" \ + "NUM_H_TAPS" } + diff --git a/XilinxProcessorIPLib/drivers/v_hcresampler/src/xv_hcresampler.c b/XilinxProcessorIPLib/drivers/v_hcresampler/src/xv_hcresampler.c index 21860236..5d29cf70 100644 --- a/XilinxProcessorIPLib/drivers/v_hcresampler/src/xv_hcresampler.c +++ b/XilinxProcessorIPLib/drivers/v_hcresampler/src/xv_hcresampler.c @@ -7,6 +7,7 @@ /***************************** Include Files *********************************/ #include "xv_hcresampler.h" +#include "string.h" /************************** Function Implementation *************************/ #ifndef __linux__ @@ -14,6 +15,11 @@ int XV_hcresampler_CfgInitialize(XV_hcresampler *InstancePtr, XV_hcresampler_Con Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(ConfigPtr != NULL); + /* Setup the instance */ + (void)memset((void *)InstancePtr, 0, sizeof(XV_hcresampler)); + (void)memcpy((void *)&(InstancePtr->Config), (const void *)ConfigPtr, + sizeof(XV_hcresampler_Config)); + InstancePtr->Ctrl_BaseAddress = ConfigPtr->Ctrl_BaseAddress; InstancePtr->IsReady = XIL_COMPONENT_IS_READY; diff --git a/XilinxProcessorIPLib/drivers/v_hcresampler/src/xv_hcresampler.h b/XilinxProcessorIPLib/drivers/v_hcresampler/src/xv_hcresampler.h index 4ef06481..c94a028e 100644 --- a/XilinxProcessorIPLib/drivers/v_hcresampler/src/xv_hcresampler.h +++ b/XilinxProcessorIPLib/drivers/v_hcresampler/src/xv_hcresampler.h @@ -38,15 +38,30 @@ typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; #else +/** +* This typedef contains configuration information for the horziontal +* chroma resampler core. Each core instance should have a configuration +* structure associated. +*/ typedef struct { - u16 DeviceId; - u32 Ctrl_BaseAddress; + u16 DeviceId; /**< Unique ID of device */ + u32 Ctrl_BaseAddress; /**< The base address of the core instance. */ + int PixPerClk; /**< Samples Per Clock supported by core instance */ + u16 MaxWidth; /**< Maximum columns supported by core instance */ + u16 MaxHeight; /**< Maximum rows supported by core instance */ + int MaxDataWidth; /**< Maximum Data width of each channel */ + int ResamplingType; /**< Resampling Method selected */ + u8 NumTaps; /**< Number of filter taps */ } XV_hcresampler_Config; #endif +/** +* Driver instance data. An instance must be allocated for each core in use. +*/ typedef struct { - u32 Ctrl_BaseAddress; - u32 IsReady; + XV_hcresampler_Config Config; /**< Hardware Configuration */ + u32 Ctrl_BaseAddress; /**< The base address of the core instance. */ + u32 IsReady; /**< Device is initialized and ready */ } XV_hcresampler; /***************** Macros (Inline Functions) Definitions *********************/