v_letterbox: 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 <rohit.consul@xilinx.com>
This commit is contained in:
Rohit Consul 2015-06-04 05:49:47 +08:00 committed by Nava kishore Manne
parent 965a8ffb21
commit 68e90be08d
5 changed files with 45 additions and 11 deletions

View file

@ -11,6 +11,7 @@ BEGIN driver v_letterbox
OPTION supported_peripherals = (v_letterbox_v1_0 );
OPTION driver_state = ACTIVE;
OPTION DEPENDS = (video_common_v1_1);
OPTION copyfiles = all;
OPTION name = v_letterbox;
OPTION version = 1.0;

View file

@ -10,14 +10,27 @@ 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"
xdefine_config_file $drv_handle "xv_letterbox_g.c" "XV_letterbox" \
"DEVICE_ID" \
"C_S_AXI_CTRL_BASEADDR"
"C_S_AXI_CTRL_BASEADDR" \
"SAMPLES_PER_CLOCK" \
"MAX_COLS" \
"MAX_ROWS" \
"MAX_DATA_WIDTH"
xdefine_canonical_xpars $drv_handle "xparameters.h" "XV_letterbox" \
"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"
}

View file

@ -7,6 +7,7 @@
/***************************** Include Files *********************************/
#include "xv_letterbox.h"
#include "string.h"
/************************** Function Implementation *************************/
#ifndef __linux__
@ -14,6 +15,11 @@ int XV_letterbox_CfgInitialize(XV_letterbox *InstancePtr, XV_letterbox_Config *C
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(ConfigPtr != NULL);
/* Setup the instance */
(void)memset((void *)InstancePtr, 0, sizeof(XV_letterbox));
(void)memcpy((void *)&(InstancePtr->Config), (const void *)ConfigPtr,
sizeof(XV_letterbox_Config));
InstancePtr->Ctrl_BaseAddress = ConfigPtr->Ctrl_BaseAddress;
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;

View file

@ -38,15 +38,27 @@ typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
#else
/**
* This typedef contains configuration information for the letterbox 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 */
} XV_letterbox_Config;
#endif
/**
* Driver instance data. An instance must be allocated for each core in use.
*/
typedef struct {
u32 Ctrl_BaseAddress;
u32 IsReady;
XV_letterbox_Config Config; /**< Hardware Configuration */
u32 Ctrl_BaseAddress; /**< The base address of the core instance. */
u32 IsReady; /**< Device is initialized and ready */
} XV_letterbox;
/***************** Macros (Inline Functions) Definitions *********************/

View file

@ -169,6 +169,8 @@ void XV_LboxSetBackgroundColor(XV_letterbox *InstancePtr,
* Assert validates the input arguments
*/
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid((bpc >= XVIDC_BPC_8) &&
(bpc <= InstancePtr->Config.MaxDataWidth))
if(cfmt == XVIDC_CSF_RGB)
{
@ -179,10 +181,10 @@ void XV_LboxSetBackgroundColor(XV_letterbox *InstancePtr,
}
else //YUV
{
scale = (((bpc>=8) && (bpc<=16)) ? (bpc-8) : 8);
y_r_val = bkgndColorYUV[ColorId][0]<<scale;
Cb_g_val = bkgndColorYUV[ColorId][1]<<scale;
Cr_b_val = bkgndColorYUV[ColorId][2]<<scale;
scale = (1<<(bpc-XVIDC_BPC_8));
y_r_val = bkgndColorYUV[ColorId][0] * scale;
Cb_g_val = bkgndColorYUV[ColorId][1] * scale;
Cr_b_val = bkgndColorYUV[ColorId][2] * scale;
}
//Set Background (outside window) to be Black