From ec1d10b54c8d368da3442acfa6c4d647f88dee4f Mon Sep 17 00:00:00 2001
From: Leon Hiemstra <hiemstra@astron.nl>
Date: Thu, 13 Nov 2014 10:21:59 +0000
Subject: [PATCH] extra

---
 .../unb1_test/tb/python/tc_unb1_test.py       | 49 +++++++++++--------
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py b/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py
index 8645a2890a..c451fe452a 100644
--- a/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py
+++ b/boards/uniboard1/designs/unb1_test/tb/python/tc_unb1_test.py
@@ -102,7 +102,7 @@ def test_BG_to_DB(tc,io,cmd,use_pps=False):
 
     db_ram = []
     for s in tc.spNrs:
-        db_ram.append(Db.read_data_buffer(streamNr=s,vLevel=5))
+        db_ram.append(Db.read_data_buffer(streamNr=s,vLevel=9))
 
     if use_pps==True:
         Bg.write_enable_pps()
@@ -190,11 +190,7 @@ def test_info(tc,io,cmd):
     tc.append_log(1, '>>> %s' % help_text(tc,io,cmd))
     tc.append_log(3, '>>>')
 
-    #with node_io.NodeIO(tc.nodeImages, tc.base_ip) as temp_io:
     info = pi_system_info.PiSystemInfo(tc, io)
-    tc.append_log(1, '>>> reading REGMAPs')
-    info.make_register_info()
-    tc.append_log(3, '')
     info.read_system_info()
     tc.append_log(3, '')
     info.read_use_phy()
@@ -207,13 +203,23 @@ def test_info(tc,io,cmd):
     info.read_design_note()
     
     expected_design_name = tc.gpString
-    if cmd==3 and expected_design_name != '':
-            tc.set_section_id('Verify System Info - ')
-            tc.append_log(1, '>>> Verifying design_name == %s' % expected_design_name)
-            for name in design_name:
-                if (name != expected_design_name): 
-                    tc.set_result('FAILED')
-                    tc.append_log(2, '>>> design_name mismatch!! (%s != %s)' % (name,expected_design_name))
+    if expected_design_name != '':
+        tc.set_section_id('Verify System Info - ')
+        tc.append_log(1, '>>> Verifying design_name == %s' % expected_design_name)
+        for name in design_name:
+            if (name != expected_design_name): 
+                tc.set_result('FAILED')
+                tc.append_log(2, '>>> design_name mismatch!! (%s != %s)' % (name,expected_design_name))
+
+
+
+def read_regmap(tc,io,cmd):
+    tc.set_section_id('Update REGMAP - ')
+    info = pi_system_info.PiSystemInfo(tc, io)
+    tc.append_log(1, '>>> reading REGMAPs')
+    info.make_register_info()
+    tc.append_log(1, '>>> reload NodeIO class')
+    return node_io.NodeIO(tc.nodeImages, tc.base_ip)
 
 
     
@@ -270,15 +276,14 @@ def test_remu(tc,io,cmd):
     dummy_tc = test_case.Testcase('Dummy TB - ', '')
     dummy_tc.set_result('PASSED')
     
-    #with pi_remu.PiRemu(dummy_tc, io) as Remu:
     Remu = pi_remu.PiRemu(dummy_tc, io)
     try:
-            Remu.write_user_reconfigure()
+        Remu.write_user_reconfigure()
     except:
-            pass # ignoring FAILED
+        pass # ignoring FAILED
 
     if dummy_tc.get_result() == 'FAILED':
-            tc.append_log(1, 'Result=%s but ignoring this' % dummy_tc.get_result())
+        tc.append_log(1, 'Result=%s but ignoring this' % dummy_tc.get_result())
 
     tc.append_log(3, '')
 
@@ -339,8 +344,8 @@ def show_example(tc,io,cmd):
 Cmd = {
     0 : ('SLEEP1' , sleep,        'Sleep 1 second',''),
     1 : ('SLEEP5' , sleep,        'Sleep 5 seconds',''),
-    2 : ('INFO'   , test_info,    'using pi_system_info to read system info (access PIO_SYSTEM_INFO)',''),
-    3 : ('INFO+'  , test_info,    'using pi_system_info to read system info (access PIO_SYSTEM_INFO)','(-s for expected design_name)'),
+    2 : ('REGMAP' , read_regmap,  'using pi_system_info to read register info (access PIO_SYSTEM_INFO) and store REGMAPs',''),
+    3 : ('INFO'   , test_info,    'using pi_system_info to read system info (access PIO_SYSTEM_INFO)','(-s for expected design_name)'),
     4 : ('FLASH'  , test_flash,   'using pi_epcs to program/verify flash','(-s for .rbf file)'),
     5 : ('SENSORS', test_sensors, 'using pi_unb_sens to readout sensors (access REG_UNB_SENS)',''),
     6 : ('PPSH'   , test_ppsh,    'using pi_ppsh to read PPSH capture count (access PIO_PPS)',''),
@@ -395,7 +400,7 @@ tc.append_log(3, '>>>')
     
 
 # Create access object for nodes
-#io = node_io.NodeIO(tc.nodeImages, tc.base_ip)
+io = node_io.NodeIO(tc.nodeImages, tc.base_ip)
 
 
 
@@ -411,8 +416,10 @@ while rep < tc.repeat:
         if cmd > len(Cmd): cmd = 100 # default to help_text
         tc.append_log(3, 'Next command: %d : %s: %s' % (cmd,Cmd[cmd][0],Cmd[cmd][2]))
 
-        with node_io.NodeIO(tc.nodeImages, tc.base_ip) as temp_io:
-            Cmd[cmd][1](tc,temp_io,cmd)
+        if cmd == 2: # reload node_io:
+            io = Cmd[cmd][1](tc,io,cmd)
+        else:
+            Cmd[cmd][1](tc,io,cmd)
 
 
 
-- 
GitLab