Conditionally switch back to DAP_M3
authorBrad Griffis <bgriffis@ti.com>
Tue, 23 Apr 2019 20:07:53 +0000 (15:07 -0500)
committerBrad Griffis <bgriffis@ti.com>
Tue, 23 Apr 2019 20:07:53 +0000 (15:07 -0500)
am335x-ddr-analysis.dss

index 076a05990e989b970914ecc16c230eaf5062c9ae..5d46f68024eab550dcca9293b47e436c132e1b18 100644 (file)
@@ -83,6 +83,7 @@ var userHomeFolder = System.getProperty("user.home");
 var filename = userHomeFolder + '/Desktop/' + 'am335x-ddr-analysis' + filename_date + '.txt';
 
 debugSessionDAP = ds.openSession("*","CS_DAP_M3");
+use_dap_m3 = 1;
 
 try {
        debugSessionDAP.target.connect();
@@ -99,6 +100,7 @@ if (value == 0)
        debugSessionDAP.target.disconnect();
        debugSessionDAP = ds.openSession("*","CS_DAP_DebugSS");
        debugSessionDAP.target.connect();
+       use_dap_m3 = 0;
 }
 
 var original_CM_WKUP_DEBUGSS_CLKCTRL = debugSessionDAP.memory.readWord(0,0x44e00414,false);
@@ -246,10 +248,12 @@ if (original_CM_PER_L3_CLKSTCTRL & 1<<2) {
                file.write(" = 0x" + d2h(reg_val) + "\n"); // Raw Reg Val
        }
 
-       // Close (Main) DAP session and use M3 DAP to view Control Registers
-       debugSessionDAP.target.disconnect();
-       debugSessionDAP = ds.openSession("*","CS_DAP_M3");
-       debugSessionDAP.target.connect();
+       if ( use_dap_m3 == 1 ) {
+               // Close (Main) DAP session and use M3 DAP to view Control Registers
+               debugSessionDAP.target.disconnect();
+               debugSessionDAP = ds.openSession("*","CS_DAP_M3");
+               debugSessionDAP.target.connect();
+       }
        
        // Restore CM_WKUP_DEBUGSS_CLKCTRL[MODULEMODE]
        if ( (original_CM_WKUP_DEBUGSS_CLKCTRL & 3) == 0 ) {