Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tapasco
tapasco
Commits
d9774cc3
Commit
d9774cc3
authored
Jul 01, 2018
by
Jens Korinth
Browse files
Merge branch '2018.1' into unified-driver
parents
6e7f2b14
4d3d4560
Changes
51
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
0 → 100644
View file @
d9774cc3
cmake_minimum_required
(
VERSION 3.1 FATAL_ERROR
)
project
(
tapasco VERSION 1.0 LANGUAGES C CXX
)
include
(
GNUInstallDirs
)
set
(
CMNDIR
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/common"
)
set
(
CMAKE_DEBUG_POSTFIX d
)
set
(
CMAKE_CXX_STANDARD 11
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -Werror"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Werror"
)
add_subdirectory
(
platform
)
add_subdirectory
(
arch/axi4mm
)
add_subdirectory
(
arch/tests
)
\ No newline at end of file
arch/axi4mm/CMakeLists.txt
View file @
d9774cc3
cmake_minimum_required
(
VERSION 2.8
)
project
(
arch-axi4mm
)
if
(
NOT EXISTS
"$ENV{TAPASCO_HOME}"
)
message
(
FATAL_ERROR
"Please set TAPASCO_HOME environment variable to root directory of Tapasco"
)
endif
(
NOT EXISTS
"$ENV{TAPASCO_HOME}"
)
include
(
"$ENV{TAPASCO_HOME}/cmake/Tapasco.cmake"
)
set
(
CMAKE_INSTALL_PREFIX
"
${
TAPASCO_HOME
}
/lib"
)
set
(
SRCDIR
"src"
)
set
(
CMNDIR
"../common/src"
)
set
(
AXI4MM_SOURCES
"
${
SRCDIR
}
/tapasco_device.c"
"
${
SRCDIR
}
/tapasco_regs.c"
)
set
(
COMMON_SOURCES
"
${
CMNDIR
}
/tapasco_delayed_transfers.c"
"
${
CMNDIR
}
/tapasco_device.c"
"
${
CMNDIR
}
/tapasco_errors.c"
"
${
CMNDIR
}
/tapasco_jobs.c"
"
${
CMNDIR
}
/tapasco_logging.c"
"
${
CMNDIR
}
/tapasco_local_mem.c"
"
${
CMNDIR
}
/tapasco_memory.c"
"
${
CMNDIR
}
/tapasco_pemgmt.c"
"
${
CMNDIR
}
/tapasco_scheduler.c"
"
${
CMNDIR
}
/tapasco_version.c"
"
${
TAPASCO_COMMON_DIR
}
/src/gen_mem.c"
"
${
TAPASCO_COMMON_DIR
}
/src/gen_queue.c"
)
project
(
arch-axi4mm VERSION 1.0 LANGUAGES C CXX
)
set
(
PCMNDIR
"../common/src"
)
set
(
GPCMNDIR
"
${
TAPASCO_HOME
}
/common"
)
set
(
AXI4MM_SOURCES
"src/tapasco_axi4mm.c"
"src/tapasco_device.c"
"src/tapasco_regs.c"
)
set
(
COMMON_SOURCES
"
${
PCMNDIR
}
/tapasco_delayed_transfers.c"
"
${
PCMNDIR
}
/tapasco_device.c"
"
${
PCMNDIR
}
/tapasco_errors.c"
"
${
PCMNDIR
}
/tapasco_jobs.c"
"
${
PCMNDIR
}
/tapasco_logging.c"
"
${
PCMNDIR
}
/tapasco_local_mem.c"
"
${
PCMNDIR
}
/tapasco_memory.c"
"
${
PCMNDIR
}
/tapasco_pemgmt.c"
"
${
PCMNDIR
}
/tapasco_scheduler.c"
"
${
PCMNDIR
}
/tapasco_version.c"
"
${
CMNDIR
}
/src/gen_mem.c"
"
${
CMNDIR
}
/src/gen_queue.c"
)
add_library
(
tapasco
${
AXI4MM_SOURCES
}
${
COMMON_SOURCES
}
)
target_include_directories
(
tapasco PUBLIC
"$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/../common/include>"
PRIVATE
${
CMNDIR
}
/include
)
include_directories
(
${
TAPASCO_INCDIRS
}
)
include_directories
(
"include"
"../common/include"
"
${
PLATFORMDIR
}
/common/include"
"
${
TAPASCO_COMMON_DIR
}
/src/include"
)
set_source_files_properties
(
${
AXI4MM_SOURCES
}
${
COMMON_SOURCES
}
PROPERTIES COMPILE_FLAGS
${
TAPASCO_CFLAGS
}
)
add_library
(
tapasco SHARED
${
AXI4MM_SOURCES
}
${
COMMON_SOURCES
}
)
add_library
(
libtapasco-static STATIC
${
AXI4MM_SOURCES
}
${
COMMON_SOURCES
}
${
TAPASCO_PLATFORM_LIB
}
)
target_link_libraries
(
tapasco platform atomic pthread
)
set_target_properties
(
libtapasco-static PROPERTIES OUTPUT_NAME tapasco
)
install
(
TARGETS tapasco libtapasco-static
LIBRARY DESTINATION
"lib/
${
TAPASCO_TARGET
}
"
ARCHIVE DESTINATION
"lib/
${
TAPASCO_TARGET
}
/static"
)
install
(
TARGETS tapasco EXPORT TapascoConfig
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
install
(
EXPORT TapascoConfig DESTINATION share/Tapasco/cmake
)
export
(
TARGETS tapasco FILE TapascoConfig.cmake
)
arch/axi4mm/plugins/full_axi_slave_wrapper.tcl
View file @
d9774cc3
...
...
@@ -88,8 +88,9 @@ namespace eval full_axi_wrapper {
return
[
list $inst $args
]
}
proc fix_address_map
{}
{
proc fix_address_map
{
args
}
{
assign_bd_address
return $args
}
}
...
...
arch/common/src/tapasco_local_mem.c
View file @
d9774cc3
...
...
@@ -87,9 +87,7 @@ tapasco_res_t tapasco_local_mem_alloc(tapasco_local_mem_t *lmem,
tapasco_handle_t
*
h
)
{
*
h
=
INVALID_ADDRESS
;
++
slot_id
;
while
(
*
h
==
INVALID_ADDRESS
&&
lmem
->
lmem
[
slot_id
])
{
*
h
=
gen_mem_malloc
(
&
lmem
->
lmem
[
slot_id
],
sz
);
do
{
++
slot_id
;
}
DEVLOG
(
lmem
->
dev_id
,
LALL_MEM
,
"request to allocate %zd bytes for slot_id #"
PRIslot
"-> "
PRIhandle
,
...
...
arch/include/tapasco.hpp
View file @
d9774cc3
...
...
@@ -43,6 +43,7 @@ extern "C" {
#include
<cstdint>
#include
<iostream>
#include
<functional>
#include
<array>
using
namespace
std
;
...
...
@@ -328,6 +329,16 @@ private:
return
set_arg
(
j_id
,
arg_idx
,
t
.
value
,
flags
,
TAPASCO_COPY_DIRECTION_FROM
);
}
/** Sets a std::array output-only argument (alloc only). **/
template
<
typename
T
,
std
::
size_t
N
>
tapasco_res_t
set_args
(
tapasco_job_id_t
const
j_id
,
size_t
const
arg_idx
,
OutOnly
<
std
::
array
<
T
,
N
>>
t
)
const
noexcept
{
tapasco_handle_t
h
{
0
};
tapasco_res_t
r
;
if
((
r
=
tapasco_device_alloc
(
dev_ctx
,
&
h
,
N
*
sizeof
(
T
),
TAPASCO_DEVICE_ALLOC_FLAGS_NONE
))
!=
TAPASCO_SUCCESS
)
return
r
;
return
tapasco_device_job_set_arg
(
dev_ctx
,
j_id
,
arg_idx
,
sizeof
(
h
),
&
h
);
}
/** Sets a single pointer argument (alloc + copy). **/
template
<
typename
T
>
tapasco_res_t
set_arg
(
...
...
@@ -342,6 +353,28 @@ private:
return
tapasco_device_job_set_arg_transfer
(
devctx
,
j_id
,
arg_idx
,
sizeof
(
*
t
),
t
,
flags
,
copy_flags
);
}
/** Sets a std::array argument (alloc + copy). **/
template
<
typename
T
,
std
::
size_t
N
>
tapasco_res_t
set_args
(
tapasco_job_id_t
const
j_id
,
size_t
const
arg_idx
,
std
::
array
<
T
,
N
>
&
t
)
const
noexcept
{
tapasco_handle_t
h
{
0
};
tapasco_res_t
r
;
if
((
r
=
tapasco_device_alloc
(
dev_ctx
,
&
h
,
N
*
sizeof
(
T
),
TAPASCO_DEVICE_ALLOC_FLAGS_NONE
))
!=
TAPASCO_SUCCESS
)
return
r
;
if
((
r
=
tapasco_device_copy_to
(
dev_ctx
,
t
.
data
(),
h
,
N
*
sizeof
(
T
),
TAPASCO_DEVICE_COPY_BLOCKING
))
!=
TAPASCO_SUCCESS
)
return
r
;
return
tapasco_device_job_set_arg
(
dev_ctx
,
j_id
,
arg_idx
,
sizeof
(
h
),
&
h
);
}
/** Sets a const std::array argument (alloc + copy). **/
template
<
typename
T
,
std
::
size_t
N
>
tapasco_res_t
set_args
(
tapasco_job_id_t
const
j_id
,
size_t
const
arg_idx
,
const
std
::
array
<
T
,
N
>
&
t
)
const
noexcept
{
tapasco_handle_t
h
{
0
};
tapasco_res_t
r
;
if
((
r
=
tapasco_device_alloc
(
dev_ctx
,
&
h
,
N
*
sizeof
(
T
),
TAPASCO_DEVICE_ALLOC_FLAGS_NONE
))
!=
TAPASCO_SUCCESS
)
return
r
;
if
((
r
=
tapasco_device_copy_to
(
dev_ctx
,
t
.
data
(),
h
,
N
*
sizeof
(
T
),
TAPASCO_DEVICE_COPY_BLOCKING
))
!=
TAPASCO_SUCCESS
)
return
r
;
return
tapasco_device_job_set_arg
(
dev_ctx
,
j_id
,
arg_idx
,
sizeof
(
h
),
&
h
);
}
/** Sets a single const pointer argument (alloc + copy). **/
template
<
typename
T
>
tapasco_res_t
set_arg
(
...
...
@@ -390,6 +423,23 @@ private:
return
TAPASCO_SUCCESS
;
}
/** Gets a output-only std::array from the device (copy + dealloc). **/
template
<
typename
T
,
std
::
size_t
N
>
tapasco_res_t
get_args
(
tapasco_job_id_t
const
j_id
,
size_t
const
arg_idx
,
std
::
array
<
T
,
N
>
&
t
)
const
noexcept
{
tapasco_handle_t
h
;
tapasco_res_t
r
;
if
((
r
=
tapasco_device_job_get_arg
(
dev_ctx
,
j_id
,
arg_idx
,
sizeof
(
h
),
&
h
))
!=
TAPASCO_SUCCESS
)
return
r
;
if
((
r
=
tapasco_device_copy_from
(
dev_ctx
,
h
,
(
void
*
)
t
.
data
(),
N
*
sizeof
(
T
),
TAPASCO_DEVICE_COPY_BLOCKING
))
!=
TAPASCO_SUCCESS
)
return
r
;
tapasco_device_free
(
dev_ctx
,
h
,
TAPASCO_DEVICE_ALLOC_FLAGS_NONE
);
return
TAPASCO_SUCCESS
;
}
/** Gets a std::array from the device (copy + dealloc). **/
template
<
typename
T
,
std
::
size_t
N
>
tapasco_res_t
get_args
(
tapasco_job_id_t
const
j_id
,
size_t
const
arg_idx
,
OutOnly
<
std
::
array
<
T
,
N
>>
t
)
const
noexcept
{
return
get_args
(
j_id
,
arg_idx
,
*
t
.
value
);
}
/** Gets a single pointer argument (copy + dealloc). **/
template
<
typename
T
>
tapasco_res_t
get_arg
(
tapasco_job_id_t
const
j_id
,
size_t
const
arg_idx
,
T
*
t
)
noexcept
...
...
arch/tests/CMakeLists.txt
View file @
d9774cc3
cmake_minimum_required
(
VERSION 2.8
)
include
(
ExternalProject
)
project
(
tapasco-debug
)
if
(
"$ENV{TAPASCO_HOME}"
STREQUAL
""
)
message
(
FATAL_ERROR
"Please set env var TAPASCO_HOME to root directory of Tapasco."
)
endif
(
"$ENV{TAPASCO_HOME}"
STREQUAL
""
)
set
(
CMAKE_INSTALL_PREFIX
"
${
TAPASCO_HOME
}
"
)
include
(
"$ENV{TAPASCO_HOME}/cmake/Tapasco.cmake"
)
set
(
CMAKE_INSTALL_PREFIX
"
${
TAPASCO_HOME
}
/bin"
)
add_executable
(
tapasco-debug tapasco_debug.cpp
${
CMNDIR
}
/src/gen_queue.c
)
target_include_directories
(
tapasco-debug PRIVATE
${
CMNDIR
}
/include
)
target_link_libraries
(
tapasco-debug tapasco platform pthread atomic ncurses -static-libstdc++ -static-libgcc
)
set
(
CXX_SOURCES tapasco_benchmark.cpp tapasco_debug.cpp json11.cpp jobs/Jobs.cpp
)
set
(
CC_SOURCES
${
TAPASCO_COMMON_DIR
}
/src/gen_queue.c
)
add_executable
(
tapasco-benchmark tapasco_benchmark.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/json11/json11.cpp
${
CMNDIR
}
/src/gen_queue.c
)
target_include_directories
(
tapasco-benchmark PRIVATE
${
CMNDIR
}
/include
${
CMAKE_CURRENT_BINARY_DIR
}
/json11
)
target_link_libraries
(
tapasco-benchmark tapasco platform pthread atomic ncurses -static-libstdc++ -static-libgcc
)
set_source_files_properties
(
${
CXX_SOURCES
}
PROPERTIES COMPILE_FLAGS
${
TAPASCO_CXXFLAGS
}
)
set_source_files_properties
(
${
CC_SOURCES
}
PROPERTIES COMPILE_FLAGS
${
TAPASCO_CFLAGS
}
)
link_directories
(
${
TAPASCO_STATICLINKDIRS
}
)
include_directories
(
${
TAPASCO_INCDIRS
}
"
${
TAPASCO_HOME
}
/arch/common/include"
"
${
TAPASCO_HOME
}
/platform/common/include"
)
add_executable
(
tapasco-debug tapasco_debug.cpp
${
TAPASCO_COMMON_DIR
}
/src/gen_queue.c
)
target_link_libraries
(
tapasco-debug m tapasco platform pthread atomic ncurses
)
set_target_properties
(
tapasco-debug PROPERTIES LINK_FLAGS
${
TAPASCO_LDFLAGS
}
)
add_executable
(
tapasco-benchmark tapasco_benchmark.cpp json11.cpp
)
target_link_libraries
(
tapasco-benchmark pthread atomic ncurses
)
set_target_properties
(
tapasco-benchmark PROPERTIES LINK_SEARCH_START_STATIC 1
)
set_target_properties
(
tapasco-benchmark PROPERTIES LINK_SEARCH_END_STATIC 1
)
set
(
CMAKE_FIND_LIBRARY_SUFFIXES
".a"
)
target_link_libraries
(
tapasco-benchmark tapasco platform
)
set_target_properties
(
tapasco-benchmark PROPERTIES LINK_FLAGS
${
TAPASCO_LDFLAGS
}
)
add_executable
(
tapasco-jobs jobs/Jobs.cpp
)
target_link_libraries
(
tapasco-jobs tapasco platform pthread atomic ncurses
)
set_target_properties
(
tapasco-jobs PROPERTIES LINK_FLAGS
${
TAPASCO_LDFLAGS
}
)
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_SOURCE_DIR
}
/json11.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/json11.hpp
COMMAND rm -rf json11
COMMAND git clone https://github.com/dropbox/json11.git
COMMAND cp json11/json11.*
${
CMAKE_CURRENT_SOURCE_DIR
}
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_BINARY_DIR
}
/json11/json11.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/json11/json11.hpp
COMMAND rm -rf
${
CMAKE_CURRENT_BINARY_DIR
}
/json11
COMMAND git clone https://github.com/dropbox/json11.git
${
CMAKE_CURRENT_BINARY_DIR
}
/json11
)
install
(
TARGETS tapasco-debug tapasco-benchmark
RUNTIME DESTINATION
${
TAPASCO_HOME
}
/bin
)
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
bin/tapasco-build-libs
View file @
d9774cc3
...
...
@@ -12,6 +12,7 @@ tlkm_cmd = 'cd {0} && make -j {1}'
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--mode'
,
help
=
'build mode (default: %(default)s)'
,
default
=
'release'
,
choices
=
[
'clean'
,
'release'
,
'debug'
,
'driver_debug'
])
parser
.
add_argument
(
'--rebuild'
,
help
=
'force rebuild libs (default: %(default)s)'
,
action
=
'store_true'
)
parser
.
add_argument
(
'--shared'
,
help
=
'build shared library instead of static'
,
action
=
'store_true'
)
args
=
parser
.
parse_args
()
clean
=
args
.
mode
==
'clean'
...
...
common/common_2018.1.tcl
0 → 100644
View file @
d9774cc3
# create a dictionary of compatible VLNVs
source $::env
(
TAPASCO_HOME
)
/common/common_ip.tcl
dict set stdcomps dualdma vlnv
"esa.informatik.tu-darmstadt.de:user:dual_dma:1.12"
dict set stdcomps system_ila vlnv
"xilinx.com:ip:system_ila:1.1"
dict set stdcomps axi_pcie3_0_usp vlnv
"xilinx.com:ip:xdma:4.0"
dict set stdcomps clk_wiz vlnv
"xilinx.com:ip:clk_wiz:6.0"
dict set stdcomps mig_core vlnv
"xilinx.com:ip:mig_7series:4.1"
common/ip/dual_dma/dual_dma_1.12/component.xml
0 → 100644
View file @
d9774cc3
This source diff could not be displayed because it is too large. You can
view the blob
instead.
common/ip/dual_dma/dual_dma_1.12/drivers/dual_dma_v1_0/data/dual_dma.mdd
0 → 100644
View file @
d9774cc3
OPTION psf_version = 2.1;
BEGIN DRIVER dual_dma
OPTION supported_peripherals = (dual_dma);
OPTION copyfiles = all;
OPTION VERSION = 1.0;
OPTION NAME = dual_dma;
END DRIVER
examples/examples.cmake
→
common/ip/dual_dma/dual_dma_1.12/drivers/dual_dma_v1_0/data/dual_dma.tcl
View file @
d9774cc3
#
# Copyright (C) 2014
Jens Korinth
, TU Darmstadt
# Copyright
(
C
)
2014
David de la Chevallerie
, TU Darmstadt
#
# This file is part of Tapasco
(
TPC
)
.
#
...
...
@@ -16,14 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
#
set
(
ARCH
"
${
CMAKE_SYSTEM_PROCESSOR
}
"
)
if
(
"$ENV{TAPASCO_HOME}"
STREQUAL
""
)
message
(
FATAL_ERROR
"Please set env var TAPASCO_HOME to root directory of Tapasco."
)
endif
(
"$ENV{TAPASCO_HOME}"
STREQUAL
""
)
set
(
TAPASCO_HOME
"$ENV{TAPASCO_HOME}"
)
# link_directories(${TAPASCO_HOME}/arch/lib/${ARCH}/static ${TAPASCO_HOME}/platform/lib/${ARCH}/static)
link_directories
(
${
TAPASCO_HOME
}
/arch/lib/
${
ARCH
}
${
TAPASCO_HOME
}
/platform/lib/
${
ARCH
}
)
include_directories
(
${
TAPASCO_HOME
}
/arch/common/include
${
TAPASCO_HOME
}
/platform/common/include
)
proc generate
{
drv_handle
}
{
xdefine_include_file $drv_handle
"xparameters.h"
"dual_dma"
"NUM_INSTANCES"
"DEVICE_ID"
"C_S_AXI_BASEADDR"
"C_S_AXI_HIGHADDR"
}
common/ip/dual_dma/dual_dma_1.12/drivers/dual_dma_v1_0/src/Makefile
0 → 100644
View file @
d9774cc3
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 dual_dma..."
$(COMPILER)
$(COMPILER_FLAGS)
$(EXTRA_COMPILER_FLAGS)
$(INCLUDES)
$(LIBSOURCES)
$(ARCHIVER)
-r
${RELEASEDIR}
/
${LIB}
${OUTS}
make clean
include
:
${CP}
$(INCLUDEFILES)
$(INCLUDEDIR)
clean
:
rm
-rf
${OUTS}
common/ip/dual_dma/dual_dma_1.12/drivers/dual_dma_v1_0/src/dual_dma.c
0 → 100644
View file @
d9774cc3
//
// Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
//
// This file is part of Tapasco (TPC).
//
// Tapasco is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tapasco is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
//
/***************************** Include Files *******************************/
#include
"dual_dma.h"
/************************** Function Definitions ***************************/
common/ip/dual_dma/dual_dma_1.12/drivers/dual_dma_v1_0/src/dual_dma.h
0 → 100644
View file @
d9774cc3
//
// Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
//
// This file is part of Tapasco (TPC).
//
// Tapasco is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tapasco is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef DUAL_DMA_H
#define DUAL_DMA_H
/****************** Include Files ********************/
#include
"xil_types.h"
#include
"xstatus.h"
#define DUAL_DMA_S_AXI_SLV_REG0_OFFSET 0
#define DUAL_DMA_S_AXI_SLV_REG1_OFFSET 4
#define DUAL_DMA_S_AXI_SLV_REG2_OFFSET 8
#define DUAL_DMA_S_AXI_SLV_REG3_OFFSET 12
#define DUAL_DMA_S_AXI_SLV_REG4_OFFSET 16
#define DUAL_DMA_S_AXI_SLV_REG5_OFFSET 20
#define DUAL_DMA_S_AXI_SLV_REG6_OFFSET 24
#define DUAL_DMA_S_AXI_SLV_REG7_OFFSET 28
#define DUAL_DMA_S_AXI_SLV_REG8_OFFSET 32
#define DUAL_DMA_S_AXI_SLV_REG9_OFFSET 36
#define DUAL_DMA_S_AXI_SLV_REG10_OFFSET 40
#define DUAL_DMA_S_AXI_SLV_REG11_OFFSET 44
#define DUAL_DMA_S_AXI_SLV_REG12_OFFSET 48
#define DUAL_DMA_S_AXI_SLV_REG13_OFFSET 52
#define DUAL_DMA_S_AXI_SLV_REG14_OFFSET 56
#define DUAL_DMA_S_AXI_SLV_REG15_OFFSET 60
#define DUAL_DMA_S_AXI_SLV_REG16_OFFSET 64
#define DUAL_DMA_S_AXI_SLV_REG17_OFFSET 68
#define DUAL_DMA_S_AXI_SLV_REG18_OFFSET 72
#define DUAL_DMA_S_AXI_SLV_REG19_OFFSET 76
#define DUAL_DMA_S_AXI_SLV_REG20_OFFSET 80
#define DUAL_DMA_S_AXI_SLV_REG21_OFFSET 84
#define DUAL_DMA_S_AXI_SLV_REG22_OFFSET 88
#define DUAL_DMA_S_AXI_SLV_REG23_OFFSET 92
#define DUAL_DMA_S_AXI_SLV_REG24_OFFSET 96
#define DUAL_DMA_S_AXI_SLV_REG25_OFFSET 100
#define DUAL_DMA_S_AXI_SLV_REG26_OFFSET 104
#define DUAL_DMA_S_AXI_SLV_REG27_OFFSET 108
#define DUAL_DMA_S_AXI_SLV_REG28_OFFSET 112
#define DUAL_DMA_S_AXI_SLV_REG29_OFFSET 116
#define DUAL_DMA_S_AXI_SLV_REG30_OFFSET 120
#define DUAL_DMA_S_AXI_SLV_REG31_OFFSET 124
/**************************** Type Definitions *****************************/
/**
*
* Write a value to a DUAL_DMA register. A 32 bit write is performed.
* If the component is implemented in a smaller width, only the least
* significant data is written.
*
* @param BaseAddress is the base address of the DUAL_DMAdevice.
* @param RegOffset is the register offset from the base to write to.
* @param Data is the data written to the register.
*
* @return None.
*
* @note
* C-style signature:
* void DUAL_DMA_mWriteReg(u32 BaseAddress, unsigned RegOffset, u32 Data)
*
*/
#define DUAL_DMA_mWriteReg(BaseAddress, RegOffset, Data) \
Xil_Out32((BaseAddress) + (RegOffset), (u32)(Data))
/**
*
* Read a value from a DUAL_DMA register. A 32 bit read is performed.
* If the component is implemented in a smaller width, only the least
* significant data is read from the register. The most significant data
* will be read as 0.
*
* @param BaseAddress is the base address of the DUAL_DMA device.
* @param RegOffset is the register offset from the base to write to.
*
* @return Data is the data from the register.
*
* @note
* C-style signature:
* u32 DUAL_DMA_mReadReg(u32 BaseAddress, unsigned RegOffset)
*
*/
#define DUAL_DMA_mReadReg(BaseAddress, RegOffset) \
Xil_In32((BaseAddress) + (RegOffset))
/************************** Function Prototypes ****************************/
/**
*
* Run a self-test on the driver/device. Note this may be a destructive test if
* resets of the device are performed.
*
* If the hardware system is not built correctly, this function may never
* return to the caller.
*
* @param baseaddr_p is the base address of the DUAL_DMA instance to be worked on.
*
* @return
*
* - XST_SUCCESS if all self-test code passed
* - XST_FAILURE if any self-test code failed
*
* @note Caching must be turned off for this function to work.
* @note Self test may fail if data memory and device are not on the same bus.
*
*/
XStatus
DUAL_DMA_Reg_SelfTest
(
void
*
baseaddr_p
);
#endif // DUAL_DMA_H
common/ip/dual_dma/dual_dma_1.12/drivers/dual_dma_v1_0/src/dual_dma_selftest.c
0 → 100644
View file @
d9774cc3
//
// Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
//
// This file is part of Tapasco (TPC).
//
// Tapasco is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tapasco is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
//
/***************************** Include Files *******************************/
#include
"dual_dma.h"
#include
"xparameters.h"
#include
"stdio.h"
#include
"xil_io.h"
/************************** Constant Definitions ***************************/
#define READ_WRITE_MUL_FACTOR 0x10
/************************** Function Definitions ***************************/
/**
*
* Run a self-test on the driver/device. Note this may be a destructive test if
* resets of the device are performed.
*
* If the hardware system is not built correctly, this function may never
* return to the caller.
*
* @param baseaddr_p is the base address of the DUAL_DMAinstance to be worked on.
*
* @return
*
* - XST_SUCCESS if all self-test code passed
* - XST_FAILURE if any self-test code failed
*
* @note Caching must be turned off for this function to work.
* @note Self test may fail if data memory and device are not on the same bus.
*
*/
XStatus
DUAL_DMA_Reg_SelfTest
(
void
*
baseaddr_p
)
{
u32
baseaddr
;
int
write_loop_index
;
int
read_loop_index
;
int
Index
;
baseaddr
=
(
u32
)
baseaddr_p
;
xil_printf
(
"******************************
\n\r
"
);
xil_printf
(
"* User Peripheral Self Test
\n\r
"
);
xil_printf
(
"******************************
\n\n\r
"
);
/*
* Write to user logic slave module register(s) and read back
*/
xil_printf
(
"User logic slave module test...
\n\r
"
);
for
(
write_loop_index
=
0
;
write_loop_index
<
4
;
write_loop_index
++
)
DUAL_DMA_mWriteReg
(
baseaddr
,
write_loop_index
*
4
,
(
write_loop_index
+
1
)
*
READ_WRITE_MUL_FACTOR
);
for
(
read_loop_index
=
0
;
read_loop_index
<
4
;
read_loop_index
++
)
if
(
DUAL_DMA_mReadReg
(
baseaddr
,
read_loop_index
*
4
)
!=
(
read_loop_index
+
1
)
*
READ_WRITE_MUL_FACTOR
){
xil_printf
(
"Error reading register value at address %x
\n
"
,
(
int
)
baseaddr
+
read_loop_index
*
4
);
return
XST_FAILURE
;
}
xil_printf
(
" - slave register write/read passed
\n\n\r
"
);
return
XST_SUCCESS
;
}
common/ip/dual_dma/dual_dma_1.12/dual_async_m32_m64.xdc
0 → 100644
View file @
d9774cc3
#
# Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
#
# This file is part of Tapasco (TPC).
#
# Tapasco is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tapasco is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
#
#has to be scoped to the dual_dma instance
set s_clk [get_clocks -of_objects [get_ports m32_axi_aclk]]
set m_clk [get_clocks -of_objects [get_ports m64_axi_aclk]]
set_false_path -through [get_ports -filter {NAME =~ *_axi_aresetn}] -to [filter [get_cells -hierarchical -filter {NAME =~ */rstblk/*}] {IS_SEQUENTIAL}]
set_max_delay -from [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -endpoints_only] {IS_LEAF}] -to [filter [all_fanout -from [get_ports m64_axi_aclk] -flat -only_cells] {IS_SEQUENTIAL && (NAME !~ *dout_i_reg[*])}] -datapath_only [get_property -min PERIOD $s_clk]
set_max_delay -from [filter [all_fanout -from [get_ports m64_axi_aclk] -flat -endpoints_only] {IS_LEAF}] -to [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -only_cells] {IS_SEQUENTIAL && (NAME !~ *dout_i_reg[*])}] -datapath_only [get_property -min PERIOD $m_clk]
set_disable_timing -from CLK -to O [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -endpoints_only -only_cells] {PRIMITIVE_SUBGROUP==dram || PRIMITIVE_SUBGROUP==LUTRAM}]
set_disable_timing -from CLK -to O [filter [all_fanout -from [get_ports m64_axi_aclk] -flat -endpoints_only -only_cells] {PRIMITIVE_SUBGROUP==dram || PRIMITIVE_SUBGROUP==LUTRAM}]
set g_clk [get_clocks -of_objects [get_ports s_axi_aclk]]
set_max_delay -from [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -endpoints_only] {IS_LEAF}] -to [filter [all_fanout -from [get_ports s_axi_aclk] -flat -only_cells] {IS_SEQUENTIAL && (NAME !~ *dout_i_reg[*])}] -datapath_only [get_property -min PERIOD $s_clk]
set_max_delay -from [filter [all_fanout -from [get_ports s_axi_aclk] -flat -endpoints_only] {IS_LEAF}] -to [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -only_cells] {IS_SEQUENTIAL && (NAME !~ *dout_i_reg[*])}] -datapath_only [get_property -min PERIOD $g_clk]