v_vcresampler: Added new driver
HLS generated driver along with manually written layer 2. Driver tcl update is pending Signed-off-by: Rohit Consul <rohit.consul@xilinx.com>
This commit is contained in:
parent
f37b5011ea
commit
531499fd65
10 changed files with 1219 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
# ==============================================================
|
||||
# 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.
|
||||
#
|
||||
# ==============================================================
|
||||
|
||||
OPTION psf_version = 2.1;
|
||||
|
||||
BEGIN driver v_vcresampler
|
||||
|
||||
OPTION supported_peripherals = (v_vcresampler_v1_0 );
|
||||
OPTION driver_state = ACTIVE;
|
||||
OPTION copyfiles = all;
|
||||
OPTION name = v_vcresampler;
|
||||
OPTION version = 1.0;
|
||||
|
||||
END driver
|
|
@ -0,0 +1,23 @@
|
|||
# ==============================================================
|
||||
# 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.
|
||||
#
|
||||
# ==============================================================
|
||||
|
||||
proc generate {drv_handle} {
|
||||
xdefine_include_file $drv_handle "xparameters.h" "XV_vcresampler" \
|
||||
"NUM_INSTANCES" \
|
||||
"DEVICE_ID" \
|
||||
"C_S_AXI_CTRL_BASEADDR" \
|
||||
"C_S_AXI_CTRL_HIGHADDR"
|
||||
|
||||
xdefine_config_file $drv_handle "xv_vcresampler_g.c" "XV_vcresampler" \
|
||||
"DEVICE_ID" \
|
||||
"C_S_AXI_CTRL_BASEADDR"
|
||||
|
||||
xdefine_canonical_xpars $drv_handle "xparameters.h" "XV_vcresampler" \
|
||||
"DEVICE_ID" \
|
||||
"C_S_AXI_CTRL_BASEADDR" \
|
||||
"C_S_AXI_CTRL_HIGHADDR"
|
||||
}
|
34
XilinxProcessorIPLib/drivers/v_vcresampler/src/Makefile
Normal file
34
XilinxProcessorIPLib/drivers/v_vcresampler/src/Makefile
Normal file
|
@ -0,0 +1,34 @@
|
|||
# ==============================================================
|
||||
# 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.
|
||||
#
|
||||
# ==============================================================
|
||||
|
||||
COMPILER=
|
||||
ARCHIVER=
|
||||
CP=cp
|
||||
COMPILER_FLAGS=
|
||||
EXTRA_COMPILER_FLAGS=
|
||||
LIB=libxil.a
|
||||
|
||||
RELEASEDIR=../../../lib
|
||||
INCLUDEDIR=../../../include
|
||||
INCLUDES=-I./. -I${INCLUDEDIR}
|
||||
|
||||
INCLUDEFILES=*.h
|
||||
LIBSOURCES=*.c
|
||||
OUTS = *.o
|
||||
|
||||
|
||||
libs:
|
||||
echo "Compiling v_vcresampler"
|
||||
$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $(LIBSOURCES)
|
||||
$(ARCHIVER) -r ${RELEASEDIR}/${LIB} $(OUTS)
|
||||
make clean
|
||||
|
||||
include:
|
||||
${CP} $(INCLUDEFILES) $(INCLUDEDIR)
|
||||
|
||||
clean:
|
||||
rm -rf ${OUTS}
|
336
XilinxProcessorIPLib/drivers/v_vcresampler/src/xv_vcresampler.c
Normal file
336
XilinxProcessorIPLib/drivers/v_vcresampler/src/xv_vcresampler.c
Normal file
|
@ -0,0 +1,336 @@
|
|||
// ==============================================================
|
||||
// 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.
|
||||
//
|
||||
// ==============================================================
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#include "xv_vcresampler.h"
|
||||
|
||||
/************************** Function Implementation *************************/
|
||||
#ifndef __linux__
|
||||
int XV_vcresampler_CfgInitialize(XV_vcresampler *InstancePtr, XV_vcresampler_Config *ConfigPtr) {
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(ConfigPtr != NULL);
|
||||
|
||||
InstancePtr->Ctrl_BaseAddress = ConfigPtr->Ctrl_BaseAddress;
|
||||
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
void XV_vcresampler_Start(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL) & 0x80;
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL, Data | 0x01);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_IsDone(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL);
|
||||
return (Data >> 1) & 0x1;
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_IsIdle(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL);
|
||||
return (Data >> 2) & 0x1;
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_IsReady(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL);
|
||||
// check ap_start to see if the pcore is ready for next input
|
||||
return !(Data & 0x1);
|
||||
}
|
||||
|
||||
void XV_vcresampler_EnableAutoRestart(XV_vcresampler *InstancePtr) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL, 0x80);
|
||||
}
|
||||
|
||||
void XV_vcresampler_DisableAutoRestart(XV_vcresampler *InstancePtr) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL, 0);
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_width(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_WIDTH_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_width(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_WIDTH_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_height(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_HEIGHT_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_height(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_HEIGHT_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_input_video_format(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_INPUT_VIDEO_FORMAT_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_input_video_format(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_INPUT_VIDEO_FORMAT_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_output_video_format(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_OUTPUT_VIDEO_FORMAT_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_output_video_format(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_OUTPUT_VIDEO_FORMAT_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_coefs_0_0(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_0_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_0_0(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_0_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_coefs_0_1(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_1_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_0_1(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_1_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_coefs_0_2(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_2_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_0_2(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_2_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_coefs_0_3(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_3_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_0_3(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_3_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_coefs_1_0(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_0_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_1_0(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_0_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_coefs_1_1(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_1_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_1_1(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_1_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_coefs_1_2(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_2_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_1_2(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_2_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_Set_HwReg_coefs_1_3(XV_vcresampler *InstancePtr, u32 Data) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_3_DATA, Data);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_1_3(XV_vcresampler *InstancePtr) {
|
||||
u32 Data;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Data = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_3_DATA);
|
||||
return Data;
|
||||
}
|
||||
|
||||
void XV_vcresampler_InterruptGlobalEnable(XV_vcresampler *InstancePtr) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_GIE, 1);
|
||||
}
|
||||
|
||||
void XV_vcresampler_InterruptGlobalDisable(XV_vcresampler *InstancePtr) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_GIE, 0);
|
||||
}
|
||||
|
||||
void XV_vcresampler_InterruptEnable(XV_vcresampler *InstancePtr, u32 Mask) {
|
||||
u32 Register;
|
||||
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Register = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_IER);
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_IER, Register | Mask);
|
||||
}
|
||||
|
||||
void XV_vcresampler_InterruptDisable(XV_vcresampler *InstancePtr, u32 Mask) {
|
||||
u32 Register;
|
||||
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
Register = XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_IER);
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_IER, Register & (~Mask));
|
||||
}
|
||||
|
||||
void XV_vcresampler_InterruptClear(XV_vcresampler *InstancePtr, u32 Mask) {
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
XV_vcresampler_WriteReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_ISR, Mask);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_InterruptGetEnabled(XV_vcresampler *InstancePtr) {
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
return XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_IER);
|
||||
}
|
||||
|
||||
u32 XV_vcresampler_InterruptGetStatus(XV_vcresampler *InstancePtr) {
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
return XV_vcresampler_ReadReg(InstancePtr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_ISR);
|
||||
}
|
127
XilinxProcessorIPLib/drivers/v_vcresampler/src/xv_vcresampler.h
Normal file
127
XilinxProcessorIPLib/drivers/v_vcresampler/src/xv_vcresampler.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
// ==============================================================
|
||||
// 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.
|
||||
//
|
||||
// ==============================================================
|
||||
|
||||
#ifndef XV_VCRESAMPLER_H
|
||||
#define XV_VCRESAMPLER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#ifndef __linux__
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
#include "xil_io.h"
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#include "xv_vcresampler_hw.h"
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
#ifdef __linux__
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
#else
|
||||
typedef struct {
|
||||
u16 DeviceId;
|
||||
u32 Ctrl_BaseAddress;
|
||||
} XV_vcresampler_Config;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
u32 Ctrl_BaseAddress;
|
||||
u32 IsReady;
|
||||
} XV_vcresampler;
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
#ifndef __linux__
|
||||
#define XV_vcresampler_WriteReg(BaseAddress, RegOffset, Data) \
|
||||
Xil_Out32((BaseAddress) + (RegOffset), (u32)(Data))
|
||||
#define XV_vcresampler_ReadReg(BaseAddress, RegOffset) \
|
||||
Xil_In32((BaseAddress) + (RegOffset))
|
||||
#else
|
||||
#define XV_vcresampler_WriteReg(BaseAddress, RegOffset, Data) \
|
||||
*(volatile u32*)((BaseAddress) + (RegOffset)) = (u32)(Data)
|
||||
#define XV_vcresampler_ReadReg(BaseAddress, RegOffset) \
|
||||
*(volatile u32*)((BaseAddress) + (RegOffset))
|
||||
|
||||
#define Xil_AssertVoid(expr) assert(expr)
|
||||
#define Xil_AssertNonvoid(expr) assert(expr)
|
||||
|
||||
#define XST_SUCCESS 0
|
||||
#define XST_DEVICE_NOT_FOUND 2
|
||||
#define XST_OPEN_DEVICE_FAILED 3
|
||||
#define XIL_COMPONENT_IS_READY 1
|
||||
#endif
|
||||
|
||||
/************************** Function Prototypes *****************************/
|
||||
#ifndef __linux__
|
||||
int XV_vcresampler_Initialize(XV_vcresampler *InstancePtr, u16 DeviceId);
|
||||
XV_vcresampler_Config* XV_vcresampler_LookupConfig(u16 DeviceId);
|
||||
int XV_vcresampler_CfgInitialize(XV_vcresampler *InstancePtr, XV_vcresampler_Config *ConfigPtr);
|
||||
#else
|
||||
int XV_vcresampler_Initialize(XV_vcresampler *InstancePtr, const char* InstanceName);
|
||||
int XV_vcresampler_Release(XV_vcresampler *InstancePtr);
|
||||
#endif
|
||||
|
||||
void XV_vcresampler_Start(XV_vcresampler *InstancePtr);
|
||||
u32 XV_vcresampler_IsDone(XV_vcresampler *InstancePtr);
|
||||
u32 XV_vcresampler_IsIdle(XV_vcresampler *InstancePtr);
|
||||
u32 XV_vcresampler_IsReady(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_EnableAutoRestart(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_DisableAutoRestart(XV_vcresampler *InstancePtr);
|
||||
|
||||
void XV_vcresampler_Set_HwReg_width(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_width(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_height(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_height(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_input_video_format(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_input_video_format(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_output_video_format(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_output_video_format(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_coefs_0_0(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_0_0(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_coefs_0_1(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_0_1(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_coefs_0_2(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_0_2(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_coefs_0_3(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_0_3(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_coefs_1_0(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_1_0(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_coefs_1_1(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_1_1(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_coefs_1_2(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_1_2(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_Set_HwReg_coefs_1_3(XV_vcresampler *InstancePtr, u32 Data);
|
||||
u32 XV_vcresampler_Get_HwReg_coefs_1_3(XV_vcresampler *InstancePtr);
|
||||
|
||||
void XV_vcresampler_InterruptGlobalEnable(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_InterruptGlobalDisable(XV_vcresampler *InstancePtr);
|
||||
void XV_vcresampler_InterruptEnable(XV_vcresampler *InstancePtr, u32 Mask);
|
||||
void XV_vcresampler_InterruptDisable(XV_vcresampler *InstancePtr, u32 Mask);
|
||||
void XV_vcresampler_InterruptClear(XV_vcresampler *InstancePtr, u32 Mask);
|
||||
u32 XV_vcresampler_InterruptGetEnabled(XV_vcresampler *InstancePtr);
|
||||
u32 XV_vcresampler_InterruptGetStatus(XV_vcresampler *InstancePtr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,104 @@
|
|||
// ==============================================================
|
||||
// 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.
|
||||
//
|
||||
// ==============================================================
|
||||
|
||||
// CTRL
|
||||
// 0x00 : Control signals
|
||||
// bit 0 - ap_start (Read/Write/COH)
|
||||
// bit 1 - ap_done (Read/COR)
|
||||
// bit 2 - ap_idle (Read)
|
||||
// bit 3 - ap_ready (Read)
|
||||
// bit 7 - auto_restart (Read/Write)
|
||||
// others - reserved
|
||||
// 0x04 : Global Interrupt Enable Register
|
||||
// bit 0 - Global Interrupt Enable (Read/Write)
|
||||
// others - reserved
|
||||
// 0x08 : IP Interrupt Enable Register (Read/Write)
|
||||
// bit 0 - Channel 0 (ap_done)
|
||||
// bit 1 - Channel 1 (ap_ready)
|
||||
// others - reserved
|
||||
// 0x0c : IP Interrupt Status Register (Read/TOW)
|
||||
// bit 0 - Channel 0 (ap_done)
|
||||
// bit 1 - Channel 1 (ap_ready)
|
||||
// others - reserved
|
||||
// 0x10 : Data signal of HwReg_width
|
||||
// bit 15~0 - HwReg_width[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x14 : reserved
|
||||
// 0x18 : Data signal of HwReg_height
|
||||
// bit 15~0 - HwReg_height[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x1c : reserved
|
||||
// 0x20 : Data signal of HwReg_input_video_format
|
||||
// bit 15~0 - HwReg_input_video_format[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x24 : reserved
|
||||
// 0x28 : Data signal of HwReg_output_video_format
|
||||
// bit 15~0 - HwReg_output_video_format[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x2c : reserved
|
||||
// 0x30 : Data signal of HwReg_coefs_0_0
|
||||
// bit 15~0 - HwReg_coefs_0_0[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x34 : reserved
|
||||
// 0x38 : Data signal of HwReg_coefs_0_1
|
||||
// bit 15~0 - HwReg_coefs_0_1[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x3c : reserved
|
||||
// 0x40 : Data signal of HwReg_coefs_0_2
|
||||
// bit 15~0 - HwReg_coefs_0_2[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x44 : reserved
|
||||
// 0x48 : Data signal of HwReg_coefs_0_3
|
||||
// bit 15~0 - HwReg_coefs_0_3[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x4c : reserved
|
||||
// 0x50 : Data signal of HwReg_coefs_1_0
|
||||
// bit 15~0 - HwReg_coefs_1_0[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x54 : reserved
|
||||
// 0x58 : Data signal of HwReg_coefs_1_1
|
||||
// bit 15~0 - HwReg_coefs_1_1[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x5c : reserved
|
||||
// 0x60 : Data signal of HwReg_coefs_1_2
|
||||
// bit 15~0 - HwReg_coefs_1_2[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x64 : reserved
|
||||
// 0x68 : Data signal of HwReg_coefs_1_3
|
||||
// bit 15~0 - HwReg_coefs_1_3[15:0] (Read/Write)
|
||||
// others - reserved
|
||||
// 0x6c : reserved
|
||||
// (SC = Self Clear, COR = Clear on Read, TOW = Toggle on Write, COH = Clear on Handshake)
|
||||
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL 0x00
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_GIE 0x04
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_IER 0x08
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_ISR 0x0c
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_WIDTH_DATA 0x10
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_WIDTH_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_HEIGHT_DATA 0x18
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_HEIGHT_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_INPUT_VIDEO_FORMAT_DATA 0x20
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_INPUT_VIDEO_FORMAT_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_OUTPUT_VIDEO_FORMAT_DATA 0x28
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_OUTPUT_VIDEO_FORMAT_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_0_DATA 0x30
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_COEFS_0_0_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_1_DATA 0x38
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_COEFS_0_1_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_2_DATA 0x40
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_COEFS_0_2_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_0_3_DATA 0x48
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_COEFS_0_3_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_0_DATA 0x50
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_COEFS_1_0_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_1_DATA 0x58
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_COEFS_1_1_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_2_DATA 0x60
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_COEFS_1_2_DATA 16
|
||||
#define XV_VCRESAMPLER_CTRL_ADDR_HWREG_COEFS_1_3_DATA 0x68
|
||||
#define XV_VCRESAMPLER_CTRL_BITS_HWREG_COEFS_1_3_DATA 16
|
|
@ -0,0 +1,256 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xv_vcresampler_l2.c
|
||||
*
|
||||
* The Vertical Chroma Resampler Layer-2 Driver.
|
||||
* The functions in this file provides an abstraction from the register peek/poke
|
||||
* methodology by implementing most common use-case provided by the sub-core.
|
||||
* See xv_vvcresampler_l2.h for a detailed description of the layer-2 driver
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00 rc 05/01/15 Initial Release
|
||||
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#include "xv_vcresampler_l2.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/**************************** Local Global *******************************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
static void vcrUpdateCoefficients(XV_vcresampler *pVCrsmplr, u32 coeff[2][4]);
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function starts the Chroma resampler core
|
||||
*
|
||||
* @param InstancePtr is a pointer to the core instance to be worked on.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
*****************************************************************************/
|
||||
void XV_VCrsmplStart(XV_vcresampler *InstancePtr)
|
||||
{
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
|
||||
XV_vcresampler_EnableAutoRestart(InstancePtr);
|
||||
XV_vcresampler_Start(InstancePtr);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function stops the Chroma resampler core
|
||||
*
|
||||
* @param InstancePtr is a pointer to the core instance to be worked on.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
*****************************************************************************/
|
||||
void XV_VCrsmplStop(XV_vcresampler *InstancePtr)
|
||||
{
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
|
||||
XV_vcresampler_DisableAutoRestart(InstancePtr);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function configures the Chroma resampler active resolution
|
||||
*
|
||||
* @param InstancePtr is a pointer to the core instance to be worked on.
|
||||
* @param width is the active frame width
|
||||
* @param height is the active frame height
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
******************************************************************************/
|
||||
void XV_VCrsmplSetActiveSize(XV_vcresampler *InstancePtr,
|
||||
u32 width,
|
||||
u32 height)
|
||||
{
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
|
||||
XV_vcresampler_Set_HwReg_width(InstancePtr, width);
|
||||
XV_vcresampler_Set_HwReg_height(InstancePtr, height);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function configures the Chroma resampler for the required format
|
||||
* conversion
|
||||
*
|
||||
* @param InstancePtr is a pointer to the core instance to be worked on.
|
||||
* @param formatIn is the input chroma format
|
||||
* @param formatOut is required chroma format
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
******************************************************************************/
|
||||
void XV_VCrsmplSetFormat(XV_vcresampler *InstancePtr,
|
||||
XVidC_ColorFormat formatIn,
|
||||
XVidC_ColorFormat formatOut)
|
||||
{
|
||||
u32 fmtIn, fmtOut;
|
||||
u32 K[2][4] = {{0}};
|
||||
|
||||
/*
|
||||
* Assert validates the input arguments
|
||||
*/
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
|
||||
/* Temp: Resampler IP YUV420 has 2 modes with distinct indexes. The difference is
|
||||
* in how the data is packed into the AXIS stream. HDMI IP packing is different
|
||||
* than standard AXIS definition. Ideally HDMI should convert and repack it in the
|
||||
* standard format, but until update is available the sub-cores that work with
|
||||
* YUV420 will have 2 modes to support
|
||||
* - YUV420_AXIS = 3
|
||||
* - YUV420_HDMI = 4
|
||||
*
|
||||
* Video Common driver has only YUV420_AXIS mode defined at index 3
|
||||
* VPRD beta release, is tightly coupled with HDMI IP, hence fow now the 420 mode
|
||||
* is mapped to YUV420_HDMI (4)
|
||||
*/
|
||||
|
||||
fmtIn = ((formatIn == XVIDC_CSF_YCRCB_420) ? (XVIDC_CSF_YCRCB_420+1) : formatIn);
|
||||
fmtOut = ((formatOut == XVIDC_CSF_YCRCB_420) ? (XVIDC_CSF_YCRCB_420+1) : formatOut);
|
||||
|
||||
XV_vcresampler_Set_HwReg_input_video_format(InstancePtr, fmtIn);
|
||||
XV_vcresampler_Set_HwReg_output_video_format(InstancePtr, fmtOut);
|
||||
|
||||
if((formatIn == XVIDC_CSF_YCRCB_420) &&
|
||||
(formatOut == XVIDC_CSF_YCRCB_422))
|
||||
{
|
||||
K[0][0] = 0;
|
||||
K[0][1] = 4096;
|
||||
K[0][2] = 0;
|
||||
K[0][3] = 0;
|
||||
K[1][0] = 506;
|
||||
K[1][1] = 1542;
|
||||
K[1][2] = 1542;
|
||||
K[1][3] = 506;
|
||||
}
|
||||
else if((formatIn == XVIDC_CSF_YCRCB_422) &&
|
||||
(formatOut == XVIDC_CSF_YCRCB_420))
|
||||
|
||||
{
|
||||
K[0][0] = 0;
|
||||
K[0][1] = 1024;
|
||||
K[0][2] = 2048;
|
||||
K[0][3] = 1024;
|
||||
K[1][0] = 0;
|
||||
K[1][1] = 0;
|
||||
K[1][2] = 0;
|
||||
K[1][3] = 0;
|
||||
}
|
||||
|
||||
vcrUpdateCoefficients(InstancePtr, K);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This function updates the core registers with computed coefficients for
|
||||
* required conversion
|
||||
*
|
||||
* @param pVCrsmplr is a pointer to the core instance to be worked on.
|
||||
* @param coeff is the array holding computed coefficients
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
******************************************************************************/
|
||||
static void vcrUpdateCoefficients(XV_vcresampler *pVCrsmplr, u32 coeff[2][4])
|
||||
{
|
||||
XV_vcresampler_Set_HwReg_coefs_0_0(pVCrsmplr, coeff[0][0]);
|
||||
XV_vcresampler_Set_HwReg_coefs_0_1(pVCrsmplr, coeff[0][1]);
|
||||
XV_vcresampler_Set_HwReg_coefs_0_2(pVCrsmplr, coeff[0][2]);
|
||||
XV_vcresampler_Set_HwReg_coefs_0_3(pVCrsmplr, coeff[0][3]);
|
||||
XV_vcresampler_Set_HwReg_coefs_1_0(pVCrsmplr, coeff[1][0]);
|
||||
XV_vcresampler_Set_HwReg_coefs_1_1(pVCrsmplr, coeff[1][1]);
|
||||
XV_vcresampler_Set_HwReg_coefs_1_2(pVCrsmplr, coeff[1][2]);
|
||||
XV_vcresampler_Set_HwReg_coefs_1_3(pVCrsmplr, coeff[1][3]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function prints Chroma Resampler status on the console
|
||||
*
|
||||
* @param InstancePtr is a pointer to the core instance to be worked on.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
******************************************************************************/
|
||||
void XV_VCrsmplDbgReportStatus(XV_vcresampler *InstancePtr)
|
||||
{
|
||||
XV_vcresampler *pVCrsmplr = InstancePtr;
|
||||
u32 done, idle, ready, ctrl;
|
||||
u32 vidfmtIn, vidfmtOut, height, width;
|
||||
|
||||
/*
|
||||
* Assert validates the input arguments
|
||||
*/
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
|
||||
xil_printf("\r\n\r\n----->V Chroma Resampler IP STATUS<----\r\n");
|
||||
|
||||
done = XV_vcresampler_IsDone(pVCrsmplr);
|
||||
idle = XV_vcresampler_IsIdle(pVCrsmplr);
|
||||
ready = XV_vcresampler_IsReady(pVCrsmplr);
|
||||
ctrl = XV_vcresampler_ReadReg(pVCrsmplr->Ctrl_BaseAddress, XV_VCRESAMPLER_CTRL_ADDR_AP_CTRL);
|
||||
|
||||
vidfmtIn = XV_vcresampler_Get_HwReg_input_video_format(pVCrsmplr);
|
||||
vidfmtOut = XV_vcresampler_Get_HwReg_output_video_format(pVCrsmplr);
|
||||
height = XV_vcresampler_Get_HwReg_height(pVCrsmplr);
|
||||
width = XV_vcresampler_Get_HwReg_width(pVCrsmplr);
|
||||
|
||||
xil_printf("IsDone: %d\r\n", done);
|
||||
xil_printf("IsIdle: %d\r\n", idle);
|
||||
xil_printf("IsReady: %d\r\n", ready);
|
||||
xil_printf("Ctrl: 0x%x\r\n\r\n", ctrl);
|
||||
|
||||
xil_printf("Video Format In: %d\r\n", vidfmtIn);
|
||||
xil_printf("Video Format Out: %d\r\n", vidfmtOut);
|
||||
xil_printf("Width: %d\r\n", width);
|
||||
xil_printf("Height: %d\r\n", height);
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 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 THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xv_vcresampler_l2.h
|
||||
*
|
||||
* This header file contains layer 2 API's of the vertical chroma resampler
|
||||
* sub-core driver.The functions contained herein provides a high level
|
||||
* implementation of features provided by the IP, abstracting away the register
|
||||
* level details from the user
|
||||
*
|
||||
* <b>V Chroma Resampler IP Features </b>
|
||||
*
|
||||
* The vertical chroma resampler IP supports following features
|
||||
* - convert YUV420 -> YUV422 and YUV422 -> YUV420
|
||||
* - Supports resolution up to 4k2k 60Hz
|
||||
* - up to 16 bits color depth
|
||||
* - 1, 2 or 4 pixel per clock processing
|
||||
*
|
||||
* <b>Dependency</b>
|
||||
*
|
||||
* This driver makes use of the video enumerations and data types defined in the
|
||||
* Xilinx Video Common Driver (video_common_vX.x) and as such the common driver
|
||||
* must be included as dependency to compile this driver
|
||||
|
||||
* <b>Initialization & Configuration</b>
|
||||
*
|
||||
* The device driver enables higher layer software (e.g., an application) to
|
||||
* communicate to the vcresampler core.
|
||||
*
|
||||
* Before using the layer-2 API's user must initialize the core by calling
|
||||
* Layer-1 API XV_vcresampler_Initialize(). This function will look for a
|
||||
* configuration structure for the device and initialize it to defined HW
|
||||
* settings. After initialization Layer-2 API's can be used to configure
|
||||
* the core. It is recommended user always make use of Layer-2 API to
|
||||
* interact with this core.
|
||||
* Advanced users always have the capability to directly interact with the IP
|
||||
* core using Layer-1 API's that perform low level register peek/poke.
|
||||
*
|
||||
* <b> Interrupts </b>
|
||||
*
|
||||
* This driver does not have any interrupts
|
||||
*
|
||||
* <b> Virtual Memory </b>
|
||||
*
|
||||
* This driver supports Virtual Memory. The RTOS is responsible for calculating
|
||||
* the correct device base address in Virtual Memory space.
|
||||
*
|
||||
* <b> Threads </b>
|
||||
*
|
||||
* This driver is not thread safe. Any needs for threads or thread mutual
|
||||
* exclusion must be satisfied by the layer above this driver.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -------------------------------------------------------
|
||||
* 1.00 rc 05/01/15 Initial Release
|
||||
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef XV_VCHROMA_RESAMPLER_L2_H /* prevent circular inclusions */
|
||||
#define XV_VCHROMA_RESAMPLER_L2_H /* by using protection macros */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "xvidc.h"
|
||||
#include "xv_vcresampler.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
void XV_VCrsmplStart(XV_vcresampler *InstancePtr);
|
||||
void XV_VCrsmplStop(XV_vcresampler *InstancePtr);
|
||||
|
||||
void XV_VCrsmplSetActiveSize(XV_vcresampler *InstancePtr,
|
||||
u32 width,
|
||||
u32 height);
|
||||
|
||||
void XV_VCrsmplSetFormat(XV_vcresampler *InstancePtr,
|
||||
XVidC_ColorFormat formatIn,
|
||||
XVidC_ColorFormat formatOut);
|
||||
|
||||
void XV_VCrsmplDbgReportStatus(XV_vcresampler *InstancePtr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,150 @@
|
|||
// ==============================================================
|
||||
// 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.
|
||||
//
|
||||
// ==============================================================
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#include "xv_vcresampler.h"
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
#define MAX_UIO_PATH_SIZE 256
|
||||
#define MAX_UIO_NAME_SIZE 64
|
||||
#define MAX_UIO_MAPS 5
|
||||
#define UIO_INVALID_ADDR 0
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
typedef struct {
|
||||
u32 addr;
|
||||
u32 size;
|
||||
} XV_vcresampler_uio_map;
|
||||
|
||||
typedef struct {
|
||||
int uio_fd;
|
||||
int uio_num;
|
||||
char name[ MAX_UIO_NAME_SIZE ];
|
||||
char version[ MAX_UIO_NAME_SIZE ];
|
||||
XV_vcresampler_uio_map maps[ MAX_UIO_MAPS ];
|
||||
} XV_vcresampler_uio_info;
|
||||
|
||||
/***************** Variable Definitions **************************************/
|
||||
static XV_vcresampler_uio_info uio_info;
|
||||
|
||||
/************************** Function Implementation *************************/
|
||||
static int line_from_file(char* filename, char* linebuf) {
|
||||
char* s;
|
||||
int i;
|
||||
FILE* fp = fopen(filename, "r");
|
||||
if (!fp) return -1;
|
||||
s = fgets(linebuf, MAX_UIO_NAME_SIZE, fp);
|
||||
fclose(fp);
|
||||
if (!s) return -2;
|
||||
for (i=0; (*s)&&(i<MAX_UIO_NAME_SIZE); i++) {
|
||||
if (*s == '\n') *s = 0;
|
||||
s++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int uio_info_read_name(XV_vcresampler_uio_info* info) {
|
||||
char file[ MAX_UIO_PATH_SIZE ];
|
||||
sprintf(file, "/sys/class/uio/uio%d/name", info->uio_num);
|
||||
return line_from_file(file, info->name);
|
||||
}
|
||||
|
||||
static int uio_info_read_version(XV_vcresampler_uio_info* info) {
|
||||
char file[ MAX_UIO_PATH_SIZE ];
|
||||
sprintf(file, "/sys/class/uio/uio%d/version", info->uio_num);
|
||||
return line_from_file(file, info->version);
|
||||
}
|
||||
|
||||
static int uio_info_read_map_addr(XV_vcresampler_uio_info* info, int n) {
|
||||
int ret;
|
||||
char file[ MAX_UIO_PATH_SIZE ];
|
||||
info->maps[n].addr = UIO_INVALID_ADDR;
|
||||
sprintf(file, "/sys/class/uio/uio%d/maps/map%d/addr", info->uio_num, n);
|
||||
FILE* fp = fopen(file, "r");
|
||||
if (!fp) return -1;
|
||||
ret = fscanf(fp, "0x%x", &info->maps[n].addr);
|
||||
fclose(fp);
|
||||
if (ret < 0) return -2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int uio_info_read_map_size(XV_vcresampler_uio_info* info, int n) {
|
||||
int ret;
|
||||
char file[ MAX_UIO_PATH_SIZE ];
|
||||
sprintf(file, "/sys/class/uio/uio%d/maps/map%d/size", info->uio_num, n);
|
||||
FILE* fp = fopen(file, "r");
|
||||
if (!fp) return -1;
|
||||
ret = fscanf(fp, "0x%x", &info->maps[n].size);
|
||||
fclose(fp);
|
||||
if (ret < 0) return -2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XV_vcresampler_Initialize(XV_vcresampler *InstancePtr, const char* InstanceName) {
|
||||
XV_vcresampler_uio_info *InfoPtr = &uio_info;
|
||||
struct dirent **namelist;
|
||||
int i, n;
|
||||
char* s;
|
||||
char file[ MAX_UIO_PATH_SIZE ];
|
||||
char name[ MAX_UIO_NAME_SIZE ];
|
||||
int flag = 0;
|
||||
|
||||
assert(InstancePtr != NULL);
|
||||
|
||||
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");
|
||||
if ((line_from_file(file, name) == 0) && (strcmp(name, InstanceName) == 0)) {
|
||||
flag = 1;
|
||||
s = namelist[i]->d_name;
|
||||
s += 3; // "uio"
|
||||
InfoPtr->uio_num = atoi(s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag == 0) return XST_DEVICE_NOT_FOUND;
|
||||
|
||||
uio_info_read_name(InfoPtr);
|
||||
uio_info_read_version(InfoPtr);
|
||||
for (n = 0; n < MAX_UIO_MAPS; ++n) {
|
||||
uio_info_read_map_addr(InfoPtr, n);
|
||||
uio_info_read_map_size(InfoPtr, n);
|
||||
}
|
||||
|
||||
sprintf(file, "/dev/uio%d", InfoPtr->uio_num);
|
||||
if ((InfoPtr->uio_fd = open(file, O_RDWR)) < 0) {
|
||||
return XST_OPEN_DEVICE_FAILED;
|
||||
}
|
||||
|
||||
// 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->IsReady = XIL_COMPONENT_IS_READY;
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
int XV_vcresampler_Release(XV_vcresampler *InstancePtr) {
|
||||
XV_vcresampler_uio_info *InfoPtr = &uio_info;
|
||||
|
||||
assert(InstancePtr != NULL);
|
||||
assert(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
munmap((void*)InstancePtr->Ctrl_BaseAddress, InfoPtr->maps[0].size);
|
||||
|
||||
close(InfoPtr->uio_fd);
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
// ==============================================================
|
||||
// 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.
|
||||
//
|
||||
// ==============================================================
|
||||
|
||||
#ifndef __linux__
|
||||
|
||||
#include "xstatus.h"
|
||||
#include "xparameters.h"
|
||||
#include "xv_vcresampler.h"
|
||||
|
||||
extern XV_vcresampler_Config XV_vcresampler_ConfigTable[];
|
||||
|
||||
XV_vcresampler_Config *XV_vcresampler_LookupConfig(u16 DeviceId) {
|
||||
XV_vcresampler_Config *ConfigPtr = NULL;
|
||||
|
||||
int Index;
|
||||
|
||||
for (Index = 0; Index < XPAR_XV_VCRESAMPLER_NUM_INSTANCES; Index++) {
|
||||
if (XV_vcresampler_ConfigTable[Index].DeviceId == DeviceId) {
|
||||
ConfigPtr = &XV_vcresampler_ConfigTable[Index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ConfigPtr;
|
||||
}
|
||||
|
||||
int XV_vcresampler_Initialize(XV_vcresampler *InstancePtr, u16 DeviceId) {
|
||||
XV_vcresampler_Config *ConfigPtr;
|
||||
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
|
||||
ConfigPtr = XV_vcresampler_LookupConfig(DeviceId);
|
||||
if (ConfigPtr == NULL) {
|
||||
InstancePtr->IsReady = 0;
|
||||
return (XST_DEVICE_NOT_FOUND);
|
||||
}
|
||||
|
||||
return XV_vcresampler_CfgInitialize(InstancePtr, ConfigPtr);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue