/* * Copyright (c) 2006-2014, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ function d2h(d) {return ("00000000" + (d).toString(16)).slice(-8);} function printRegisterValue(ds, name, addr) { value = ds.memory.readWord(0,addr,false); value_string = d2h(value); file.write(name + " = 0x" + value_string + "\n"); return value; // return the register value for interrogation } function getRegisterValue(ds, addr) { return ds.memory.readWord(0,addr,false); } // Build a filename that includes date/time var today = new Date(); var year4digit = today.getFullYear(); var month2digit = ("0" + (today.getMonth()+1)).slice(-2); var day2digit = ("0" + today.getDate()).slice(-2); var hour2digit = ("0" + today.getHours()).slice(-2); var minutes2digit = ("0" + today.getMinutes()).slice(-2); var seconds2digit = ("0" + today.getSeconds()).slice(-2); var filename_date = '_' + year4digit + '-' + month2digit + '-' + day2digit + '_' + hour2digit + minutes2digit + seconds2digit; var userHomeFolder = System.getProperty("user.home"); var filename = userHomeFolder + '/Desktop/' + 'am335x-ds0-analysis' + filename_date + '.txt'; debugSessionDAP = ds.openSession("*","CS_DAP_M3"); try { debugSessionDAP.target.connect(); } catch (ex) { print("\n ERROR: Could not connect to DAP_M3.\n"); } file = new java.io.FileWriter(filename); var reg_val; // PRM_MPU: PM_MPU_PWRSTST reg_val = printRegisterValue(debugSessionDAP, "PRM_MPU: PM_MPU_PWRSTST", 0x44E00E04); if ( reg_val == 0 ) { file.write(" * Cortex A8 is OFF.\n"); } else { file.write(" * ERROR: Cortex A8 is still on!\n"); } // PRM_GFX: PM_GFX_PWRSTST reg_val = printRegisterValue(debugSessionDAP, "PRM_GFX: PM_GFX_PWRSTST", 0x44E01110); if ( reg_val == 0 ) { file.write(" * SGX530 is OFF.\n"); } else { file.write(" * ERROR: SGX530 is still on!\n"); } // PRM_PER: PM_PER_PWRSTST reg_val = printRegisterValue(debugSessionDAP, "PRM_PER: PM_PER_PWRSTST", 0x44E00C08); if ( reg_val == 0x00200001 ) { file.write(" * PER domain in retention (OCMC RAM retained).\n"); } else if ( reg_val&3 == 3) { file.write(" * ERROR: PER domain still on!\n"); // CM_PER: CM_PER_L4LS_CLKSTCTRL reg_val = printRegisterValue(debugSessionDAP, "CM_PER: CM_PER_L4LS_CLKSTCTRL", 0x44E00000); if ( reg_val & 1<<28 ) {file.write(" * ERROR: TIMER6 active!\n");} if ( reg_val & 1<<27 ) {file.write(" * ERROR: TIMER5 active!\n");} if ( reg_val & 1<<25 ) {file.write(" * ERROR: SPI active!\n");} if ( reg_val & 1<<24 ) {file.write(" * ERROR: I2C active!\n");} if ( reg_val & 1<<21 ) {file.write(" * ERROR: GPIO3 active!\n");} if ( reg_val & 1<<20 ) {file.write(" * ERROR: GPIO2 active!\n");} if ( reg_val & 1<<19 ) {file.write(" * ERROR: GPIO1 active!\n");} if ( reg_val & 1<<17 ) {file.write(" * ERROR: LCDC active!\n");} if ( reg_val & 1<<16 ) {file.write(" * ERROR: TIMER4 active!\n");} if ( reg_val & 1<<15 ) {file.write(" * ERROR: TIMER3 active!\n");} if ( reg_val & 1<<14 ) {file.write(" * ERROR: TIMER2 active!\n");} if ( reg_val & 1<<13 ) {file.write(" * ERROR: TIMER7 active!\n");} if ( reg_val & 1<<11 ) {file.write(" * ERROR: CAN active!\n");} if ( reg_val & 1<<10 ) {file.write(" * ERROR: UART active!\n");} if ( reg_val & 1<<8 ) {file.write(" * ERROR: L4LS active!\n");} // CM_PER: CM_PER_L3_CLKSTCTRL reg_val = printRegisterValue(debugSessionDAP, "CM_PER: CM_PER_L3_CLKSTCTRL", 0x44E0000C); if ( reg_val & 1<<7 ) {file.write(" * ERROR: MCASP active!\n");} if ( reg_val & 1<<6 ) {file.write(" * ERROR: CPTS_RFT active!\n");} if ( reg_val & 1<<4 ) {file.write(" * ERROR: L3 active!\n");} if ( reg_val & 1<<3 ) {file.write(" * ERROR: MMC active!\n");} if ( reg_val & 1<<2 ) {file.write(" * ERROR: EMIF active!\n");} } else { file.write(" * ERROR: Manually inspect PER domain. Unexpected combo.\n"); } file.close(); print("Created file " + filename); /*************************************************************************************** Create CSV File that dumps out padconf data for use in conjunction with the spreadsheet from: http://processors.wiki.ti.com/index.php/Optimizing_AM335x_IO_Power_in_DeepSleep0 ****************************************************************************************/ var filename = userHomeFolder + '/Desktop/' + 'am335x-ds0-padconf' + filename_date + '.csv'; file = new java.io.FileWriter(filename); var ds0_padconf_regs = [ 0x44E10800, 0x44E10804, 0x44E10808, 0x44E1080c, 0x44E10810, 0x44E10814, 0x44E10818, 0x44E1081c, 0x44E10820, 0x44E10824, 0x44E10828, 0x44E1082c, 0x44E10830, 0x44E10834, 0x44E10838, 0x44E1083c, 0x44E10840, 0x44E10844, 0x44E10848, 0x44E1084c, 0x44E10850, 0x44E10854, 0x44E10858, 0x44E1085c, 0x44E10860, 0x44E10864, 0x44E10868, 0x44E1086c, 0x44E10870, 0x44E10874, 0x44E10878, 0x44E1087c, 0x44E10880, 0x44E10884, 0x44E10888, 0x44E1088c, 0x44E10890, 0x44E10894, 0x44E10898, 0x44E1089c, 0x44E108a0, 0x44E108a4, 0x44E108a8, 0x44E108ac, 0x44E108b0, 0x44E108b4, 0x44E108b8, 0x44E108bc, 0x44E108c0, 0x44E108c4, 0x44E108c8, 0x44E108cc, 0x44E108d0, 0x44E108d4, 0x44E108d8, 0x44E108dc, 0x44E108e0, 0x44E108e4, 0x44E108e8, 0x44E108ec, 0x44E108f0, 0x44E108f4, 0x44E108f8, 0x44E108fc, 0x44E10900, 0x44E10904, 0x44E10908, 0x44E1090c, 0x44E10910, 0x44E10914, 0x44E10918, 0x44E1091c, 0x44E10920, 0x44E10924, 0x44E10928, 0x44E1092c, 0x44E10930, 0x44E10934, 0x44E10938, 0x44E1093c, 0x44E10940, 0x44E10944, 0x44E10948, 0x44E1094c, 0x44E10950, 0x44E10954, 0x44E10958, 0x44E1095c, 0x44E10960, 0x44E10964, 0x44E10968, 0x44E1096c, 0x44E10970, 0x44E10974, 0x44E10978, 0x44E1097c, 0x44E10980, 0x44E10984, 0x44E10988, 0x44E1098c, 0x44E10990, 0x44E10994, 0x44E10998, 0x44E1099c, 0x44E109a0, 0x44E109a4, 0x44E109a8, 0x44E109ac, 0x44E109b0, 0x44E109b4, 0x44E109b8, 0x44E109bc, 0x44E109c0, 0x44E109c4, 0x44E109c8, 0x44E109d0, 0x44E109d4, 0x44E109d8, 0x44E109dc, 0x44E109e0, 0x44E109e4, 0x44E109e8, 0x44E109ec, 0x44E109f0, 0x44E109f8, 0x44E10a00, 0x44E109f4, 0x44E10a04, 0x44E10a08, 0x44E10a0c, 0x44E10a10, 0x44E10a14, 0x44E10a18, 0x44E10a1c, 0x44E10a20, 0x44E10a24, 0x44E10a28, 0x44E10a2c, 0x44E10a30, 0x44E10a34]; // Column Headers for CSV file.write("Address,dts offset,Raw Reg Val,Mux Mode,Pull,RxActive,Slew\r\n"); // Fill out one line per loop iteration for (i=0; i