Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tempus
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
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
karaboDevices
tempus
Commits
ee6dedb6
Commit
ee6dedb6
authored
2 months ago
by
Björn Senfftleben
Browse files
Options
Downloads
Patches
Plain Diff
add link states (first test)
parent
d7fe3523
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tempus/Tempus.py
+160
-13
160 additions, 13 deletions
src/tempus/Tempus.py
with
160 additions
and
13 deletions
src/tempus/Tempus.py
+
160
−
13
View file @
ee6dedb6
...
@@ -77,6 +77,17 @@ class Tempus(Device):
...
@@ -77,6 +77,17 @@ class Tempus(Device):
self
.
channel
=
None
self
.
channel
=
None
self
.
do_acquire
=
False
self
.
do_acquire
=
False
if
self
.
enableMultiLink
:
self
.
LinkStateBottom1
=
State
.
PASSIVE
self
.
LinkStateBottom2
=
State
.
PASSIVE
self
.
LinkStateTop1
=
State
.
PASSIVE
self
.
LinkStateTop2
=
State
.
PASSIVE
else
:
self
.
LinkStateBottom1
=
State
.
PASSIVE
self
.
LinkStateBottom2
=
State
.
DISABLED
self
.
LinkStateTop1
=
State
.
PASSIVE
self
.
LinkStateTop2
=
State
.
DISABLED
async
def
_monitor
(
self
):
async
def
_monitor
(
self
):
last_time
=
None
last_time
=
None
while
True
:
while
True
:
...
@@ -153,10 +164,54 @@ class Tempus(Device):
...
@@ -153,10 +164,54 @@ class Tempus(Device):
displayedName
=
"
Command Log
"
,
displayedName
=
"
Command Log
"
,
accessMode
=
AccessMode
.
INITONLY
)
accessMode
=
AccessMode
.
INITONLY
)
enableMultiLink
=
Bool
(
@
Bool
(
defaultValue
=
False
,
defaultValue
=
False
,
displayedName
=
"
Enable Multiple Data Links
"
,
displayedName
=
"
Enable Multiple Data Links
"
,
allowedStates
=
{
State
.
INIT
})
allowedStates
=
{
State
.
INIT
})
async
def
enableMultiLink
(
self
,
value
):
self
.
enableMultiLink
=
value
if
value
:
self
.
LinkStateBottom1
=
State
.
PASSIVE
self
.
LinkStateBottom2
=
State
.
PASSIVE
self
.
LinkStateTop1
=
State
.
PASSIVE
self
.
LinkStateTop2
=
State
.
PASSIVE
else
:
self
.
LinkStateBottom1
=
State
.
PASSIVE
self
.
LinkStateBottom2
=
State
.
DISABLED
self
.
LinkStateTop1
=
State
.
PASSIVE
self
.
LinkStateTop2
=
State
.
DISABLED
LinkStateTop1
=
String
(
displayedName
=
"
Link State TOP (1)
"
,
enum
=
State
,
displayType
=
"
State
"
,
# This type enables color coding in the GUI
description
=
"
Reflects the state of a data link from the Timepix4 chip
"
,
accessMode
=
AccessMode
.
READONLY
,
defaultValue
=
State
.
PASSIVE
)
LinkStateTop2
=
String
(
displayedName
=
"
Link State TOP (2)
"
,
enum
=
State
,
displayType
=
"
State
"
,
# This type enables color coding in the GUI
description
=
"
Reflects the state of a data link from the Timepix4 chip
"
,
accessMode
=
AccessMode
.
READONLY
,
defaultValue
=
State
.
DISABLED
)
LinkStateBottom1
=
String
(
displayedName
=
"
Link State BOTTOM (1)
"
,
enum
=
State
,
displayType
=
"
State
"
,
# This type enables color coding in the GUI
description
=
"
Reflects the state of a data link from the Timepix4 chip
"
,
accessMode
=
AccessMode
.
READONLY
,
defaultValue
=
State
.
PASSIVE
)
LinkStateBottom2
=
String
(
displayedName
=
"
Link State BOTTOM (1)
"
,
enum
=
State
,
displayType
=
"
State
"
,
# This type enables color coding in the GUI
description
=
"
Reflects the state of a data link from the Timepix4 chip
"
,
accessMode
=
AccessMode
.
READONLY
,
defaultValue
=
State
.
DISABLED
)
@Slot
(
@Slot
(
displayedName
=
"
Initialize
"
,
displayedName
=
"
Initialize
"
,
...
@@ -183,12 +238,25 @@ class Tempus(Device):
...
@@ -183,12 +238,25 @@ class Tempus(Device):
await
self
.
send_command
(
"
mytpx4.initialisechip()
"
,
sleep_time
=
1
)
await
self
.
send_command
(
"
mytpx4.initialisechip()
"
,
sleep_time
=
1
)
await
self
.
send_command
(
"
mytpx4.configureGWT()
"
,
sleep_time
=
0.5
)
await
self
.
send_command
(
"
mytpx4.configureGWT()
"
,
sleep_time
=
0.5
)
await
self
.
send_command
(
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0
"
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0
"
"
-l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
# 0x2 -> 0x1 at the end would double the bandwidth per link to 2.56 Gbit/s instead of 1.28
"
-l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
# 0x2 -> 0x1 at the end would double the bandwidth per link to 2.56 Gbit/s instead of 1.28
await
self
.
send_command
(
if
"
DOWN
"
in
link_result
:
self
.
LinkStateBottom1
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateBottom1
=
State
.
ACTIVE
else
:
self
.
LinkStateBottom1
=
State
.
UNKNOWN
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1
"
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1
"
"
-l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
# 0x2 -> 0x1 at the end would double the bandwidth per link to 2.56 Gbit/s instead of 1.28
"
-l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
# 0x2 -> 0x1 at the end would double the bandwidth per link to 2.56 Gbit/s instead of 1.28
if
"
DOWN
"
in
link_result
:
self
.
LinkStateTop1
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateTop1
=
State
.
ACTIVE
else
:
self
.
LinkStateTop1
=
State
.
UNKNOWN
await
self
.
send_command
(
"
os.system(
'
devmem2 0x80050000 w 0x2
'
)
"
)
await
self
.
send_command
(
"
os.system(
'
devmem2 0x80050000 w 0x2
'
)
"
)
else
:
else
:
...
@@ -212,10 +280,37 @@ class Tempus(Device):
...
@@ -212,10 +280,37 @@ class Tempus(Device):
await
self
.
send_command
(
"
mytpx4.initialisechip()
"
,
sleep_time
=
1
)
await
self
.
send_command
(
"
mytpx4.initialisechip()
"
,
sleep_time
=
1
)
await
self
.
send_command
(
"
mytpx4.configureGWT()
"
,
sleep_time
=
0.5
)
await
self
.
send_command
(
"
mytpx4.configureGWT()
"
,
sleep_time
=
0.5
)
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0 -l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0 -l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0 -l 0x3 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1 -l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
self
.
LinkStateBottom1
=
State
.
ERROR
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1 -l 0x1 -s 0x2
'
)
"
,
sleep_time
=
15
)
elif
"
READY
"
in
link_result
:
self
.
LinkStateBottom1
=
State
.
ACTIVE
else
:
self
.
LinkStateBottom1
=
State
.
UNKNOWN
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0 -l 0x3 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
self
.
LinkStateBottom2
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateBottom2
=
State
.
ACTIVE
else
:
self
.
LinkStateBottom2
=
State
.
UNKNOWN
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1 -l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
self
.
LinkStateTop1
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateTop1
=
State
.
ACTIVE
else
:
self
.
LinkStateTop1
=
State
.
UNKNOWN
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1 -l 0x1 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
self
.
LinkStateTop2
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateTop2
=
State
.
ACTIVE
else
:
self
.
LinkStateTop2
=
State
.
UNKNOWN
await
self
.
send_command
(
"
os.system(
'
devmem2 0x80050000 w 0x2
'
)
"
)
await
self
.
send_command
(
"
os.system(
'
devmem2 0x80050000 w 0x2
'
)
"
)
...
@@ -244,20 +339,60 @@ class Tempus(Device):
...
@@ -244,20 +339,60 @@ class Tempus(Device):
async
def
_reset_fast_links
(
self
,
initial_state
):
async
def
_reset_fast_links
(
self
,
initial_state
):
try
:
try
:
if
not
self
.
enableMultiLink
:
if
not
self
.
enableMultiLink
:
await
self
.
send_command
(
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0
"
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0
"
"
-l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
"
-l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
await
self
.
send_command
(
if
"
DOWN
"
in
link_result
:
self
.
LinkStateBottom1
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateBottom1
=
State
.
ACTIVE
else
:
self
.
LinkStateBottom1
=
State
.
UNKNOWN
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1
"
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1
"
"
-l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
"
-l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
self
.
LinkStateTop1
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateTop1
=
State
.
ACTIVE
else
:
self
.
LinkStateTop1
=
State
.
UNKNOWN
self
.
status
=
"
Fast-links reset done
"
self
.
status
=
"
Fast-links reset done
"
self
.
state
=
initial_state
self
.
state
=
initial_state
else
:
else
:
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0 -l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0 -l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0 -l 0x3 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1 -l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
self
.
LinkStateBottom1
=
State
.
ERROR
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1 -l 0x1 -s 0x2
'
)
"
,
sleep_time
=
15
)
elif
"
READY
"
in
link_result
:
self
.
LinkStateBottom1
=
State
.
ACTIVE
else
:
self
.
LinkStateBottom1
=
State
.
UNKNOWN
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x0 -l 0x3 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
self
.
LinkStateBottom2
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateBottom2
=
State
.
ACTIVE
else
:
self
.
LinkStateBottom2
=
State
.
UNKNOWN
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1 -l 0x0 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
self
.
LinkStateTop1
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateTop1
=
State
.
ACTIVE
else
:
self
.
LinkStateTop1
=
State
.
UNKNOWN
link_result
=
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/sc_set_gwt_link_up.py -i 0x1 -l 0x1 -s 0x2
'
)
"
,
sleep_time
=
15
)
if
"
DOWN
"
in
link_result
:
self
.
LinkStateTop2
=
State
.
ERROR
elif
"
READY
"
in
link_result
:
self
.
LinkStateTop2
=
State
.
ACTIVE
else
:
self
.
LinkStateTop2
=
State
.
UNKNOWN
self
.
status
=
"
Fast-links (multi-link) reset done
"
self
.
status
=
"
Fast-links (multi-link) reset done
"
self
.
state
=
initial_state
self
.
state
=
initial_state
...
@@ -371,6 +506,17 @@ class Tempus(Device):
...
@@ -371,6 +506,17 @@ class Tempus(Device):
await
self
.
send_command
(
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/Timepix4_Init.py
'
)
"
,
sleep_time
=
5
)
f
"
os.system(
'
{
self
.
APP_DIR
}
/Timepix4_Init.py
'
)
"
,
sleep_time
=
5
)
if
self
.
enableMultiLink
:
self
.
LinkStateBottom1
=
State
.
PASSIVE
self
.
LinkStateBottom2
=
State
.
PASSIVE
self
.
LinkStateTop1
=
State
.
PASSIVE
self
.
LinkStateTop2
=
State
.
PASSIVE
else
:
self
.
LinkStateBottom1
=
State
.
PASSIVE
self
.
LinkStateBottom2
=
State
.
DISABLED
self
.
LinkStateTop1
=
State
.
PASSIVE
self
.
LinkStateTop2
=
State
.
DISABLED
self
.
status
=
"
De-initialized
"
self
.
status
=
"
De-initialized
"
self
.
state
=
State
.
INIT
self
.
state
=
State
.
INIT
...
@@ -507,6 +653,7 @@ class Tempus(Device):
...
@@ -507,6 +653,7 @@ class Tempus(Device):
self
.
logger
.
debug
(
recv
.
decode
())
self
.
logger
.
debug
(
recv
.
decode
())
self
.
commandLog
=
recv
.
decode
()
self
.
commandLog
=
recv
.
decode
()
return
recv
.
decode
()
def
handle_exception
(
self
,
e
):
def
handle_exception
(
self
,
e
):
self
.
logger
.
error
(
e
)
self
.
logger
.
error
(
e
)
...
...
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