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
0e40da5a
Commit
0e40da5a
authored
May 29, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test23: Use EDA number as part_number, use current date as FRU.
Improve content comparison report.
parent
ab45ec95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
test23.py
test/fmcadc100m14b4cha/python/test23.py
+27
-15
No files found.
test/fmcadc100m14b4cha/python/test23.py
View file @
0e40da5a
...
@@ -40,6 +40,7 @@ def main (default_directory='.'):
...
@@ -40,6 +40,7 @@ def main (default_directory='.'):
# Constants declaration
# Constants declaration
TEST_NB
=
23
TEST_NB
=
23
EXPECTED_BITSTREAM_TYPE
=
0x1
EXPECTED_BITSTREAM_TYPE
=
0x1
PART_NUMBER
=
"EDA-02063-V5-0"
SERIAL_FILENAME
=
"../../../serial.txt"
SERIAL_FILENAME
=
"../../../serial.txt"
SERIAL_FILENAME
=
os
.
path
.
join
(
default_directory
,
SERIAL_FILENAME
)
SERIAL_FILENAME
=
os
.
path
.
join
(
default_directory
,
SERIAL_FILENAME
)
CALIBR_FILENAME
=
"calibration_data.txt"
CALIBR_FILENAME
=
"calibration_data.txt"
...
@@ -87,7 +88,7 @@ def main (default_directory='.'):
...
@@ -87,7 +88,7 @@ def main (default_directory='.'):
ref_date
=
datetime
.
datetime
(
1996
,
1
,
1
)
ref_date
=
datetime
.
datetime
(
1996
,
1
,
1
)
diff_date
=
now_date
-
ref_date
diff_date
=
now_date
-
ref_date
current_date
=
int
(
diff_date
.
total_seconds
()
//
60
)
current_date
=
int
(
diff_date
.
total_seconds
()
//
60
)
print
"
Mfg
date/time:
%
d minutes (since 0:00 1/1/96)
\n
"
%
current_date
print
"
Current
date/time:
%
d minutes (since 0:00 1/1/96)
\n
"
%
current_date
#==================================================
#==================================================
# Read calibration data from file
# Read calibration data from file
...
@@ -98,32 +99,32 @@ def main (default_directory='.'):
...
@@ -98,32 +99,32 @@ def main (default_directory='.'):
calibr_data
.
append
(
0xFF
&
int
(
line
,
16
))
calibr_data
.
append
(
0xFF
&
int
(
line
,
16
))
calibr_data
.
append
(
0xFF
&
(
int
(
line
,
16
)
>>
8
))
calibr_data
.
append
(
0xFF
&
(
int
(
line
,
16
)
>>
8
))
f_calibr
.
close
()
f_calibr
.
close
()
print
"Raw calibration data:"
#
print "Raw calibration data:"
for
data
in
calibr_data
:
#
for data in calibr_data:
print
"0x
%02
X"
%
(
data
)
#
print "0x%02X" % (data)
################################################################################
################################################################################
# C
HECK IF A MANUFACTURING DATE IS PRESENT IN THE
EEPROM.
# C
heck if a manufacturing date is present in the
EEPROM.
# I
F NOT, PUT THE CURRENT DATE (IT MEANS IT'S THE FIRST TIME THE TEST IS RUN
).
# I
f not, put the current date (it means it's the first time the test is run
).
# I
F A DATE IS PRESENT, KEEP IT
.
# I
f a date is present, keep it
.
# EEPROM clear code used to test the test!
# EEPROM clear code used to test the test!
#eeprom_data = [0x0] * EEPROM_SIZE
#eeprom_data = [0x0] * EEPROM_SIZE
#fmc.sys_i2c_eeprom_write(eeprom_data)
#fmc.sys_i2c_eeprom_write(eeprom_data)
# Read entire EEPROM
# Read entire EEPROM
print
"Read EEPROM content."
#
print "Read EEPROM content."
eeprom_data_read
=
fmc
.
sys_i2c_eeprom_read
(
0
,
EEPROM_SIZE
)
eeprom_data_read
=
fmc
.
sys_i2c_eeprom_read
(
0
,
EEPROM_SIZE
)
# Write EEPROM data to binary file
# Write EEPROM data to binary file
print
"Write EEPROM content to file (binary)."
#
print "Write EEPROM content to file (binary)."
f_eeprom
=
open
(
EEPROM_BIN_FILENAME
,
"wb"
)
f_eeprom
=
open
(
EEPROM_BIN_FILENAME
,
"wb"
)
for
byte
in
eeprom_data_read
:
for
byte
in
eeprom_data_read
:
f_eeprom
.
write
(
chr
(
byte
))
f_eeprom
.
write
(
chr
(
byte
))
f_eeprom
.
close
()
f_eeprom
.
close
()
# Get manufacturing date from EEPROM data, if exists
# Get manufacturing date from EEPROM data, if exists
print
"Get manufacturing date from
binary file
."
print
"Get manufacturing date from
EEPROM
."
eeprom_data
=
open
(
EEPROM_BIN_FILENAME
,
"rb"
)
.
read
()
eeprom_data
=
open
(
EEPROM_BIN_FILENAME
,
"rb"
)
.
read
()
mfg_date
=
ipmi_get_mfg_date
(
eeprom_data
)
mfg_date
=
ipmi_get_mfg_date
(
eeprom_data
)
...
@@ -132,13 +133,15 @@ def main (default_directory='.'):
...
@@ -132,13 +133,15 @@ def main (default_directory='.'):
print
"No manufacturing date found in the EEPROM, taking current date:
%
d"
%
current_date
print
"No manufacturing date found in the EEPROM, taking current date:
%
d"
%
current_date
mfg_date
=
current_date
mfg_date
=
current_date
else
:
else
:
print
"Manufacturing date found in EEPROM:
%
d"
%
mfg_date
print
"Manufacturing date found in EEPROM:
%
d
(will be preserved)
\n
"
%
mfg_date
#==================================================
#==================================================
# Create Board Info Area
# Create Board Info Area
# FRU field is used to store the date of generation of the eeprom content
# FRU field is used to store the date of generation of the eeprom content
# This could be used later to determine if the content has to be udated (bug fix, ...)
# This could be used later to determine if the content has to be udated (bug fix, ...)
bia
=
BoardInfoArea
(
mfg_date
,
"CERN"
,
"FmcAdc100m14b4cha"
,
serial
,
"part number"
,
"fru"
)
print
"EEPROM content generated:
%
s
\n
"
%
now_date
fru
=
"
%
s"
%
now_date
bia
=
BoardInfoArea
(
mfg_date
,
"CERN"
,
"FmcAdc100m14b4cha"
,
serial
,
PART_NUMBER
,
fru
)
#==================================================
#==================================================
# Multirecords Area
# Multirecords Area
...
@@ -196,12 +199,13 @@ def main (default_directory='.'):
...
@@ -196,12 +199,13 @@ def main (default_directory='.'):
#==================================================
#==================================================
# Write content to EEPROM via I2C
# Write content to EEPROM via I2C
print
"Write EEPROM content.
\n
"
fmc
.
sys_i2c_eeprom_write
(
eeprom_data
)
fmc
.
sys_i2c_eeprom_write
(
eeprom_data
)
#==================================================
#==================================================
# Read back EEPROM content via I2C
# Read back EEPROM content via I2C
eeprom_data_read
=
fmc
.
sys_i2c_eeprom_read
(
0
,
len
(
eeprom_data
))
eeprom_data_read
=
fmc
.
sys_i2c_eeprom_read
(
0
,
len
(
eeprom_data
))
print
"EEPROM content comparision"
mismatch
=
0
for
i
in
range
(
len
(
eeprom_data
)):
for
i
in
range
(
len
(
eeprom_data
)):
wr_data
=
eeprom_data
[
i
]
wr_data
=
eeprom_data
[
i
]
rd_data
=
eeprom_data_read
[
i
]
rd_data
=
eeprom_data_read
[
i
]
...
@@ -209,10 +213,18 @@ def main (default_directory='.'):
...
@@ -209,10 +213,18 @@ def main (default_directory='.'):
check
=
"OK"
check
=
"OK"
else
:
else
:
check
=
"FAILED"
check
=
"FAILED"
print
"0x
%02
X 0x
%02
X =>
%
s"
%
(
wr_data
,
rd_data
,
check
)
mismatch
+=
1
print
"0x
%02
X 0x
%02
X =>
%
s"
%
(
wr_data
,
rd_data
,
check
)
#print "0x%02X 0x%02X => %s" % (wr_data, rd_data, check)
print
"EEPROM content comparision => "
,
if
(
mismatch
==
0
):
print
"OK"
else
:
print
"FAILED"
raise
PtsError
(
"EEPROM comparison failed:
%
d mismatch found."
%
mismatch
)
except
FmcAdc100mOperationError
as
e
:
except
FmcAdc100mOperationError
as
e
:
raise
PtsError
(
"
t
est failed:
%
s"
%
e
)
raise
PtsError
(
"
T
est failed:
%
s"
%
e
)
###########################################################################
###########################################################################
...
...
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