Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL Blocking
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Conv TTL Blocking
Commits
17a7bc21
Commit
17a7bc21
authored
Mar 25, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software: Update timetag scripts to accomodate for ring buffer
Signed-off-by:
Theodor Stana
<
t.stana@cern.ch
>
parent
49b31e23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
15 deletions
+55
-15
rdtb.py
software/diag/timetag/rdtb.py
+18
-14
tsdiff.py
software/diag/timetag/tsdiff.py
+1
-1
tsget.py
software/diag/timetag/tsget.py
+36
-0
No files found.
software/diag/timetag/rd
fifo
.py
→
software/diag/timetag/rd
tb
.py
View file @
17a7bc21
...
...
@@ -52,7 +52,24 @@ if __name__ == "__main__":
chcnt
=
[
0
,
0
,
0
,
0
,
0
,
0
]
while
not
empty
:
# Get channel mask from meta register and convert it to channel number
# Read cycles and seconds counters
cyc
=
testelma
.
read
(
slot
,
0x30
)
sl
=
testelma
.
read
(
slot
,
0x34
)
sh
=
testelma
.
read
(
slot
,
0x38
)
# The seconds counter indicates actual seconds; the cycles counter
# indicates 8-ns cycles, so convert to ns
s
=
(
sh
<<
32
)
|
sl
ns
=
cyc
*
8
# Get contents of TBCSR
csr
=
testelma
.
read
(
slot
,
0x3c
)
empty
=
csr
&
(
1
<<
17
)
if
(
empty
):
break
used
=
csr
&
0x7f
# Get channel mask from meta register
ch
=
testelma
.
read
(
slot
,
0x2c
)
&
0x3f
# Increment channel counters if channel bit is set in FIFO
...
...
@@ -77,20 +94,7 @@ if __name__ == "__main__":
#ch = 1 + int(math.log(ch)/math.log(2))
# Read cycles and seconds counters
cyc
=
testelma
.
read
(
slot
,
0x30
)
sl
=
testelma
.
read
(
slot
,
0x34
)
sh
=
testelma
.
read
(
slot
,
0x38
)
# The seconds counter indicates actual seconds; the cycles counter
# indicates 8-ns cycles, so convert to ns
s
=
(
sh
<<
32
)
|
sl
ns
=
cyc
*
8
# And print
csr
=
testelma
.
read
(
slot
,
0x3c
)
empty
=
csr
&
(
1
<<
17
)
used
=
csr
&
0x7f
sample
=
"(
%3
d)
%
s :
%
d.
%09
d sec"
%
(
used
,
"{0:#08b}"
.
format
(
ch
)[
2
:],
s
,
ns
)
if
'f'
in
locals
():
f
.
write
(
sample
+
'
\n
'
);
...
...
software/diag/timetag/tsdiff.py
View file @
17a7bc21
...
...
@@ -18,7 +18,7 @@ if __name__ == "__main__":
for
l
in
f
:
t
=
l
.
split
()[
3
]
ch
=
l
.
split
()[
1
]
[
2
:]
ch
=
l
.
split
()[
1
]
if
t
==
':'
:
t
=
l
.
split
()[
4
]
ch
=
l
.
split
()[
2
]
...
...
software/diag/timetag/tsget.py
0 → 100644
View file @
17a7bc21
import
sys
sys
.
path
.
append
(
"../../ei2c"
)
import
time
from
ei2c
import
*
import
ei2cdefine
if
__name__
==
"__main__"
:
# Get the IP, user and password for the ELMA crate from ei2cdefine.py
ip
=
ei2cdefine
.
HNAME
user
=
ei2cdefine
.
USER
pwd
=
ei2cdefine
.
PWD
testelma
=
EI2C
(
ip
,
user
,
pwd
)
testelma
.
open
()
# Ask for slot number
while
1
:
try
:
slot
=
raw_input
(
"Slot no.: "
)
slot
=
int
(
slot
)
break
except
TypeError
as
e
:
print
(
"Please input a decimal slot number."
)
except
SlotError
as
e
:
print
(
e
.
strerror
)
except
KeyboardInterrupt
:
sys
.
exit
();
except
:
print
(
"Unexpected error: "
,
sys
.
exc_info
()[
0
])
tail
=
testelma
.
read
(
slot
,
0x24
)
taih
=
testelma
.
read
(
slot
,
0x28
)
print
(
"TAI counter value:
%
d"
%
((
taih
<<
32
)
|
tail
))
testelma
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment