Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
FMC ADC 100M 14b 4cha - Testing
Commits
285e7810
Commit
285e7810
authored
Jan 19, 2015
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test47: Add eeprom content validity test.
parent
d10f5f94
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
0 deletions
+110
-0
test47.py
tests/test47.py
+110
-0
No files found.
tests/test47.py
0 → 100755
View file @
285e7810
#! /usr/bin/env python
# coding: utf8
# Copyright CERN, 2011
# Author: Matthieu Cattin <matthieu.cattin@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Last modifications: 16/5/2012
# Import system modules
import
sys
import
time
import
datetime
import
os
# Import specific modules
from
fmc_adc_spec
import
*
from
fmc_adc
import
*
# Import common modules
from
ptsexcept
import
*
from
fmc_eeprom
import
*
import
rr
"""
test47: Read eeprom and check validity
Note: Requires test00.py to run first to load the gateware!
Requires test23.py to run to write eeprom data.
"""
def
main
(
default_directory
=
'.'
):
# Constants declaration
TEST_NB
=
47
EXPECTED_BITSTREAM_TYPE
=
0x1
EEPROM_SIZE
=
8192
# in Bytes
EEPROM_EXPECTED_CONTENT
=
[
01
,
00
]
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)
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
)
###########################################################################
# Real test stuff here
try
:
# Read entire EEPROM
print
"Read EEPROM content."
eeprom_data_read
=
fmc
.
sys_i2c_eeprom_read
(
0
,
EEPROM_SIZE
)
#==================================================
# Check eeprom content validity
print
"Check EEPROM content validity.
\n
"
mismatch
=
0
for
i
in
range
(
len
(
EEPROM_EXPECTED_CONTENT
)):
expect_data
=
EEPROM_EXPECTED_CONTENT
[
i
]
rd_data
=
eeprom_data_read
[
i
]
if
expect_data
==
rd_data
:
check
=
"OK"
else
:
check
=
"FAILED"
mismatch
+=
1
#print "0x%02X 0x%02X => %s" % (expect_data, rd_data, check)
print
"0x
%02
X: 0x
%02
X == 0x
%02
X ? =>
%
s"
%
(
i
,
expect_data
,
rd_data
,
check
)
print
"EEPROM content validity check => "
,
if
(
mismatch
==
0
):
print
"OK"
else
:
print
"FAILED"
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
)
# Check if an error occured during EEPROM verification
if
(
mismatch
!=
0
):
raise
PtsError
(
"EEPROM validity check failed:
%
d mismatch found. Check log for details."
%
mismatch
)
if
__name__
==
'__main__'
:
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