Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmytro Levit
Software
Commits
32600452
Commit
32600452
authored
5 years ago
by
Patrick Robbe
Browse files
Options
Downloads
Patches
Plain Diff
Test user logic
parent
7398c1fd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Pcie40Applications/main_pcie40_ul.c
+41
-15
41 additions, 15 deletions
Pcie40Applications/main_pcie40_ul.c
with
41 additions
and
15 deletions
Pcie40Applications/main_pcie40_ul.c
+
41
−
15
View file @
32600452
...
...
@@ -54,7 +54,8 @@ int crc_calc( int crc, unsigned int data ){
return
crc_temp
;
}
int
decode_data_wUL
(
unsigned
int
*
data
,
unsigned
int
*
ce
,
int
*
crc
,
int
*
run
)
{
int
decode_data_wUL
(
unsigned
int
*
data
,
unsigned
int
*
ce
,
int
*
crc
,
int
*
run
,
int
*
bad
,
int
*
evn
,
int
*
retry
,
int
*
pctime
,
int
*
putime
)
{
int
magic
;
int
size
,
size_link
;
...
...
@@ -82,13 +83,20 @@ int decode_data_wUL( unsigned int * data , unsigned int * ce , int * crc , int *
ix
=
*
ce
+
2
;
exp_run
=
data
[
ix
%
DMASIZE
]
>>
8
;
printf
(
"exprun %.8x eve %d
\n
"
,
exp_run
,
evenum
);
//
printf("exprun %.8x eve %d\n", exp_run, evenum );
if
(
exp_run
!=
*
run
)
{
// it may be that the old data is still in memory
printf
(
"RUN = %d
\n
"
,
*
run
)
;
//
printf( "RUN = %d\n", *run ) ;
return
0
;
}
if
(
evenum
!=
*
evn
)
{
printf
(
"Bad event number %d %d %d %d %d %d
\n
"
,
evenum
,
*
evn
,
ctime
,
utime
,
*
pctime
,
*
putime
)
;
}
*
putime
=
utime
;
*
pctime
=
ctime
;
offset
=
8
;
// size of ROB header [words]
...
...
@@ -96,24 +104,30 @@ int decode_data_wUL( unsigned int * data , unsigned int * ce , int * crc , int *
*
crc
=
0xffff
;
ix
=
*
ce
+
offset
;
size_link
=
data
[
ix
]
&
0x00ffffff
;
size_link
=
data
[
ix
%
DMASIZE
]
&
0x00ffffff
;
if
(
0
==
size_link
)
return
0
;
// it could be that the memory was read
// while being filled
// Calculation of CRC
*
crc
=
crc_calc
(
*
crc
,
ctime
);
*
crc
=
crc_calc
(
*
crc
,
evenum
);
*
crc
=
crc_calc
(
*
crc
,
utime
);
*
crc
=
crc_calc
(
*
crc
,
exp_run
);
*
crc
=
crc_calc
(
*
crc
,
(
exp_run
<<
8
)
);
for
(
ix
=
*
ce
+
offset
+
2
;
ix
<
*
ce
+
offset
+
size_link
-
2
;
ix
++
)
{
for
(
ix
=
*
ce
+
offset
+
2
;
ix
<
*
ce
+
offset
+
size_link
-
2
;
++
ix
)
{
*
crc
=
crc_calc
(
*
crc
,
data
[
ix
%
DMASIZE
]
);
}
ix
=
*
ce
+
8
+
size_link
-
2
;
if
(
(
*
crc
&
0xffff
)
!=
(
data
[
ix
%
DMASIZE
]
&
0xffff
)
){
// retry, could be that the event is not fully in memory
++
(
*
retry
)
;
if
(
*
retry
<
3
)
return
0
;
*
bad
=
1
;
printf
(
"Error in CRC comparison calc %.8x : data %.8x
\n
"
,
*
crc
,
data
[
ix
%
DMASIZE
]
);
return
-
1
;
}
else
{
}
offset
+=
size_link
;
if
(
offset
+
4
>
size
){
printf
(
"Invalid data size sum of link size %d size = %d
\n
"
,
...
...
@@ -139,10 +153,10 @@ int main (int argc ,char** argv) {
FILE
*
fp
;
char
*
ptr
;
char
*
tmp
;
fp
=
popen
(
"ssh vme
\"
trigft -80 pulse 1
10
\"
"
,
"r"
)
;
fp
=
popen
(
"ssh vme
\"
trigft -80 pulse 1
00 -1
\"
"
,
"r"
)
;
char
buf
[
1000
]
;
char
exp
[]
=
"exp"
;
sleep
(
2
)
;
//
sleep( 2 ) ;
while
(
fgets
(
buf
,
sizeof
(
buf
)
,
fp
)
!=
NULL
)
{
// printf( "A= %d\n" , strncmp( exp , buf , 3 ) ) ;
// printf( strncmp( &buf[0] , 'exp' , 1 ) ) ;
...
...
@@ -168,7 +182,14 @@ int main (int argc ,char** argv) {
unsigned
int
*
data
;
double
time_spent
;
int
retry
;
int
bad
;
int
evn
;
evn
=
0
;
bad
=
0
;
retry
=
0
;
int
pctime
,
putime
;
pctime
=
0
;
putime
=
0
;
int
i
;
int
size
,
size_256
,
currentEventIndex
,
crc
,
nErr
,
nEvt
,
nRetry
;
...
...
@@ -177,18 +198,23 @@ int main (int argc ,char** argv) {
nEvt
=
0
;
nRetry
=
0
;
clock_t
begin
=
clock
();
for
(
i
=
0
;
i
<
100
;
++
i
)
{
if
(
nEvt
%
10000
==
1
)
printf
(
"Event number %d
\n
"
,
nEvt
)
;
for
(
i
=
0
;
i
<
100
0000
;
++
i
)
{
if
(
(
nEvt
%
10000
==
1
)
&&
(
size
!=
0
)
)
printf
(
"Event number %d
\n
"
,
nEvt
)
;
res
=
pcie40_b2dmapointerread
(
0
,
&
data
)
;
size
=
decode_data_wUL
(
data
,
&
currentEventIndex
,
&
crc
,
&
run
)
;
bad
=
0
;
size
=
decode_data_wUL
(
data
,
&
currentEventIndex
,
&
crc
,
&
run
,
&
bad
,
&
evn
,
&
retry
,
&
pctime
,
&
putime
)
;
if
(
0
==
size
)
continue
;
if
(
retry
!=
0
)
nRetry
++
;
retry
=
0
;
if
(
size
==
-
1
)
{
nErr
++
;
continue
;
}
if
(
bad
==
1
)
nErr
++
;
evn
++
;
if
(
size
%
8
!=
0
){
size_256
=
(
size
/
8
+
1
)
*
8
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment