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
1739a903
Commit
1739a903
authored
5 years ago
by
Patrick Robbe
Browse files
Options
Downloads
Patches
Plain Diff
Add check before resetting the FIFO for SLC
parent
b1ec1810
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!5
6links
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Pcie40Libraries/pcie40_b2slc.cpp
+30
-5
30 additions, 5 deletions
Pcie40Libraries/pcie40_b2slc.cpp
with
30 additions
and
5 deletions
Pcie40Libraries/pcie40_b2slc.cpp
+
30
−
5
View file @
1739a903
...
...
@@ -14,6 +14,17 @@ extern "C" unsigned ecs_read(int dev, int bar, unsigned add);
///////////////////////////////////////////////////////////////////////////
// Internal functions for slow control,, do not use outside of this library
///////////////////////////////////////////////////////////////////////////
int
pcie40_writeFifoFillLevel
(
int
dev
,
int
ch
)
{
unsigned
ret
=
0
;
ret
=
ecs_read
(
dev
,
SLC_BAR
,
SLC_RFIFO_STATUS
+
ch
*
0x20
)
;
return
(
ret
&
0x1FF
)
;
}
int
pcie40_readFifoFillLevel
(
int
dev
,
int
ch
)
{
unsigned
ret
=
ecs_read
(
dev
,
SLC_BAR
,
SLC_RFIFO_STATUS
+
ch
*
0x20
)
;
ret
=
(
ret
&
0xFF800
)
>>
11
;
return
ret
;
}
int
pcie40_resetWriteFifo
(
int
dev
,
int
ch
)
{
unsigned
ret
=
0
;
...
...
@@ -27,6 +38,21 @@ int pcie40_resetWriteFifo( int dev , int ch ) {
int
pcie40_resetReadFifo
(
int
dev
,
int
ch
)
{
unsigned
ret
=
0
;
unsigned
rle
=
0
;
unsigned
wle
=
0
;
// wait that the FIFO are empty
int
i
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
usleep
(
10
)
;
//10 ms
rle
=
pcie40_readFifoFillLevel
(
dev
,
ch
)
;
wle
=
pcie40_writeFifoFillLevel
(
dev
,
ch
)
;
if
(
(
rle
==
0
)
&&
(
wle
==
0
)
)
break
;
}
if
(
i
==
10
)
{
printf
(
"Timeout
\n
"
)
;
}
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
SLC_WFIFO_RESET_BIT
)
;
if
(
ret
!=
0
)
return
-
1
;
...
...
@@ -63,8 +89,7 @@ int pcie40_waitRead( int dev , int ch , int length ) {
int
i
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
usleep
(
10
)
;
//10 ms
ret
=
ecs_read
(
dev
,
SLC_BAR
,
SLC_RFIFO_STATUS
+
ch
*
0x20
)
;
ret
=
(
ret
&
0xFF00
)
>>
8
;
ret
=
pcie40_readFifoFillLevel
(
dev
,
ch
)
;
if
(
ret
==
length
)
break
;
}
...
...
@@ -112,7 +137,7 @@ int pcie40_readfee8( int dev , int ch , int adr) {
if
(
ret
!=
0
)
return
-
1
;
// Wait for the result to come back (40 words in the fifo)
ret
=
pcie40_waitRead
(
dev
,
ch
,
40
)
;
ret
=
pcie40_waitRead
(
dev
,
ch
,
5
)
;
if
(
ret
!=
0
)
return
-
1
;
// Read the value
...
...
@@ -181,12 +206,12 @@ unsigned long pcie40_readfee32( int dev , int ch , int adr ) {
if
(
ret
!=
0
)
return
-
1
;
// Wait for the result to come back
ret
=
pcie40_waitRead
(
dev
,
ch
,
56
)
;
ret
=
pcie40_waitRead
(
dev
,
ch
,
7
)
;
if
(
ret
!=
0
)
return
-
1
;
// Read the value
std
::
vector
<
int
>
result
;
ret
=
pcie40_readData
(
dev
,
ch
,
result
,
6
)
;
ret
=
pcie40_readData
(
dev
,
ch
,
result
,
7
)
;
int
t_ret1
=
result
.
at
(
0
);
int
t_ret2
=
result
.
at
(
1
);
...
...
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