v_hcresampler: Updated driver to align with hip flow

This patch supports HIP based video processing subsystem by reorganizing
the HLS generated code to align with xilinx driver guidelines.

Signed-off-by: Rohit Consul <rohit.consul@xilinx.com>
Reviewed-by: Andrei Simion <andreis@xilinx.com>
This commit is contained in:
Rohit Consul 2015-07-16 17:04:57 -07:00 committed by Nava kishore Manne
parent 7ec3345094
commit aae710bf98
9 changed files with 200 additions and 101 deletions

View file

View file

@ -1,9 +1,33 @@
# ==============================================================
# File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
# Version: 2015.1
# Copyright (C) 2015 Xilinx Inc. All rights reserved.
##############################################################################
#
# ==============================================================
# Copyright (C) 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} {
xdefine_include_file $drv_handle "xparameters.h" "XV_hcresampler" \
@ -11,32 +35,32 @@ proc generate {drv_handle} {
"DEVICE_ID" \
"C_S_AXI_CTRL_BASEADDR" \
"C_S_AXI_CTRL_HIGHADDR" \
"SAMPLES_PER_CLOCK" \
"MAX_COLS" \
"MAX_ROWS" \
"MAX_DATA_WIDTH" \
"CONVERT_TYPE" \
"NUM_H_TAPS"
"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" \
"SAMPLES_PER_CLOCK" \
"MAX_COLS" \
"MAX_ROWS" \
"MAX_DATA_WIDTH" \
"CONVERT_TYPE" \
"NUM_H_TAPS"
"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" \
"SAMPLES_PER_CLOCK" \
"MAX_COLS" \
"MAX_ROWS" \
"MAX_DATA_WIDTH" \
"CONVERT_TYPE" \
"NUM_H_TAPS"
"SAMPLES_PER_CLOCK" \
"MAX_COLS" \
"MAX_ROWS" \
"MAX_DATA_WIDTH" \
"CONVERT_TYPE" \
"NUM_H_TAPS"
}

View file

@ -11,16 +11,21 @@
/************************** Function Implementation *************************/
#ifndef __linux__
int XV_hcresampler_CfgInitialize(XV_hcresampler *InstancePtr, XV_hcresampler_Config *ConfigPtr) {
int XV_hcresampler_CfgInitialize(XV_hcresampler *InstancePtr,
XV_hcresampler_Config *ConfigPtr,
u32 EffectiveAddr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(ConfigPtr != NULL);
Xil_AssertNonvoid(EffectiveAddr != (u32)0x0);
/* Setup the instance */
(void)memset((void *)InstancePtr, 0, sizeof(XV_hcresampler));
(void)memcpy((void *)&(InstancePtr->Config), (const void *)ConfigPtr,
sizeof(XV_hcresampler_Config));
/* 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->Config.BaseAddress = EffectiveAddr;
/* Set the flag to indicate the driver is ready */
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
return XST_SUCCESS;
@ -33,8 +38,8 @@ void XV_hcresampler_Start(XV_hcresampler *InstancePtr) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL) & 0x80;
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL, Data | 0x01);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL) & 0x80;
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL, Data | 0x01);
}
u32 XV_hcresampler_IsDone(XV_hcresampler *InstancePtr) {
@ -43,7 +48,7 @@ u32 XV_hcresampler_IsDone(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL);
return (Data >> 1) & 0x1;
}
@ -53,7 +58,7 @@ u32 XV_hcresampler_IsIdle(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL);
return (Data >> 2) & 0x1;
}
@ -63,7 +68,7 @@ u32 XV_hcresampler_IsReady(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL);
// check ap_start to see if the pcore is ready for next input
return !(Data & 0x1);
}
@ -72,21 +77,21 @@ void XV_hcresampler_EnableAutoRestart(XV_hcresampler *InstancePtr) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL, 0x80);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL, 0x80);
}
void XV_hcresampler_DisableAutoRestart(XV_hcresampler *InstancePtr) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL, 0);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL, 0);
}
void XV_hcresampler_Set_HwReg_width(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_WIDTH_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_WIDTH_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_width(XV_hcresampler *InstancePtr) {
@ -95,7 +100,7 @@ u32 XV_hcresampler_Get_HwReg_width(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_WIDTH_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_WIDTH_DATA);
return Data;
}
@ -103,7 +108,7 @@ void XV_hcresampler_Set_HwReg_height(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_HEIGHT_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_HEIGHT_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_height(XV_hcresampler *InstancePtr) {
@ -112,7 +117,7 @@ u32 XV_hcresampler_Get_HwReg_height(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_HEIGHT_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_HEIGHT_DATA);
return Data;
}
@ -120,7 +125,7 @@ void XV_hcresampler_Set_HwReg_input_video_format(XV_hcresampler *InstancePtr, u3
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_INPUT_VIDEO_FORMAT_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_INPUT_VIDEO_FORMAT_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_input_video_format(XV_hcresampler *InstancePtr) {
@ -129,7 +134,7 @@ u32 XV_hcresampler_Get_HwReg_input_video_format(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_INPUT_VIDEO_FORMAT_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_INPUT_VIDEO_FORMAT_DATA);
return Data;
}
@ -137,7 +142,7 @@ void XV_hcresampler_Set_HwReg_output_video_format(XV_hcresampler *InstancePtr, u
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_OUTPUT_VIDEO_FORMAT_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_OUTPUT_VIDEO_FORMAT_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_output_video_format(XV_hcresampler *InstancePtr) {
@ -146,7 +151,7 @@ u32 XV_hcresampler_Get_HwReg_output_video_format(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_OUTPUT_VIDEO_FORMAT_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_OUTPUT_VIDEO_FORMAT_DATA);
return Data;
}
@ -154,7 +159,7 @@ void XV_hcresampler_Set_HwReg_coefs_0_0(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_0_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_0_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_coefs_0_0(XV_hcresampler *InstancePtr) {
@ -163,7 +168,7 @@ u32 XV_hcresampler_Get_HwReg_coefs_0_0(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_0_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_0_DATA);
return Data;
}
@ -171,7 +176,7 @@ void XV_hcresampler_Set_HwReg_coefs_0_1(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_1_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_1_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_coefs_0_1(XV_hcresampler *InstancePtr) {
@ -180,7 +185,7 @@ u32 XV_hcresampler_Get_HwReg_coefs_0_1(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_1_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_1_DATA);
return Data;
}
@ -188,7 +193,7 @@ void XV_hcresampler_Set_HwReg_coefs_0_2(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_2_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_2_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_coefs_0_2(XV_hcresampler *InstancePtr) {
@ -197,7 +202,7 @@ u32 XV_hcresampler_Get_HwReg_coefs_0_2(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_2_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_2_DATA);
return Data;
}
@ -205,7 +210,7 @@ void XV_hcresampler_Set_HwReg_coefs_0_3(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_3_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_3_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_coefs_0_3(XV_hcresampler *InstancePtr) {
@ -214,7 +219,7 @@ u32 XV_hcresampler_Get_HwReg_coefs_0_3(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_3_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_3_DATA);
return Data;
}
@ -222,7 +227,7 @@ void XV_hcresampler_Set_HwReg_coefs_1_0(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_0_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_0_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_coefs_1_0(XV_hcresampler *InstancePtr) {
@ -231,7 +236,7 @@ u32 XV_hcresampler_Get_HwReg_coefs_1_0(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_0_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_0_DATA);
return Data;
}
@ -239,7 +244,7 @@ void XV_hcresampler_Set_HwReg_coefs_1_1(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_1_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_1_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_coefs_1_1(XV_hcresampler *InstancePtr) {
@ -248,7 +253,7 @@ u32 XV_hcresampler_Get_HwReg_coefs_1_1(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_1_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_1_DATA);
return Data;
}
@ -256,7 +261,7 @@ void XV_hcresampler_Set_HwReg_coefs_1_2(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_2_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_2_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_coefs_1_2(XV_hcresampler *InstancePtr) {
@ -265,7 +270,7 @@ u32 XV_hcresampler_Get_HwReg_coefs_1_2(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_2_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_2_DATA);
return Data;
}
@ -273,7 +278,7 @@ void XV_hcresampler_Set_HwReg_coefs_1_3(XV_hcresampler *InstancePtr, u32 Data) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_3_DATA, Data);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_3_DATA, Data);
}
u32 XV_hcresampler_Get_HwReg_coefs_1_3(XV_hcresampler *InstancePtr) {
@ -282,7 +287,7 @@ u32 XV_hcresampler_Get_HwReg_coefs_1_3(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Data = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_3_DATA);
Data = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_3_DATA);
return Data;
}
@ -290,14 +295,14 @@ void XV_hcresampler_InterruptGlobalEnable(XV_hcresampler *InstancePtr) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_GIE, 1);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_GIE, 1);
}
void XV_hcresampler_InterruptGlobalDisable(XV_hcresampler *InstancePtr) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_GIE, 0);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_GIE, 0);
}
void XV_hcresampler_InterruptEnable(XV_hcresampler *InstancePtr, u32 Mask) {
@ -306,8 +311,8 @@ void XV_hcresampler_InterruptEnable(XV_hcresampler *InstancePtr, u32 Mask) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Register = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER, Register | Mask);
Register = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER, Register | Mask);
}
void XV_hcresampler_InterruptDisable(XV_hcresampler *InstancePtr, u32 Mask) {
@ -316,27 +321,27 @@ void XV_hcresampler_InterruptDisable(XV_hcresampler *InstancePtr, u32 Mask) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Register = XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER, Register & (~Mask));
Register = XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER, Register & (~Mask));
}
void XV_hcresampler_InterruptClear(XV_hcresampler *InstancePtr, u32 Mask) {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XV_hcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_ISR, Mask);
XV_hcresampler_WriteReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_ISR, Mask);
}
u32 XV_hcresampler_InterruptGetEnabled(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
return XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER);
return XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_IER);
}
u32 XV_hcresampler_InterruptGetStatus(XV_hcresampler *InstancePtr) {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
return XV_hcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_ISR);
return XV_hcresampler_ReadReg(InstancePtr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_ISR);
}

View file

@ -45,7 +45,7 @@ typedef uint32_t u32;
*/
typedef struct {
u16 DeviceId; /**< Unique ID of device */
u32 Ctrl_BaseAddress; /**< The base address of the core instance. */
u32 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 */
@ -60,7 +60,6 @@ typedef struct {
*/
typedef struct {
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;
@ -89,7 +88,9 @@ typedef struct {
#ifndef __linux__
int XV_hcresampler_Initialize(XV_hcresampler *InstancePtr, u16 DeviceId);
XV_hcresampler_Config* XV_hcresampler_LookupConfig(u16 DeviceId);
int XV_hcresampler_CfgInitialize(XV_hcresampler *InstancePtr, XV_hcresampler_Config *ConfigPtr);
int XV_hcresampler_CfgInitialize(XV_hcresampler *InstancePtr,
XV_hcresampler_Config *ConfigPtr,
u32 EffectiveAddr);
#else
int XV_hcresampler_Initialize(XV_hcresampler *InstancePtr, const char* InstanceName);
int XV_hcresampler_Release(XV_hcresampler *InstancePtr);

View file

@ -0,0 +1,61 @@
/*******************************************************************
*
* 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 "xv_hcresampler.h"
/*
* The configuration table for devices
*/
XV_hcresampler_Config XV_hcresampler_ConfigTable[] =
{
{
#ifdef XPAR_XV_HCRESAMPLER_NUM_INSTANCES
XPAR_V_PROC_SS_0_V_HCRESAMPLER_DEVICE_ID,
XPAR_V_PROC_SS_0_V_HCRESAMPLER_S_AXI_CTRL_BASEADDR,
XPAR_V_PROC_SS_0_V_HCRESAMPLER_SAMPLES_PER_CLOCK,
XPAR_V_PROC_SS_0_V_HCRESAMPLER_MAX_COLS,
XPAR_V_PROC_SS_0_V_HCRESAMPLER_MAX_ROWS,
XPAR_V_PROC_SS_0_V_HCRESAMPLER_MAX_DATA_WIDTH,
XPAR_V_PROC_SS_0_V_HCRESAMPLER_CONVERT_TYPE,
XPAR_V_PROC_SS_0_V_HCRESAMPLER_NUM_H_TAPS
#endif
}
};

View file

@ -35,6 +35,7 @@
* @file xv_hcresampler_l2.c
* @addtogroup v_hcresampler_v1_0
* @{
* @details
*
* The Horizontal Chroma Resampler Layer-2 Driver.
* The functions in this file provides an abstraction from the register peek/poke
@ -46,7 +47,7 @@
*
* Ver Who Date Changes
* ----- ---- -------- -------------------------------------------------------
* 1.00 rc 05/01/15 Initial Release
* 1.00 rco 07/21/15 Initial Release
* </pre>
*
@ -221,7 +222,7 @@ void XV_HCrsmplDbgReportStatus(XV_hcresampler *InstancePtr)
done = XV_hcresampler_IsDone(pHCrsmplr);
idle = XV_hcresampler_IsIdle(pHCrsmplr);
ready = XV_hcresampler_IsReady(pHCrsmplr);
ctrl = XV_hcresampler_ReadReg(pHCrsmplr->Ctrl_BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL);
ctrl = XV_hcresampler_ReadReg(pHCrsmplr->Config.BaseAddress, XV_HCRESAMPLER_CTRL_ADDR_AP_CTRL);
vidfmtIn = XV_hcresampler_Get_HwReg_input_video_format(pHCrsmplr);
vidfmtOut = XV_hcresampler_Get_HwReg_output_video_format(pHCrsmplr);

View file

@ -35,6 +35,7 @@
* @file xv_hcresampler_l2.h
* @addtogroup v_hcresampler_v1_0
* @{
* @details
*
* This header file contains layer 2 API's of the horizontal chroma resampler
* sub-core driver.The functions contained herein provides a high level
@ -89,7 +90,7 @@
*
* Ver Who Date Changes
* ----- ---- -------- -------------------------------------------------------
* 1.00 rc 05/01/15 Initial Release
* 1.00 rco 07/21/15 Initial Release
* </pre>
*

View file

@ -87,8 +87,8 @@ static int uio_info_read_map_size(XV_hcresampler_uio_info* info, int n) {
}
int XV_hcresampler_Initialize(XV_hcresampler *InstancePtr, const char* InstanceName) {
XV_hcresampler_uio_info *InfoPtr = &uio_info;
struct dirent **namelist;
XV_hcresampler_uio_info *InfoPtr = &uio_info;
struct dirent **namelist;
int i, n;
char* s;
char file[ MAX_UIO_PATH_SIZE ];
@ -100,9 +100,9 @@ int XV_hcresampler_Initialize(XV_hcresampler *InstancePtr, const char* InstanceN
n = scandir("/sys/class/uio", &namelist, 0, alphasort);
if (n < 0) return XST_DEVICE_NOT_FOUND;
for (i = 0; i < n; i++) {
strcpy(file, "/sys/class/uio/");
strcat(file, namelist[i]->d_name);
strcat(file, "/name");
strcpy(file, "/sys/class/uio/");
strcat(file, namelist[i]->d_name);
strcat(file, "/name");
if ((line_from_file(file, name) == 0) && (strcmp(name, InstanceName) == 0)) {
flag = 1;
s = namelist[i]->d_name;
@ -126,8 +126,8 @@ int XV_hcresampler_Initialize(XV_hcresampler *InstancePtr, const char* InstanceN
}
// NOTE: slave interface 'Ctrl' should be mapped to uioX/map0
InstancePtr->Ctrl_BaseAddress = (u32)mmap(NULL, InfoPtr->maps[0].size, PROT_READ|PROT_WRITE, MAP_SHARED, InfoPtr->uio_fd, 0 * getpagesize());
assert(InstancePtr->Ctrl_BaseAddress);
InstancePtr->Config.BaseAddress = (u32)mmap(NULL, InfoPtr->maps[0].size, PROT_READ|PROT_WRITE, MAP_SHARED, InfoPtr->uio_fd, 0 * getpagesize());
assert(InstancePtr->Config.BaseAddress);
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
@ -135,12 +135,12 @@ int XV_hcresampler_Initialize(XV_hcresampler *InstancePtr, const char* InstanceN
}
int XV_hcresampler_Release(XV_hcresampler *InstancePtr) {
XV_hcresampler_uio_info *InfoPtr = &uio_info;
XV_hcresampler_uio_info *InfoPtr = &uio_info;
assert(InstancePtr != NULL);
assert(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
munmap((void*)InstancePtr->Ctrl_BaseAddress, InfoPtr->maps[0].size);
munmap((void*)InstancePtr->Config.BaseAddress, InfoPtr->maps[0].size);
close(InfoPtr->uio_fd);

View file

@ -11,35 +11,41 @@
#include "xparameters.h"
#include "xv_hcresampler.h"
#ifndef XPAR_XV_HCRESAMPLER_NUM_INSTANCES
#define XPAR_XV_HCRESAMPLER_NUM_INSTANCES 0
#endif
extern XV_hcresampler_Config XV_hcresampler_ConfigTable[];
XV_hcresampler_Config *XV_hcresampler_LookupConfig(u16 DeviceId) {
XV_hcresampler_Config *ConfigPtr = NULL;
XV_hcresampler_Config *ConfigPtr = NULL;
int Index;
int Index;
for (Index = 0; Index < XPAR_XV_HCRESAMPLER_NUM_INSTANCES; Index++) {
if (XV_hcresampler_ConfigTable[Index].DeviceId == DeviceId) {
ConfigPtr = &XV_hcresampler_ConfigTable[Index];
break;
}
}
for (Index = 0; Index < XPAR_XV_HCRESAMPLER_NUM_INSTANCES; Index++) {
if (XV_hcresampler_ConfigTable[Index].DeviceId == DeviceId) {
ConfigPtr = &XV_hcresampler_ConfigTable[Index];
break;
}
}
return ConfigPtr;
return ConfigPtr;
}
int XV_hcresampler_Initialize(XV_hcresampler *InstancePtr, u16 DeviceId) {
XV_hcresampler_Config *ConfigPtr;
XV_hcresampler_Config *ConfigPtr;
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr != NULL);
ConfigPtr = XV_hcresampler_LookupConfig(DeviceId);
if (ConfigPtr == NULL) {
InstancePtr->IsReady = 0;
return (XST_DEVICE_NOT_FOUND);
}
ConfigPtr = XV_hcresampler_LookupConfig(DeviceId);
if (ConfigPtr == NULL) {
InstancePtr->IsReady = 0;
return (XST_DEVICE_NOT_FOUND);
}
return XV_hcresampler_CfgInitialize(InstancePtr, ConfigPtr);
return XV_hcresampler_CfgInitialize(InstancePtr,
ConfigPtr,
ConfigPtr->BaseAddress);
}
#endif