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
052d64d9
Commit
052d64d9
authored
Dec 06, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test23: now uses gensdbfs to generate the eeprom image.
parent
baecd175
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
19 deletions
+42
-19
test23.py
test/fmcadc100m14b4cha/python/test23.py
+42
-19
No files found.
test/fmcadc100m14b4cha/python/test23.py
View file @
052d64d9
...
...
@@ -31,6 +31,7 @@ from fmc_adc import *
"""
test23: Write IPMI information and calibration data to FMC EEPROM.
This is done using gensdbfs tool.
Serial number and calibration data are taken from text files.
Note: Requires test00.py to run first to load the firmware!
...
...
@@ -46,7 +47,11 @@ 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"
IPMI_BIN_FILENAME
=
"sdbfs/ipmi.sdb"
IPMI_BIN_FILENAME
=
os
.
path
.
join
(
default_directory
,
IPMI_BIN_FILENAME
)
CALIBR_BIN_FILENAME
=
"sdbfs/calibration.sdb"
CALIBR_BIN_FILENAME
=
os
.
path
.
join
(
default_directory
,
CALIBR_BIN_FILENAME
)
EEPROM_BIN_FILENAME
=
"sdbfs/eeprom_content.out"
EEPROM_BIN_FILENAME
=
os
.
path
.
join
(
default_directory
,
EEPROM_BIN_FILENAME
)
EEPROM_SIZE
=
8192
# in Bytes
...
...
@@ -93,7 +98,7 @@ def main (default_directory='.'):
print
"Current date/time:
%
d minutes (since 0:00 1/1/96)
\n
"
%
current_date
#==================================================
# Read calibration data from file
# Read calibration data from
text
file
# This file must be written by the test performing the calibration
f_calibr
=
open
(
CALIBR_FILENAME
,
'r+'
)
calibr_data
=
[]
...
...
@@ -105,6 +110,14 @@ def main (default_directory='.'):
#for data in calibr_data:
# print "0x%02X" % (data)
#==================================================
# Write calibration data to binary file
# This file will be feed to gensdbfs
f_bin_calibr
=
open
(
CALIBR_BIN_FILENAME
,
'wb'
)
for
byte
in
calibr_data
:
f_bin_calibr
.
write
(
chr
(
byte
))
f_bin_calibr
.
close
()
################################################################################
# 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).
...
...
@@ -174,35 +187,45 @@ def main (default_directory='.'):
oem
=
OEMRecord
(
0
,
0
,
3
,
0
,
68
,
0
,
0
,
0
,
0
,
0
,
0
)
#==================================================
# Internal Use Area
# Takes an array of byte as parameter
iua
=
InternalUseArea
(
calibr_data
)
#==================================================
# Write eeprom content to a binary file
ipmi_open_file
(
EEPROM_BIN_FILENAME
)
ipmi_set
(
bia
,
dcload
,
dcout
,
oem
,
iua
)
# Write ipmi content to a binary file
ipmi_open_file
(
IPMI_BIN_FILENAME
)
ipmi_set
(
bia
,
dcload
,
dcout
,
oem
)
ipmi_write
()
ipmi_close_file
()
#==================================================
# Read
eeprom
content from binary file
f_
eeprom
=
open
(
EEPROM
_BIN_FILENAME
,
"rb"
)
eeprom
_data
=
[]
byte
=
f_
eeprom
.
read
(
1
)
# reads one byte
# Read
impi
content from binary file
f_
ipmi
=
open
(
IPMI
_BIN_FILENAME
,
"rb"
)
ipmi
_data
=
[]
byte
=
f_
ipmi
.
read
(
1
)
# reads one byte
while
byte
:
eeprom
_data
.
append
(
ord
(
byte
))
byte
=
f_
eeprom
.
read
(
1
)
# reads one byte
f_
eeprom
.
close
()
ipmi
_data
.
append
(
ord
(
byte
))
byte
=
f_
ipmi
.
read
(
1
)
# reads one byte
f_
ipmi
.
close
()
#print "Raw EEPROM data:"
#for data in
eeprom
_data:
#for data in
ipmi
_data:
# print "0x%02X" % (data)
#==================================================
# Generate eeprom image with gensdbfs
os
.
system
(
'gensdbfs sdbfs '
+
EEPROM_BIN_FILENAME
)
#==================================================
# Read eeprom content from binary file
f_bin_eeprom
=
open
(
EEPROM_BIN_FILENAME
,
"rb"
)
eeprom_data
=
[]
byte
=
f_bin_eeprom
.
read
(
1
)
# reads one byte
while
byte
:
eeprom_data
.
append
(
ord
(
byte
))
byte
=
f_bin_eeprom
.
read
(
1
)
# reads one byte
f_bin_eeprom
.
close
()
#==================================================
# Write content to EEPROM via I2C
print
"Write EEPROM content.
\n
"
fmc
.
sys_i2c_eeprom_write
(
eeprom_data
)
if
eeprom_data
!=
[]:
fmc
.
sys_i2c_eeprom_write
(
eeprom_data
)
#==================================================
# Read back EEPROM content via I2C
...
...
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