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
8d88818b
Commit
8d88818b
authored
Aug 28, 2013
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test31: Improve checking of bad eeprom data.
parent
8ee09b0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
test31.py
test/fmcadc100m14b4cha/python/test31.py
+21
-11
No files found.
test/fmcadc100m14b4cha/python/test31.py
View file @
8d88818b
...
...
@@ -131,20 +131,22 @@ def main (default_directory='.'):
for
i
in
range
(
serial_length
):
serial
+=
chr
(
eeprom_data_read
[
i
+
serial_offset
])
print
(
"Serial number read from bad EEPROM image:
%
s"
%
serial
)
if
serial
==
''
:
raise
PtsCritical
(
"Invalid serial number read in EEPROM!"
)
BAK_CALIBR_BIN_FILENAME
=
"calibr_bak/calibr_"
+
serial
+
".bin"
BAK_CALIBR_BIN_FILENAME
=
os
.
path
.
join
(
default_directory
,
BAK_CALIBR_BIN_FILENAME
)
# Check that the manufacturing date is valid
first_prod_date
=
datetime
.
datetime
(
2013
,
3
,
4
)
diff_date
=
first_prod_date
-
ref_date
first_prod_date_min
=
int
(
diff_date
.
total_seconds
()
//
60
)
if
(
mfg_date_min
==
0
|
mfg_date_min
==
0xffffff
):
print
(
"No manufacturing date found in the EEPROM => taking current date:
%
s
\n
"
%
str
(
current_date
))
mfg_date_min
=
current_date_min
raise
PtsCritical
(
"No manufacturing date found in the EEPROM!"
)
elif
(
mfg_date_min
>
current_date_min
):
print
(
"Date found in the EEPROM is in the future => taking current date:
%
s
\n
"
%
str
(
current_date
))
mfg_date_min
=
current_date_min
raise
PtsCritical
(
"Date found in the EEPROM is in the future!"
)
elif
(
mfg_date_min
<
first_prod_date_min
):
print
(
"Date found in the EEPROM is older than the first production => taking current date:
%
s
\n
"
%
str
(
current_date
))
mfg_date_min
=
current_date_min
raise
PtsCritical
(
"Date found in the EEPROM is older than the first production!"
)
else
:
print
(
"Valid manufacturing date found in EEPROM:
%
s (will be preserved)
\n
"
%
str
(
mfg_date
))
...
...
@@ -241,6 +243,19 @@ P1 Bank A nb signal=%d, P1 Bank B nb signal=%d, P2 Bank A nb signal=%d, P2 Bank
cmd
=
'sdb-read -e 0x1000 '
+
BAD_EEPROM_BIN_FILENAME
+
' calibration.sdb > '
+
CALIBR_BIN_FILENAME
print
(
"Exctract calibration binary file from bad EEPROM image, cmd:
%
s"
%
(
cmd
))
os
.
system
(
cmd
)
cmd
=
"cp "
+
CALIBR_BIN_FILENAME
+
" "
+
BAK_CALIBR_BIN_FILENAME
print
(
"Copy calibration binary, cmd:
%
s"
%
(
cmd
))
#os.system(cmd)
#==================================================
# Check that valid calibration data were extracted
#==================================================
print
(
"
\n
=================================================="
)
print
(
"Check calibration data"
)
calib_data
=
open
(
CALIBR_BIN_FILENAME
,
"rb"
)
.
read
()
print
type
(
calib_data
)
if
calib_data
==
''
:
raise
PtsCritical
(
"Invalid calibration data read in EEPROM!"
)
#==================================================
# Generate eeprom image with gensdbfs
...
...
@@ -270,11 +285,6 @@ P1 Bank A nb signal=%d, P1 Bank B nb signal=%d, P2 Bank A nb signal=%d, P2 Bank
print
(
"
%02
x"
%
(
byte
)),
print
(
"
\n
"
)
##############################################################################################################################################################
sys
.
exit
()
##############################################################################################################################################################
#==================================================
# Erase EEPROM content
#==================================================
...
...
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