Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL Blocking - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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 - Testing
Commits
8a325d82
Commit
8a325d82
authored
Aug 23, 2017
by
Maciej Lipinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SW] added verification test of the version of PCB/hardare
parent
9594a57f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
176 additions
and
47 deletions
+176
-47
Makefile
fm/pts/Makefile
+1
-0
hwvertest.py
fm/pts/python/hwvertest.py
+94
-0
jpts.py
fm/pts/python/jpts.py
+81
-47
No files found.
fm/pts/Makefile
View file @
8a325d82
...
...
@@ -20,6 +20,7 @@ all:
cp
ubuntu/$(BOARD)/pyts/pts.py
ubuntu/$(BOARD)/pts
cp
ubuntu/$(BOARD)/pyts/jpts.py
ubuntu/$(BOARD)/jpts
cp
ubuntu/$(BOARD)/pyts/one.py
ubuntu/$(BOARD)/one
ln
-s
pyts/hwvertest.py
ubuntu/$(BOARD)/hwvertest.py
ln
-s
pyts/dac_vcxo_pll.py
ubuntu/$(BOARD)/test01.py
ln
-s
pyts/leds.py
ubuntu/$(BOARD)/test02.py
ln
-s
pyts/ttl_pulse_switch.py
ubuntu/$(BOARD)/test03.py
...
...
fm/pts/python/hwvertest.py
0 → 100644
View file @
8a325d82
##_______________________________________________________________________________________________
##
## CONV-TTL-BLO PTS
##
## CERN,BE/CO-HT
##_______________________________________________________________________________________________
##
##-----------------------------------------------------------------------------------------------
##
## CONV-TTL-BLO pcb version
##
##-----------------------------------------------------------------------------------------------
##
## Description Test whether the version of PCB is the expected one
##
##
## Authors Maciej Lipinski (maciej.lipinski@cern.ch)
## Website http://www.ohwr.org/projects/pts
## Date 17/08/2017
##-----------------------------------------------------------------------------------------------
##
##------------------------------------------------------------------------------------------------
## GNU LESSER GENERAL PUBLIC LICENSE
## ------------------------------------
## This source file is free software; you can redistribute it and/or modify it under the terms of
## the GNU Lesser General Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## This source is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
## without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU Lesser General Public License for more details.
## You should have received a copy of the GNU Lesser General Public License along with this
## source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
##-------------------------------------------------------------------------------------------------
##-------------------------------------------------------------------------------------------------
## Import
##-------------------------------------------------------------------------------------------------
# Import system modules
import
sys
sys
.
path
.
append
(
"log/"
)
import
time
import
os
,
errno
,
re
,
sys
,
struct
import
os.path
import
traceback
import
glob
import
binascii
# Import common modules
from
ctypes
import
*
from
ptsexcept
import
*
from
vv_pts
import
*
from
ptsdefine
import
*
##-------------------------------------------------------------------------------------------------
## main --
##-------------------------------------------------------------------------------------------------
def
main
(
bus
,
tname
,
inf
,
log
):
"""
tests : Hardware version
uses : pts.bit and hwvertest.py
"""
HWVERS
=
4.0
pel
=
PTS_ERROR_LOGGER
(
inf
,
log
)
try
:
# Get gateware version and convert it to major-minor float number
hwvers
=
(
bus
.
vv_read
(
CSR
)
&
0x3F00
)
>>
CSR_HWVERS_OFS
maj
=
float
(
hwvers
>>
2
)
min
=
float
(
hwvers
&
0x03
)
min
/=
10
hwvers
=
maj
+
min
# and now check if appropriate
if
(
hwvers
==
HWVERS
):
msg
=
"HW/PCB version correct:
%2.*
f
\n
"
%
(
p
,
hwvers
)
inf
.
write
(
msg
)
else
:
msg
=
"ERROR: HW/PCBe version (
%2.*
f) incorrect - expected
%2.*
f"
%
(
p
,
hwvers
,
pr
,
HWVERS
)
pel
.
set
(
msg
)
return
pel
.
get
()
except
BusException
,
e
:
raise
PtsError
(
"SKT Exception:
%
s"
%
(
e
))
except
BusWarning
,
e
:
raise
PtsError
(
"SKT Warning:
%
s"
%
(
e
))
\ No newline at end of file
fm/pts/python/jpts.py
View file @
8a325d82
...
...
@@ -193,65 +193,99 @@ if __name__ == '__main__':
except
BusWarning
,
e
:
print
"Warning:Bus Exception:
%
s"
%
(
e
)
# Start running the tests.
for
t
in
tns
:
# Test version of HW/PCB before running any other tests
tname
=
"hwvertest"
try
:
# First load a firmware and read back a register to confirm correct load.
if
bus
.
vv_load
()
==
0
:
msg
=
"INFO: Found CONV-TTL-BLO board in slot
%
d
\n
"
%
(
lun
)
inf
.
write
(
msg
+
'
\n
'
)
# The test is passed the test name, the log and info files and the
# bus object. The test program returns the number of errors that
# occured. If no errors occur, the test PASSes, otherwise it FAILs.
cc
=
run_test
(
tname
,
bus
,
inf
,
log
)
if
cc
==
0
:
msg
=
"PASS:
%
s"
%
(
tname
)
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
else
:
msg
=
"FAIL:
%
s->
%
s"
%
(
tname
,
lnk_ptr
(
tname
))
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
tname
=
"test
%02
d"
%
t
[
0
]
pyt
=
"
%
s/
%
s.py"
%
(
dir
,
tname
)
except
Exception
,
e
:
if
options
.
debug
:
print
e
traceback
.
print_exc
()
if
path
.
exists
(
pyt
)
and
path
.
isfile
(
pyt
)
and
access
(
pyt
,
R_OK
):
msg
=
"FAIL:
%
s->
%
s (
%
s)"
%
(
tname
,
lnk_ptr
(
tname
),
e
)
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
for
n
in
range
(
t
[
1
]):
# Start running the tests, only if the HW/PCB version is OK
if
cc
==
0
:
for
t
in
tns
:
if
n
==
10
:
msg
=
"Printing suppresses after 10 runs"
print
msg
log
.
write
(
'
\n
'
+
msg
+
'
\n
'
)
inf
.
write
(
'
\n
'
+
msg
+
'
\n
'
)
tname
=
"test
%02
d"
%
t
[
0
]
pyt
=
"
%
s/
%
s.py"
%
(
dir
,
tname
)
if
n
<
10
:
msg
=
"Run:
%
d Begin:
%
s"
%
(
n
+
1
,
tname
)
print
msg
log
.
write
(
'
\n
'
+
msg
+
'
\n
'
)
inf
.
write
(
'
\n
'
+
msg
+
'
\n
'
)
if
path
.
exists
(
pyt
)
and
path
.
isfile
(
pyt
)
and
access
(
pyt
,
R_OK
):
try
:
# First load a firmware and read back a register to confirm correct load.
if
bus
.
vv_load
()
==
0
:
msg
=
"INFO: Found CONV-TTL-BLO board in slot
%
d
\n
"
%
(
lun
)
inf
.
write
(
msg
+
'
\n
'
)
for
n
in
range
(
t
[
1
]):
# Each test is passed the test name, the log and info files and the
# bus object. The test program is expected to return the number of
# errors that occured. If no errors occur, the test PASSes, otherwise
# it FAILs.
cc
=
run_test
(
tname
,
bus
,
inf
,
log
)
if
cc
==
0
:
msg
=
"PASS:
%
s"
%
(
tname
)
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
if
n
==
10
:
msg
=
"Printing suppresses after 10 runs"
print
msg
log
.
write
(
'
\n
'
+
msg
+
'
\n
'
)
inf
.
write
(
'
\n
'
+
msg
+
'
\n
'
)
if
n
<
10
:
msg
=
"Run:
%
d Begin:
%
s"
%
(
n
+
1
,
tname
)
print
msg
else
:
msg
=
"FAIL:
%
s->
%
s"
%
(
tname
,
lnk_ptr
(
tname
))
log
.
write
(
'
\n
'
+
msg
+
'
\n
'
)
inf
.
write
(
'
\n
'
+
msg
+
'
\n
'
)
try
:
# First load a firmware and read back a register to confirm correct load.
if
bus
.
vv_load
()
==
0
:
msg
=
"INFO: Found CONV-TTL-BLO board in slot
%
d
\n
"
%
(
lun
)
inf
.
write
(
msg
+
'
\n
'
)
# Each test is passed the test name, the log and info files and the
# bus object. The test program is expected to return the number of
# errors that occured. If no errors occur, the test PASSes, otherwise
# it FAILs.
cc
=
run_test
(
tname
,
bus
,
inf
,
log
)
if
cc
==
0
:
msg
=
"PASS:
%
s"
%
(
tname
)
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
else
:
msg
=
"FAIL:
%
s->
%
s"
%
(
tname
,
lnk_ptr
(
tname
))
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
except
Exception
,
e
:
if
options
.
debug
:
print
e
traceback
.
print_exc
()
msg
=
"FAIL:
%
s->
%
s (
%
s)"
%
(
tname
,
lnk_ptr
(
tname
),
e
)
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
except
Exception
,
e
:
if
options
.
debug
:
print
e
traceback
.
print_exc
()
msg
=
"FAIL:
%
s->
%
s (
%
s)"
%
(
tname
,
lnk_ptr
(
tname
),
e
)
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
if
n
<
10
:
msg
=
"Run:
%
d End:
%
s
\n
"
%
(
n
+
1
,
tname
)
print
msg
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
if
n
<
10
:
msg
=
"Run:
%
d End:
%
s
\n
"
%
(
n
+
1
,
tname
)
print
msg
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
# Close the bus and the files
bus
.
vv_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