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
9bd89d09
Commit
9bd89d09
authored
5 years ago
by
Patrick Robbe
Browse files
Options
Downloads
Patches
Plain Diff
First prototype of slow control libs
parent
11e45679
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Pcie40Libraries/pcie40_b2slc.c
+35
-0
35 additions, 0 deletions
Pcie40Libraries/pcie40_b2slc.c
Pcie40Libraries/pcie40_b2slc.h
+26
-0
26 additions, 0 deletions
Pcie40Libraries/pcie40_b2slc.h
with
61 additions
and
0 deletions
Pcie40Libraries/pcie40_b2slc.c
0 → 100644
+
35
−
0
View file @
9bd89d09
// File for Belle2 slow control access with PCIe40
/* ---------------------------------------------------------------------- *\
readfee8
returns -1 in case of error
\* ---------------------------------------------------------------------- */
int
pcie40_readfee8
(
int
dev
,
int
adr
)
{
// PCIe40
if
(
(
adr
<=
0
)
||
(
adr
>=
0x7F
)
)
return
-
1
;
// Reset the FIFO
unsigned
ret
=
0
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
SLC_WFIFO_RESET_BIT
)
;
if
(
ret
!=
0
)
return
-
1
;
// Fill the FIFO with the requested information
uint_64
data_word
=
(
0x73
)
|
(
0x07
<<
8
)
|
(
adr
<<
16
)
|
(
0x0c
<<
32
)
|
(
0x08
<<
40
)
;
// (temporary : 32 bits only)
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD
,
(
int
)
(
data_word
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
// Wait for the result to come back
int
i
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
usleep
(
10
)
;
//10 ms
ret
=
ecs_read
(
dev
,
SLC_BAR
,
SLC_RFIFO_STATUS
)
;
if
(
ret
==
0x11
)
break
;
}
if
(
i
==
10
)
return
-
ETIME
;
// Read the value
ret
=
ecs_read
(
dev
,
SLC_BAR
,
SLC_RFIFO_ADD
);
return
ret
;
}
This diff is collapsed.
Click to expand it.
Pcie40Libraries/pcie40_b2slc.h
0 → 100644
+
26
−
0
View file @
9bd89d09
#ifdef PCIE40_B2SLC_H
// Header file for B2 Slow control functions with PCIe40
// Constants
// BAR number for Slow control interface
#define SLC_BAR 2
// Address of the register to reset the write FIFO and bit to use
#define SLC_WFIFO_RESET_ADD 0x000500000
#define SLC_WFIFO_RESET_BIT 2
#define SLC_RFIFO_STATUS 0x00000
#define SLC_RFIFO_ADD 0x0000
// Functions to read/write registers and stream files to Front End
int
pcie40_readfee8
(
int
fd
,
int
adr
);
int
pcie40_writefee8
(
int
fd
,
int
adr
,
int
val
);
int
pcie40_readfee32
(
int
fd
,
int
adr
,
int
*
valp
);
int
pcie40_writefee32
(
int
fd
,
int
adr
,
int
val
);
int
pcie40_writestream
(
int
fd
,
char
*
filename
);
#endif // PCIE40_B2SLC_H
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