Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple VME FMC Carrier SVEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple VME FMC Carrier SVEC
Commits
e1792087
Commit
e1792087
authored
Jun 04, 2020
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmedma.c: add repeat and pattern options.
parent
cf17af4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
23 deletions
+49
-23
vmedma.c
software/vmecore_test/vmedma.c
+49
-23
No files found.
software/vmecore_test/vmedma.c
View file @
e1792087
...
...
@@ -41,13 +41,9 @@ static void
rate_done
(
struct
timespec
*
start_ts
,
unsigned
int
nbr_bytes
)
{
struct
timespec
end_ts
;
u
nsigned
long
nano
;
u
int64_t
nano
;
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
)
!=
0
)
{
fprintf
(
stderr
,
"clock_gettime error: %m
\n
"
);
exit
(
4
);
}
rate_start
(
&
end_ts
);
nano
=
(
end_ts
.
tv_nsec
-
start_ts
->
tv_nsec
)
+
(
end_ts
.
tv_sec
-
start_ts
->
tv_sec
)
*
1000000000
;
printf
(
"Rate: %f MB/sec
\n
"
,
...
...
@@ -129,10 +125,12 @@ static const struct option options[] =
{
"addr"
,
required_argument
,
0
,
'a'
},
{
"len"
,
required_argument
,
0
,
'n'
},
{
"am"
,
required_argument
,
0
,
'm'
},
{
"repeat"
,
required_argument
,
0
,
'r'
},
{
"2e"
,
required_argument
,
0
,
'e'
},
{
"dump"
,
no_argument
,
0
,
'd'
},
{
"pattern"
,
no_argument
,
0
,
'p'
},
{
"help"
,
no_argument
,
0
,
'h'
},
{
"verbose"
,
no_argument
,
0
,
'v'
},
{
"verbose"
,
no_argument
,
0
,
'v'
},
{
"vbs"
,
required_argument
,
0
,
OPT_VBS
},
{
"pbs"
,
required_argument
,
0
,
OPT_PBS
},
{
NULL
,
0
,
0
,
0
}
...
...
@@ -145,12 +143,14 @@ main (int argc, char **argv)
unsigned
addr
=
0xffffffff
;
unsigned
int
len
=
4096
;
int
c
;
void
*
buf
;
unsigned
char
*
buf
;
int
flag_dump
=
0
;
int
flag_pattern
=
0
;
int
flag_verbose
=
0
;
int
repeat
=
1
;
enum
vme_2esst_mode
vmode
=
VME_2eVME
;
while
((
c
=
getopt_long
(
argc
,
argv
,
"a:m:n:e:dhv"
,
while
((
c
=
getopt_long
(
argc
,
argv
,
"a:m:n:e:
r:
dhv"
,
options
,
NULL
))
!=
-
1
)
switch
(
c
)
{
...
...
@@ -160,6 +160,9 @@ main (int argc, char **argv)
case
'n'
:
len
=
strtol
(
optarg
,
NULL
,
0
);
break
;
case
'r'
:
repeat
=
strtol
(
optarg
,
NULL
,
0
);
break
;
case
'm'
:
am
=
strtol
(
optarg
,
NULL
,
0
);
break
;
...
...
@@ -169,6 +172,10 @@ main (int argc, char **argv)
else
if
(
strcmp
(
optarg
,
"2eSST"
)
==
0
||
strcmp
(
optarg
,
"2eSST-160"
)
==
0
)
vmode
=
VME_SST160
;
else
if
(
strcmp
(
optarg
,
"2eSST-267"
)
==
0
)
vmode
=
VME_SST267
;
else
if
(
strcmp
(
optarg
,
"2eSST-320"
)
==
0
)
vmode
=
VME_SST320
;
else
{
fprintf
(
stderr
,
"%s: bad value for -e, expect 2eVME or 2eSST-160
\n
"
,
argv
[
0
]);
...
...
@@ -178,6 +185,9 @@ main (int argc, char **argv)
case
'd'
:
flag_dump
=
1
;
break
;
case
'p'
:
flag_pattern
=
1
;
break
;
case
'v'
:
flag_verbose
=
1
;
break
;
...
...
@@ -191,7 +201,9 @@ main (int argc, char **argv)
printf
(
"usage: %s -a ADDR [-m AM] [-n LENGTH]
\n
"
,
argv
[
0
]);
printf
(
"options:
\n
"
" --vbs=SZ set VME block size
\n
"
" --pbs=SZ set PCI block size
\n
"
);
" --pbs=SZ set PCI block size
\n
"
" --dump dump data read
\n
"
" --pattern check data read
\n
"
);
return
0
;
case
'?'
:
fprintf
(
stderr
,
"incorrect option, try %s -h
\n
"
,
argv
[
0
]);
...
...
@@ -213,25 +225,39 @@ main (int argc, char **argv)
printf
(
"INFO: test DMA for am 0x%02x, mode: %u (addr: 0x%08x, len: 0x%0x)
\n
"
,
am
,
vmode
,
addr
,
len
);
if
(
posix_memalign
(
&
buf
,
4096
,
len
)
!=
0
)
if
(
posix_memalign
(
(
void
**
)
&
buf
,
4096
,
len
)
!=
0
)
{
fprintf
(
stderr
,
"cannot allocate memory
\n
"
);
exit
(
4
);
}
do_test_dma
(
am
,
vmode
,
addr
,
len
,
buf
);
while
(
repeat
--
>
0
)
{
do_test_dma
(
am
,
vmode
,
addr
,
len
,
buf
);
if
(
flag_dump
)
for
(
unsigned
i
=
0
;
i
<
len
;
i
+=
4
)
{
unsigned
int
v
;
/* Read as BE32. */
v
=
(
buf
[
i
]
<<
24
)
|
(
buf
[
i
+
1
]
<<
16
)
|
(
buf
[
i
+
2
]
<<
8
)
|
buf
[
i
+
3
];
printf
(
"%08x: %08x
\n
"
,
addr
+
i
,
v
);
}
if
(
flag_dump
||
flag_pattern
)
for
(
unsigned
i
=
0
;
i
<
len
;
i
+=
4
)
{
unsigned
int
v
;
/* Read as BE32. */
v
=
(
buf
[
i
]
<<
24
)
|
(
buf
[
i
+
1
]
<<
16
)
|
(
buf
[
i
+
2
]
<<
8
)
|
buf
[
i
+
3
];
if
(
flag_dump
)
printf
(
"%08x: %08x
\n
"
,
addr
+
i
,
v
);
if
(
flag_pattern
)
{
unsigned
patt
=
((
addr
+
i
)
>>
2
)
&
0xff
;
patt
=
((
~
patt
&
0xff
)
<<
8
)
|
patt
;
patt
=
(
patt
<<
16
)
|
patt
;
if
(
v
!=
patt
)
printf
(
"%08x: %08x instead of %08x ERR!
\n
"
,
addr
+
i
,
v
,
patt
);
}
}
}
free
(
buf
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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