Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hwcore
driver
ifc14x0calib
Commits
36bd1ca2
Commit
36bd1ca2
authored
Nov 15, 2022
by
Lucas Magalhães
Browse files
Merge branch 'more_cleanups' into 'main'
The cleanup saga continues! See merge request
!6
parents
50f5fe2f
18cba864
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
36bd1ca2
...
...
@@ -2,52 +2,13 @@ cmake_minimum_required(VERSION 3.4)
# Project information
project
(
ifc14x0calib
)
# project(
# ModernCMakeExample
# VERSION 1.0
# LANGUAGES CXX)
# Flags used to build xdma lib (C)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -O3 -std=gnu11 -g -ggdb"
)
# Set -fPIC
set
(
CMAKE_POSITION_INDEPENDENT_CODE ON
)
# General settings
set
(
CMAKE_VERBOSE_MAKEFILE OFF
)
set
(
CMAKE_BUILD_TYPE Debug
)
# dmautils library
add_library
(
dmautils dma_utils.c dma_utils.h
)
target_include_directories
(
dmautils PUBLIC .
)
# xildrv library
add_library
(
xildrv libxildrv.c libxildrv.h
)
target_include_directories
(
xildrv PUBLIC .
)
# Main executable
add_executable
(
ifc14x0calib ifc14x0calib.c
)
# Linking
target_link_libraries
(
ifc14x0calib PRIVATE dmautils
)
target_link_libraries
(
ifc14x0calib PRIVATE xildrv
)
# For later
# Install configuration
#install(TARGETS daot DESTINATION daot/bin)
# # Create RPM package
# set(CPACK_PACKAGE_VERSION ${VERSION})
# set(CPACK_RPM_PACKAGE_ARCHITECTURE "ppc64e6500")
# set(CPACK_GENERATOR "RPM")
# set(CPACK_PACKAGE_NAME "daot")
# set(CPACK_PACKAGE_RELEASE 1)
# set(CPACK_PACKAGE_CONTACT "ICS MPS")
# set(CPACK_PACKAGE_VENDOR "ESS ERIC")
# set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
# set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")
# include(CPack)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -O3 -g -ggdb"
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
SOURCE_FILES ifc14x0calib.c dma_utils.c dma_utils.h libxildrv.c libxildrv.h
)
add_executable
(
ifc14x0calib
${
SOURCE_FILES
}
)
dma_utils.h
View file @
36bd1ca2
...
...
@@ -8,11 +8,6 @@
#include
<linux/ioctl.h>
#include
<libxildrv.h>
#define IOCTL_XDMA_PERF_V1 (1)
#define XDMA_ADDRMODE_MEMORY (0)
#define XDMA_ADDRMODE_FIXED (1)
#define DEVICE_NAME_DEFAULT "/dev/xdma0"
#define DEVICE_C2H_NAME_DEFAULT "/dev/xdma0_c2h_0"
#define DEVICE_H2C_NAME_DEFAULT "/dev/xdma0_h2c_0"
...
...
@@ -21,62 +16,8 @@
#define SIZE_DEFAULT (64)
#define COUNT_DEFAULT (1)
/*
* S means "Set" through a ptr,
* T means "Tell" directly with the argument value
* G means "Get": reply by setting through a pointer
* Q means "Query": response is on the return value
* X means "eXchange": switch G and S atomically
* H means "sHift": switch T and Q atomically
*
* _IO(type,nr) no arguments
* _IOR(type,nr,datatype) read data from driver
* _IOW(type,nr,datatype) write data to driver
* _IORW(type,nr,datatype) read/write data
*
* _IOC_DIR(nr) returns direction
* _IOC_TYPE(nr) returns magic
* _IOC_NR(nr) returns number
* _IOC_SIZE(nr) returns size
*/
struct
xdma_performance_ioctl
{
/* IOCTL_XDMA_IOCTL_Vx */
uint32_t
version
;
uint32_t
transfer_size
;
/* measurement */
uint32_t
stopped
;
uint32_t
iterations
;
uint64_t
clock_cycle_count
;
uint64_t
data_cycle_count
;
uint64_t
pending_count
;
};
struct
xdma_aperture_ioctl
{
uint64_t
ep_addr
;
unsigned
int
aperture
;
unsigned
long
buffer
;
unsigned
long
len
;
int
error
;
unsigned
long
done
;
};
/* IOCTL codes */
#define IOCTL_XDMA_PERF_START _IOW('q', 1, struct xdma_performance_ioctl *)
#define IOCTL_XDMA_PERF_STOP _IOW('q', 2, struct xdma_performance_ioctl *)
#define IOCTL_XDMA_PERF_GET _IOR('q', 3, struct xdma_performance_ioctl *)
#define IOCTL_XDMA_ADDRMODE_SET _IOW('q', 4, int)
#define IOCTL_XDMA_ADDRMODE_GET _IOR('q', 5, int)
#define IOCTL_XDMA_ALIGN_GET _IOR('q', 6, int)
#define IOCTL_XDMA_APERTURE_R _IOW('q', 7, struct xdma_aperture_ioctl *)
#define IOCTL_XDMA_APERTURE_W _IOW('q', 8, struct xdma_aperture_ioctl *)
ssize_t
read_to_buffer
(
char
*
fname
,
int
fd
,
char
*
buffer
,
uint64_t
size
,
uint64_t
base
);
ssize_t
write_from_buffer
(
char
*
fname
,
int
fd
,
char
*
buffer
,
uint64_t
size
,
uint64_t
base
);
void
timespec_sub
(
struct
timespec
*
t1
,
struct
timespec
*
t2
);
int
disable_vtc
(
xildev
*
dev
,
unsigned
int
mem
);
void
enable_vtc
(
xildev
*
dev
,
unsigned
int
mem
,
int
vtc_set
);
...
...
ifc14x0calib.c
View file @
36bd1ca2
...
...
@@ -333,10 +333,8 @@ int main(int argc, char * argv[]) {
unsigned
int
init_delay
[
2
][
DQ_LINES
]
=
{
0
};
unsigned
int
temp_cnt_value_store
[
DQ_LINES
]
=
{
0
};
unsigned
int
final_cnt_value_store
[
DQ_LINES
]
=
{
0
};
int
dq_path
=
0
;
unsigned
int
r
=
0
;
unsigned
int
memory_banks
=
0
;
int
vtc_read
=
0
;
unsigned
int
k
,
m
=
0
;
// Loop increment
unsigned
int
start
=
0
;
// Save the start index
unsigned
int
end
=
0
;
// Save the end index
...
...
@@ -641,13 +639,7 @@ int main(int argc, char * argv[]) {
// Loop on 16 DQ
for
(
int
line
=
0
;
line
<
DQ_LINES
;
line
++
){
// Store initial value of count of the DELQ register
dq_path
=
(
line
<<
12
);
xil_write_reg
(
dev
,
SMEM_DDR3_DELQ
[
mem
-
1
],
(
uint32_t
)
dq_path
,
verbose
);
vtc_read
=
disable_vtc
(
dev
,
mem
);
xil_read_reg
(
dev
,
SMEM_DDR3_DELQ
[
mem
-
1
],
(
uint32_t
*
)
&
cnt_value
,
verbose
);
// Read initial value of DELQ register
enable_vtc
(
dev
,
mem
,
vtc_read
);
cnt_value
=
read_delay
(
dev
,
mem
,
line
);
printf
(
"DQ[%02i] Initial delay 0x%03x - DELQ register 0x%08x -> Final delay 0x%03x
\n
"
,
line
,
init_delay
[
m
][
line
],
cnt_value
,
cnt_value
&
0x1ff
);
}
...
...
@@ -655,7 +647,6 @@ int main(int argc, char * argv[]) {
data
=
0
;
xil_write_reg
(
dev
,
SMEM_DDR3_IDEL
[
mem
-
1
],
data
,
verbose
);
xil_write_reg
(
dev
,
SMEM_DDR3_DELQ
[
mem
-
1
],
data
,
verbose
);
}
/*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment