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
dd9c4f1c
Commit
dd9c4f1c
authored
May 22, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test23: add write, read, compare eeprom content.
parent
3fd85a76
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
4 deletions
+44
-4
test23.py
test/fmcadc100m14b4cha/python/test23.py
+44
-4
No files found.
test/fmcadc100m14b4cha/python/test23.py
View file @
dd9c4f1c
...
...
@@ -44,6 +44,7 @@ def main (default_directory='.'):
SERIAL_FILENAME
=
os
.
path
.
join
(
default_directory
,
SERIAL_FILENAME
)
CALIBR_FILENAME
=
"calibration_data.txt"
CALIBR_FILENAME
=
os
.
path
.
join
(
default_directory
,
CALIBR_FILENAME
)
EEPROM_BIN_FILENAME
=
"eeprom_content.out"
...
...
@@ -103,6 +104,14 @@ def main (default_directory='.'):
#==================================================
# Create Board Info Area
################################################################################
# CHECK IF A MANUFACTURING DATE IS PRESENT IN THE EEPROM.
# IF NOT, PUT THE CURRENT DATE (IT MEANS IT'S THE FIRST TIME THE TEST IS RUN).
# IF A DATE IS PRESENT, KEEP IT.
# 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, ...)
bia
=
BoardInfoArea
(
minutes
,
"CERN"
,
"FmcAdc100m14b4cha"
,
serial
,
"part number"
,
"fru"
)
#==================================================
...
...
@@ -139,14 +148,45 @@ def main (default_directory='.'):
iua
=
InternalUseArea
(
calibr_data
)
#==================================================
#
Open, set, write, close!
ipmi_open_file
(
"eeprom_content.out"
)
#
Write eeprom content to a binary file
ipmi_open_file
(
EEPROM_BIN_FILENAME
)
ipmi_set
(
bia
,
dcload
,
dcout
,
oem
,
iua
)
ipmi_write
()
ipmi_close_file
()
except
:
raise
PtsError
(
"test failed: "
%
e
)
#==================================================
# Read eeprom content from binary file
f_eeprom
=
open
(
EEPROM_BIN_FILENAME
,
"rb"
)
eeprom_data
=
[]
byte
=
f_eeprom
.
read
(
1
)
# reads one byte
while
byte
:
eeprom_data
.
append
(
ord
(
byte
))
byte
=
f_eeprom
.
read
(
1
)
# reads one byte
f_eeprom
.
close
()
#print "Raw EEPROM data:"
#for data in eeprom_data:
# print "0x%02X" % (data)
#==================================================
# Write content to EEPROM via I2C
fmc
.
sys_i2c_eeprom_write
(
eeprom_data
)
#==================================================
# Read back EEPROM content via I2C
eeprom_data_read
=
fmc
.
sys_i2c_eeprom_read
(
0
,
len
(
eeprom_data
))
print
"EEPROM content comparision"
for
i
in
range
(
len
(
eeprom_data
)):
wr_data
=
eeprom_data
[
i
]
rd_data
=
eeprom_data_read
[
i
]
if
wr_data
==
rd_data
:
check
=
"OK"
else
:
check
=
"FAILED"
print
"0x
%02
X 0x
%02
X =>
%
s"
%
(
wr_data
,
rd_data
,
check
)
except
FmcAdc100mOperationError
as
e
:
raise
PtsError
(
"test 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