Commit 2ef248ae authored by Matthieu Cattin's avatar Matthieu Cattin

test00: Fix firmware path to make it work when called by pts module.

Add a few comments in fmc_adc module.
parent 2a996bbc
...@@ -192,7 +192,7 @@ class CFmcAdc100m: ...@@ -192,7 +192,7 @@ class CFmcAdc100m:
WAIT_TIME_OUT = 2 WAIT_TIME_OUT = 2
"""
def channel_addr(self, channel, reg): def channel_addr(self, channel, reg):
if(channel < 1 or channel > 4): if(channel < 1 or channel > 4):
raise FmcAdc100mOperationError("Channel number not in range (1 to 4).") raise FmcAdc100mOperationError("Channel number not in range (1 to 4).")
...@@ -200,6 +200,7 @@ class CFmcAdc100m: ...@@ -200,6 +200,7 @@ class CFmcAdc100m:
addr = (reg + (0x10*(channel - 1))) addr = (reg + (0x10*(channel - 1)))
#print("Channel %d address: %.2X") % (channel, addr) #print("Channel %d address: %.2X") % (channel, addr)
return addr return addr
"""
def __init__(self, bus): def __init__(self, bus):
self.bus = bus self.bus = bus
...@@ -280,6 +281,10 @@ class CFmcAdc100m: ...@@ -280,6 +281,10 @@ class CFmcAdc100m:
print("Test pattern : %.4X") % self.adc_cfg.get_testpat() print("Test pattern : %.4X") % self.adc_cfg.get_testpat()
print("Test pattern status : %.1X") % self.adc_cfg.get_testpat_stat() print("Test pattern status : %.1X") % self.adc_cfg.get_testpat_stat()
#======================================================================
# Onewire thermometer and unique ID
# print FMC unique ID # print FMC unique ID
def print_unique_id(self): def print_unique_id(self):
try: try:
...@@ -310,6 +315,9 @@ class CFmcAdc100m: ...@@ -310,6 +315,9 @@ class CFmcAdc100m:
except DS18B20OperationError as e: except DS18B20OperationError as e:
raise FmcAdc100mOperationError(e) raise FmcAdc100mOperationError(e)
#======================================================================
# I2C buses
# scan FMC i2c bus # scan FMC i2c bus
def i2c_scan(self): def i2c_scan(self):
print '\nScanning FMC I2C bus' print '\nScanning FMC I2C bus'
...@@ -754,6 +762,10 @@ class CFmcAdc100m: ...@@ -754,6 +762,10 @@ class CFmcAdc100m:
except CSRDeviceOperationError as e: except CSRDeviceOperationError as e:
raise FmcAdc100mOperationError(e) raise FmcAdc100mOperationError(e)
#======================================================================
# Si570 programmable oscillator
# Print Si570 config # Print Si570 config
def print_si570_config(self): def print_si570_config(self):
try: try:
......
...@@ -12,7 +12,7 @@ import sys ...@@ -12,7 +12,7 @@ import sys
import time import time
import os import os
# Add common modules location tp path # Add common modules and libraries location to path
sys.path.append('../../../') sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/') sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/') sys.path.append('../../../common/')
...@@ -32,14 +32,16 @@ test00: Load firmware, verify firmware type and test mezzanine presence line. ...@@ -32,14 +32,16 @@ test00: Load firmware, verify firmware type and test mezzanine presence line.
def main (default_directory='.'): def main (default_directory='.'):
# Constants declaration # Constants declaration
TEST_NB = 0
#FMC_ADC_ADDR = '1a39:0004/1a39:0004@000B:0000' #FMC_ADC_ADDR = '1a39:0004/1a39:0004@000B:0000'
FMC_ADC_BITSTREAM = '../firmwares/spec_fmcadc100m14b4cha.bin' FMC_ADC_BITSTREAM = '../firmwares/spec_fmcadc100m14b4cha.bin'
FMC_ADC_BITSTREAM = os.path.join(default_directory, FMC_ADC_BITSTREAM)
EXPECTED_BITSTREAM_TYPE = 0x1 EXPECTED_BITSTREAM_TYPE = 0x1
start_test_time = time.time() start_test_time = time.time()
print "\n================================================================================" print "\n================================================================================"
print "==> Test00 start\n" print "==> Test%02d start\n" % TEST_NB
# SPEC object declaration # SPEC object declaration
print "Loading hardware access library and opening device.\n" print "Loading hardware access library and opening device.\n"
...@@ -70,10 +72,10 @@ def main (default_directory='.'): ...@@ -70,10 +72,10 @@ def main (default_directory='.'):
# Print carrier CSR registers # Print carrier CSR registers
carrier.print_csr() carrier.print_csr()
print "==> End of test00" print "==> End of test%02d" % TEST_NB
print "================================================================================" print "================================================================================"
end_test_time = time.time() end_test_time = time.time()
print "Test00 elapsed time: %.2f seconds\n" % (end_test_time-start_test_time) print "Test%02d elapsed time: %.2f seconds\n" % (TEST_NB, end_test_time-start_test_time)
if __name__ == '__main__' : if __name__ == '__main__' :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment