Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
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
Production Test Suite
Commits
95dc686a
Commit
95dc686a
authored
May 29, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test03: Uses common modules, added exception handling.
parent
23ce73e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
76 deletions
+107
-76
test03.py
test/fmcadc100m14b4cha/python/test03.py
+107
-76
No files found.
test/fmcadc100m14b4cha/python/test03.py
View file @
95dc686a
...
...
@@ -5,15 +5,25 @@
# Author: Matthieu Cattin <matthieu.cattin@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Last modifications: 29/5/2012
# Import system modules
import
sys
import
rr
import
time
import
os
# Add common modules and libraries location to path
sys
.
path
.
append
(
'../../../'
)
sys
.
path
.
append
(
'../../../gnurabbit/python/'
)
sys
.
path
.
append
(
'../../../common/'
)
# Import common modules
from
ptsexcept
import
*
import
rr
import
fmc_adc
# Import specific modules
from
fmc_adc_spec
import
*
from
fmc_adc
import
*
"""
...
...
@@ -25,80 +35,101 @@ Note: Requires test00.py to run first to load the firmware!
def
main
(
default_directory
=
'.'
):
"""
path_fpga_loader = '../../../gnurabbit/user/fpga_loader';
path_firmware = '../firmwares/spec_fmcadc100m14b4cha.bin';
firmware_loader = os.path.join(default_directory, path_fpga_loader)
bitstream = os.path.join(default_directory, path_firmware)
print firmware_loader + ' ' + bitstream
os.system( firmware_loader + ' ' + bitstream )
time.sleep(2);
"""
# Objects declaration
spec
=
rr
.
Gennum
()
# bind to the SPEC board
fmc
=
fmc_adc
.
CFmcAdc100Ms
(
spec
)
# Standard in/out temporary redirection
tmp_stdout
=
sys
.
stdout
;
sys
.
stdout
=
sys
.
__stdout__
;
tmp_stdin
=
sys
.
stdin
;
sys
.
stdin
=
sys
.
__stdin__
;
# Initialize error variable, disable triggers and make sure no acquisition is running
error
=
[
0
,
0
]
fmc
.
set_trig_config
(
1
,
0
,
0
,
0
,
0
,
0
,
0
)
fmc
.
stop_acq
()
############################################################################
# Test LEDs ON
fmc
.
trig_led
(
1
)
fmc
.
acq_led
(
1
)
ask
=
""
;
while
((
ask
!=
"Y"
)
and
(
ask
!=
"N"
))
:
print
"-------------------------------------------------------------"
ask
=
raw_input
(
"Are the front panel LEDs (TRIG and ACQ) switched ON? [y,n]"
)
ask
=
ask
.
upper
()
#print "-------------------------------------------------------------"
print
" "
if
(
ask
==
"N"
):
# LED ON fail
error
[
0
]
+=
1
############################################################################
# Test LEDs OFF
fmc
.
trig_led
(
0
)
fmc
.
acq_led
(
0
)
ask
=
""
;
while
((
ask
!=
"Y"
)
and
(
ask
!=
"N"
))
:
print
"-------------------------------------------------------------"
ask
=
raw_input
(
"Are the front panel LEDs (TRIG and ACQ) switched OFF? [y,n]"
)
ask
=
ask
.
upper
()
#print "-------------------------------------------------------------"
print
" "
if
(
ask
==
"N"
):
# LED OFF fail
error
[
0
]
+=
1
# Standard in/out redirection
sys
.
stdout
=
tmp_stdout
;
sys
.
stdin
=
tmp_stdin
;
# Check if an error occured during LED test
if
(
error
!=
[
0
]
*
2
):
if
(
error
[
0
]
!=
0
):
print
(
"One or both LEDs not switching ON. Check for soldering or connection problem, grounded control line."
)
if
(
error
[
1
]
!=
0
):
print
(
"One or both LEDs not switching OFF. Check for short-cut."
)
raise
PtsError
(
'An error occured during LEDs test, check log for details.'
)
else
:
print
(
'LEDs are working ok.'
)
# Constants declaration
TEST_NB
=
3
EXPECTED_BITSTREAM_TYPE
=
0x1
start_test_time
=
time
.
time
()
print
"================================================================================"
print
"Test
%02
d start
\n
"
%
TEST_NB
# SPEC object declaration
print
"Loading hardware access library and opening device.
\n
"
spec
=
rr
.
Gennum
()
# Carrier object declaration (SPEC board specific part)
# Used to check that the firmware is loaded.
try
:
carrier
=
CFmcAdc100mSpec
(
spec
,
EXPECTED_BITSTREAM_TYPE
)
except
FmcAdc100mSpecOperationError
as
e
:
raise
PtsCritical
(
"Carrier init failed, test stopped:
%
s"
%
e
)
# Mezzanine object declaration (FmcAdc100m14b4cha board specific part)
try
:
fmc
=
CFmcAdc100m
(
spec
)
except
FmcAdc100mOperationError
as
e
:
raise
PtsCritical
(
"Mezzanine init failed, test stopped:
%
s"
%
e
)
try
:
# Standard in/out temporary redirection
tmp_stdout
=
sys
.
stdout
;
sys
.
stdout
=
sys
.
__stdout__
;
tmp_stdin
=
sys
.
stdin
;
sys
.
stdin
=
sys
.
__stdin__
;
# Initialize error variable, disable triggers and make sure no acquisition is running
error
=
[
0
,
0
]
fmc
.
set_trig_config
(
1
,
0
,
0
,
0
,
1
,
0
,
0
)
fmc
.
stop_acq
()
#==================================================
# Test LEDs ON
fmc
.
trig_led
(
1
)
fmc
.
acq_led
(
1
)
ask
=
""
;
while
((
ask
!=
"Y"
)
and
(
ask
!=
"N"
))
:
print
"-------------------------------------------------------------"
ask
=
raw_input
(
"Are the front panel LEDs (TRIG and ACQ) switched ON? [y,n]"
)
ask
=
ask
.
upper
()
#print "-------------------------------------------------------------"
print
" "
if
(
ask
==
"N"
):
# LED ON fail
error
[
0
]
+=
1
#==================================================
# Test LEDs OFF
fmc
.
trig_led
(
0
)
fmc
.
acq_led
(
0
)
ask
=
""
;
while
((
ask
!=
"Y"
)
and
(
ask
!=
"N"
))
:
print
"-------------------------------------------------------------"
ask
=
raw_input
(
"Are the front panel LEDs (TRIG and ACQ) switched OFF? [y,n]"
)
ask
=
ask
.
upper
()
#print "-------------------------------------------------------------"
print
" "
if
(
ask
==
"N"
):
# LED OFF fail
error
[
1
]
+=
1
# Restore standard in/out
sys
.
stdout
=
tmp_stdout
;
sys
.
stdin
=
tmp_stdin
;
# Check if an error occured during LED test
if
(
error
!=
[
0
]
*
2
):
if
(
error
[
0
]
!=
0
):
print
(
"One or both LEDs not switching ON. Check for soldering or connection problem, grounded control line."
)
if
(
error
[
1
]
!=
0
):
print
(
"One or both LEDs not switching OFF. Check for short-cut."
)
raise
PtsError
(
'An error occured during LEDs test, check log for details.'
)
else
:
print
(
'LEDs are working ok.'
)
except
FmcAdc100mOperationError
as
e
:
raise
PtsError
(
"Test failed:
%
s"
%
e
)
print
""
print
"==> End of test
%02
d"
%
TEST_NB
print
"================================================================================"
end_test_time
=
time
.
time
()
print
"Test
%02
d elapsed time:
%.2
f seconds
\n
"
%
(
TEST_NB
,
end_test_time
-
start_test_time
)
if
__name__
==
'__main__'
:
...
...
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