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
8b0ba136
Commit
8b0ba136
authored
May 16, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test23: new test to write EEPROM with Manohar's library
Work in progress.
parent
2ef248ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
169 additions
and
0 deletions
+169
-0
test23.py
test/fmcadc100m14b4cha/python/test23.py
+169
-0
No files found.
test/fmcadc100m14b4cha/python/test23.py
0 → 100755
View file @
8b0ba136
#! /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
# Add common modules and libraries location to path
sys
.
path
.
append
(
'../../../'
)
sys
.
path
.
append
(
'../../../gnurabbit/python/'
)
sys
.
path
.
append
(
'../../../common/'
)
# Import common modules
from
ptsexcept
import
*
import
rr
# Import specific modules
from
fmc_adc_spec
import
*
from
fmc_adc
import
*
"""
test23: Test
Note: Requires test00.py to run first to load the firmware!
"""
def
main
(
default_directory
=
'.'
):
# Constants declaration
TEST_NB
=
23
EXPECTED_BITSTREAM_TYPE
=
0x1
SERIAL_FILENAME
=
"../../../serial.txt"
SERIAL_FILENAME
=
os
.
path
.
join
(
default_directory
,
SERIAL_FILENAME
)
CALIBR_FILENAME
=
"calibration_data.txt"
CALIBR_FILENAME
=
os
.
path
.
join
(
default_directory
,
CALIBR_FILENAME
)
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 serial number from a file
# This file must be written by the shell script launching pts
f_serial
=
open
(
SERIAL_FILENAME
,
'r+'
)
serial
=
f_serial
.
readline
()
f_serial
.
close
()
serial
=
serial
[:
-
1
]
# remove EOL char
print
"Board's serial number:
%
s"
%
serial
#==================================================
# Calculate number of minutes since 0:00 1/1/96
now_date
=
datetime
.
datetime
.
now
()
ref_date
=
datetime
.
datetime
(
1996
,
1
,
1
)
diff_date
=
now_date
-
ref_date
minutes
=
"
%
d"
%
int
(
diff_date
.
total_seconds
()
//
60
)
print
"Mfg date/time:
%
s minutes (since 0:00 1/1/96)"
%
minutes
#==================================================
# Read calibration data from file
# This file must be written by the test performing the calibration
f_calibr
=
open
(
CALIBR_FILENAME
,
'r+'
)
calibr_data
=
[]
for
line
in
iter
(
f_calibr
):
calibr_data
.
append
(
int
(
line
,
16
))
f_calibr
.
close
()
return
#==================================================
# Create Board Info Area
bia
=
BoardInfoArea
()
# Set Board Info Area fields
bia
.
set_manufacturer
(
"CERN"
)
bia
.
set_product_name
(
"ADC100M"
)
bia
.
set_serial_number
(
"1234567890"
)
bia
.
set_part_number
(
"ADC100M"
)
bia
.
set_fru_file_id
(
"abcde"
)
#==================================================
# Multirecords Area
dcload
=
DCLoadRecord
()
# Set DC Load information
set_voltage_required
()
set_nominal_voltage
()
set_min_voltage
()
set_max_voltage
()
set_spec_ripple
()
set_min_current
()
set_max_current
()
dcout
=
DCOutputRecord
()
# Set DC Output information
set_output_info
()
set_nominal_voltage
()
set_max_negative_voltage_deviation
()
set_max_positive_voltage_deviation
()
set_ripple
()
set_min_current_draw
()
set_max_current_draw
()
oem
=
OEMRecord
()
# Set OEM record information
set_module_size
()
set_p1_connector_size
()
set_p2_connector_size
()
set_clock_direction
()
set_nsignals
()
set_num_gbt_transceivers
()
set_max_clock
()
#==================================================
# Internal Use Area
iua
=
InternalUseArea
()
iua
.
set_data
([
0x11
,
0x22
,
0x33
])
#==================================================
# Open, set, write, close!
ipmi_open_file
(
"test.out"
)
ipmi_set
(
bia
,
dcload
,
dcout
,
oem
,
iua
)
ipmi_write
()
ipmi_close_file
()
except
:
raise
PtsError
(
"test failed: "
%
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
)
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