vdma: Added support for peripheral test
This patch add's self test example for VDMA to include it on peripheral test. Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
This commit is contained in:
parent
9eee3825f1
commit
5df6bdeaf3
4 changed files with 346 additions and 0 deletions
41
XilinxProcessorIPLib/drivers/axivdma/data/axivdma_header.h
Normal file
41
XilinxProcessorIPLib/drivers/axivdma/data/axivdma_header.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2005 - 2014 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef AXIVDMA_HEADER_H /* prevent circular inclusions */
|
||||
#define AXIVDMA_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
int XAxiVdma_Selftest(u16 DeviceId);
|
||||
|
||||
#endif
|
121
XilinxProcessorIPLib/drivers/axivdma/data/axivdma_tapp.tcl
Executable file
121
XilinxProcessorIPLib/drivers/axivdma/data/axivdma_tapp.tcl
Executable file
|
@ -0,0 +1,121 @@
|
|||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2005 - 2014 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.
|
||||
#
|
||||
##############################################################################
|
||||
# Uses $XILINX_EDK/bin/lib/xillib_sw.tcl
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Software Project Types (swproj):
|
||||
# 0 : MemoryTest - Calls basic memorytest routines from common driver dir
|
||||
# 1 : PeripheralTest - Calls any existing polled_example and/or selftest
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# TCL Procedures:
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
proc gen_include_files {swproj mhsinst} {
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
if {$swproj == 1} {
|
||||
set inc_file_lines {axivdma_header.h}
|
||||
return $inc_file_lines
|
||||
}
|
||||
}
|
||||
|
||||
proc gen_src_files {swproj mhsinst} {
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
if {$swproj == 1} {
|
||||
set inc_file_lines {examples/xaxivdma_example_selftest.c data/axivdma_header.h}
|
||||
return $inc_file_lines
|
||||
}
|
||||
}
|
||||
|
||||
proc gen_testfunc_def {swproj mhsinst} {
|
||||
return ""
|
||||
}
|
||||
|
||||
proc gen_init_code {swproj mhsinst} {
|
||||
return ""
|
||||
}
|
||||
|
||||
proc gen_testfunc_call {swproj mhsinst} {
|
||||
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
|
||||
set ipname [get_property NAME $mhsinst]
|
||||
set deviceid [::hsi::utils::get_ip_param_name $mhsinst "DEVICE_ID"]
|
||||
set stdout [get_property CONFIG.STDOUT [get_os]]
|
||||
if { $stdout == "" || $stdout == "none" } {
|
||||
set hasStdout 0
|
||||
} else {
|
||||
set hasStdout 1
|
||||
}
|
||||
|
||||
set testfunc_call ""
|
||||
|
||||
if {${hasStdout} == 0} {
|
||||
|
||||
append testfunc_call "
|
||||
|
||||
{
|
||||
int status;
|
||||
|
||||
status = XAxiVdma_Selftest(${deviceid});
|
||||
|
||||
}"
|
||||
} else {
|
||||
|
||||
append testfunc_call "
|
||||
|
||||
{
|
||||
int status;
|
||||
|
||||
|
||||
print(\"\\r\\n Running XAxiVdma_Selftest() for ${ipname}...\\r\\n\");
|
||||
|
||||
status = XAxiVdma_Selftest(${deviceid});
|
||||
|
||||
if (status == 0) {
|
||||
print(\"XAxiVdma_Selftest PASSED\\r\\n\");
|
||||
}
|
||||
else {
|
||||
print(\"XAxiVdma_Selftest FAILED\\r\\n\");
|
||||
}
|
||||
}"
|
||||
}
|
||||
|
||||
return $testfunc_call
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* (c) Copyright 2015 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* This file contains confidential and proprietary information of Xilinx, Inc.
|
||||
* and is protected under U.S. and international copyright and other
|
||||
* intellectual property laws.
|
||||
*
|
||||
* DISCLAIMER
|
||||
* This disclaimer is not a license and does not grant any rights to the
|
||||
* materials distributed herewith. Except as otherwise provided in a valid
|
||||
* license issued to you by Xilinx, and to the maximum extent permitted by
|
||||
* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
||||
* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
||||
* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
||||
* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
||||
* and (2) Xilinx shall not be liable (whether in contract or tort, including
|
||||
* negligence, or under any other theory of liability) for any loss or damage
|
||||
* of any kind or nature related to, arising under or in connection with these
|
||||
* materials, including for any direct, or any indirect, special, incidental,
|
||||
* or consequential loss or damage (including loss of data, profits, goodwill,
|
||||
* or any type of loss or damage suffered as a result of any action brought by
|
||||
* a third party) even if such damage or loss was reasonably foreseeable or
|
||||
* Xilinx had been advised of the possibility of the same.
|
||||
*
|
||||
* CRITICAL APPLICATIONS
|
||||
* Xilinx products are not designed or intended to be fail-safe, or for use in
|
||||
* any application requiring fail-safe performance, such as life-support or
|
||||
* safety devices or systems, Class III medical devices, nuclear facilities,
|
||||
* applications related to the deployment of airbags, or any other applications
|
||||
* that could lead to death, personal injury, or severe property or
|
||||
* environmental damage (individually and collectively, "Critical
|
||||
* Applications"). Customer assumes the sole risk and liability of any use of
|
||||
* Xilinx products in Critical Applications, subject only to applicable laws
|
||||
* and regulations governing limitations on product liability.
|
||||
*
|
||||
* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
||||
* AT ALL TIMES.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#include "xaxivdma.h"
|
||||
#include "xparameters.h"
|
||||
#include "xdebug.h"
|
||||
|
||||
/******************** Constant Definitions **********************************/
|
||||
|
||||
/*
|
||||
* Device hardware build related constants.
|
||||
*/
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
#define DMA_DEVICE_ID XPAR_AXIVDMA_0_DEVICE_ID
|
||||
#endif
|
||||
|
||||
#define XAXIVDMA_RESET_TIMEOUT 500
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
int XAxiVdma_Selftest(u16 DeviceId);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
/*
|
||||
* Device instance definitions
|
||||
*/
|
||||
XAxiVdma AxiVdma;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* The entry point for this example. It invokes the example function,
|
||||
* and reports the execution status.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if example finishes successfully
|
||||
* - XST_FAILURE if example fails.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main()
|
||||
{
|
||||
int Status;
|
||||
|
||||
xil_printf("\r\n--- Entering main() --- \r\n");
|
||||
|
||||
/* Run the poll example for simple transfer */
|
||||
Status = XAxiVdma_Selftest(DMA_DEV_ID);
|
||||
|
||||
if (Status != XST_SUCCESS) {
|
||||
|
||||
xil_printf("XAxiVdma_Selftest: Failed\r\n");
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
xil_printf("XAxiDma_Selftest: Passed\r\n");
|
||||
|
||||
xil_printf("--- Exiting main() --- \r\n");
|
||||
|
||||
return XST_SUCCESS;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* This function performance a reset of the VDMA device and checks the device is
|
||||
* coming out of reset or not.
|
||||
*
|
||||
* @param DeviceId is the DMA device id.
|
||||
*
|
||||
* @return - XST_SUCCESS if channel reset is successful
|
||||
* - XST_FAILURE if channel reset fails.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int XAxiVdma_Selftest(u16 DeviceId)
|
||||
{
|
||||
XAxiVdma_Config *Config;
|
||||
int Status = XST_SUCCESS;
|
||||
XAxiVdma_Channel *RdChannel;
|
||||
XAxiVdma_Channel *WrChannel;
|
||||
int Polls;
|
||||
|
||||
Config = XAxiVdma_LookupConfig(DeviceId);
|
||||
if (!Config) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/* Initialize DMA engine */
|
||||
Status = XAxiVdma_CfgInitialize(&AxiVdma, Config, Config->BaseAddress);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
if (Config->HasMm2S) {
|
||||
RdChannel = XAxiVdma_GetChannel(&AxiVdma, XAXIVDMA_READ);
|
||||
RdChannel->ChanBase = Config->BaseAddress + XAXIVDMA_TX_OFFSET;
|
||||
RdChannel->InstanceBase = Config->BaseAddress;
|
||||
XAxiVdma_ChannelReset(RdChannel);
|
||||
Polls = XAXIVDMA_RESET_TIMEOUT;
|
||||
|
||||
while (Polls && XAxiVdma_ChannelResetNotDone(RdChannel)) {
|
||||
Polls -= 1;
|
||||
}
|
||||
|
||||
if (!Polls) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config->HasS2Mm) {
|
||||
WrChannel = XAxiVdma_GetChannel(&AxiVdma, XAXIVDMA_WRITE);
|
||||
WrChannel->ChanBase = Config->BaseAddress + XAXIVDMA_RX_OFFSET;
|
||||
WrChannel->InstanceBase = Config->BaseAddress;
|
||||
XAxiVdma_ChannelReset(WrChannel);
|
||||
|
||||
Polls = XAXIVDMA_RESET_TIMEOUT;
|
||||
|
||||
while (Polls && XAxiVdma_ChannelResetNotDone(WrChannel)) {
|
||||
Polls -= 1;
|
||||
}
|
||||
|
||||
if (!Polls) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -275,6 +275,8 @@
|
|||
* 4.06a srt 04/09/13 - Added support for the newly added S2MM_DMA_IRQ_MASK
|
||||
* register (CR 734741)
|
||||
* 5.0 adk 19/12/13 - Updated as per the New Tcl API's
|
||||
* 5.1 adk 20/01/15 Added support for peripheral test. Created the self
|
||||
* test example to include it on peripheral test's(CR#823144).
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue