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
ec8cfa4c
Commit
ec8cfa4c
authored
5 years ago
by
Patrick Robbe
Browse files
Options
Downloads
Patches
Plain Diff
Add functions to reset the b2link
parent
c65e64cb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Pcie40Libraries/Makefile
+9
-9
9 additions, 9 deletions
Pcie40Libraries/Makefile
Pcie40Libraries/pcie40_b2ecs.c
+35
-0
35 additions, 0 deletions
Pcie40Libraries/pcie40_b2ecs.c
Pcie40Libraries/pcie40_b2ecs.h
+21
-0
21 additions, 0 deletions
Pcie40Libraries/pcie40_b2ecs.h
with
65 additions
and
9 deletions
Pcie40Libraries/Makefile
+
9
−
9
View file @
ec8cfa4c
...
...
@@ -27,20 +27,20 @@ MINIPODS_OBJ=$(MINIPODS_SRC:%.c=$(OBJ_DIR)%.o)
LTC2990_SRC
=
LTC2990_OBJ
=
$(
LTC2990_SRC:
$(
SRC_DIR
)$(
LTC2990_DIR
)
%.c
=
$(
OBJ_DIR
)
%.o
)
# Belle II s
low control library
B2
SLC
_SRC
=
pcie40_b2slc.c
B2
SLC
_OBJ
=
$(
B2
SLC
_SRC:%.c
=
$(
OBJ_DIR
)
%.o
)
# Belle II s
pecific libraries (slow control, ECS, ...)
B2
LIB
_SRC
=
pcie40_b2slc.c
pcie40_b2ecs.c
B2
LIB
_OBJ
=
$(
B2
LIB
_SRC:%.c
=
$(
OBJ_DIR
)
%.o
)
# static libraries
ECS_LIB
=
libecs.a
MINIPODS_LIB
=
libminipods.a
LTC2990_LIB
=
libltc2990.a
B2
SLC
_LIB
=
libb2
slc
.a
B2
LIB
_LIB
=
libb2
pcie40
.a
# dynamic libraries
LLI_DYNLIB
=
libpcie40.so
all
:
$(ECS_OBJ) $(ECS_LIB) $(MINIPODS_OBJ) $(MINIPODS_LIB) $(LTC2990_OBJ) $(LTC2990_LIB) $(B2
SLC
_LIB) $(LLI_DYNLIB)
all
:
$(ECS_OBJ) $(ECS_LIB) $(MINIPODS_OBJ) $(MINIPODS_LIB) $(LTC2990_OBJ) $(LTC2990_LIB) $(B2
LIB
_LIB) $(LLI_DYNLIB)
$(ECS_OBJ)
:
$(OBJ_DIR)%.o : %.c
@
echo
"Construction of ecs objects
$@
from
$<
"
...
...
@@ -53,15 +53,15 @@ $(ECS_LIB) : $(ECS_OBJ)
ar
-q
$(
LIB_DIR
)$(
ECS_LIB
)
$(
ECS_OBJ
)
@
echo
""
$(B2
SLC
_OBJ)
:
$(OBJ_DIR)%.o : %.c
$(B2
LIB
_OBJ)
:
$(OBJ_DIR)%.o : %.c
@
echo
"Construction of ecs objects
$@
from
$<
"
mkdir
-p
obj
$(
CC
)
$(
CFLAGS
)
-I
.
-I
$(
PCIE40_INC_DIR
)
$<
-o
$@
$(B2
SLC
_LIB)
:
$(B2
SLC
_OBJ)
$(B2
LIB
_LIB)
:
$(B2
LIB
_OBJ)
@
echo
"Construction of Belle II SLC Library"
mkdir
-p
lib
ar
-q
$(
LIB_DIR
)$(
B2
SLC
_LIB
)
$(
B2
SLC
_OBJ
)
ar
-q
$(
LIB_DIR
)$(
B2
LIB
_LIB
)
$(
B2
LIB
_OBJ
)
@
echo
""
$(MINIPODS_OBJ)
:
$(OBJ_DIR)%.o : $(SRC_DIR)%.c
...
...
@@ -87,7 +87,7 @@ $(LTC2990_LIB) : $(LTC2990_OBJ)
$(LLI_DYNLIB)
:
$(ECS_OBJ) $(MINIPODS_OBJ)
@
echo
"Construction of dynamic LLI technical Library for V2"
mkdir
-p
lib
$(
CC
)
-o
$(
LIB_DIR
)$(
LLI_DYNLIB
)
-shared
$(
ECS_OBJ
)
$(
PLL_OBJ
)
$(
MINIPODS_OBJ
)
$(
B2
SLC
_OBJ
)
-L
$(
PCIE40_DYN_LIB
)
-lpcie40driver_ecs
$(
CC
)
-o
$(
LIB_DIR
)$(
LLI_DYNLIB
)
-shared
$(
ECS_OBJ
)
$(
PLL_OBJ
)
$(
MINIPODS_OBJ
)
$(
B2
LIB
_OBJ
)
-L
$(
PCIE40_DYN_LIB
)
-lpcie40driver_ecs
@
echo
clean
:
mrproper
...
...
This diff is collapsed.
Click to expand it.
Pcie40Libraries/pcie40_b2ecs.c
0 → 100644
+
35
−
0
View file @
ec8cfa4c
// File for Belle 2 ECS functions for PCIe40
#include
"pcie40_b2ecs.h"
#include
"pcie40_ecs.h"
// **************************************************************************
// Status of the b2link: 0 = BAD, 1 = GOOD
// **************************************************************************
int
pcie40_b2linkstatus
(
int
fd
)
{
int
ret
=
0
;
ret
=
ecs_read
(
fd
,
ECS_BAR
,
ECS_B2LINK_STATUS_ADD
)
;
return
(
(
ret
&
(
1
<<
ECS_B2LINK_STATUS_BIT
)
)
>>
ECS_B2LINK_STATUS_BIT
)
;
}
// **************************************************************************
// Resynchronize the b2link, returns 1 if success, 0 if error
// **************************************************************************
int
pcie40_resyncb2link
(
int
fd
)
{
int
ret
=
0
;
int
i
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
ret
=
ecs_write
(
fd
,
ECS_BAR
,
ECS_B2LINK_RESET_ADD
,
0x0
)
;
if
(
0
==
ret
)
return
ret
;
ret
=
ecs_write
(
fd
,
ECS_BAR
,
ECS_B2LINK_RESET_ADD
,
1
<<
ECS_B2LINK_RESET_BIT
)
;
if
(
0
==
ret
)
return
ret
;
ret
=
ecs_write
(
fd
,
ECS_BAR
,
ECS_B2LINK_RESET_ADD
,
0x0
)
;
if
(
0
==
ret
)
return
ret
;
ret
=
pcie40_b2linkstatus
(
fd
)
;
if
(
1
==
ret
)
return
ret
;
}
return
0
;
}
This diff is collapsed.
Click to expand it.
Pcie40Libraries/pcie40_b2ecs.h
0 → 100644
+
21
−
0
View file @
ec8cfa4c
#ifndef PCIE40_B2ECS_H
#define PCIE40_B2ECS_H
// Header file for Belle 2 ECS functions with PCIe40
// Constants
// BAR number for Slow control interface
#define ECS_BAR 2
// Address of the register to reset the write FIFO and bit to use
#define ECS_B2LINK_RESET_ADD 0x00050100
#define ECS_B2LINK_RESET_BIT 2
#define ECS_B2LINK_STATUS_ADD 0x00050120
#define ECS_B2LINK_STATUS_BIT 2
// Functions to read/write registers and stream files to Front End
/// b2link status (1 = OK, 0= BAD)
int
pcie40_b2linkstatus
(
int
fd
);
/// Resynchronize b2link
int
pcie40_resyncb2link
(
int
fd
);
#endif // PCIE40_B2ECS_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