Hardware requirements
[sitara-dss-files/am57xx-dss-files.git] / am57xx-ddr.dss
1 /*
2  * Copyright (c) 2018, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
34 debugSessionDAP = ds.openSession("*","CS_DAP_DebugSS");
35 debugSessionDAP.target.connect();
37 /* Check ID_CODE register (address 0x4AE0C204) to determine which
38    AM57xx variant is being used */
39 try {
40         id_code = debugSessionDAP.memory.readWord(0,0x4AE0C204,false);
41 } catch(ex) {
42         print("\n Trouble reading ID_CODE.\n");
43 }
45 print("ID_CODE = 0x" + d2h(id_code));
47 // Check STD_FUSE_ID_2 register (address 0x4AE0C20C) for package type
48 try {
49         fuse_id_2 = debugSessionDAP.memory.readWord(0,0x4AE0C20C,false);
50 } catch(ex) {
51         print("\n Trouble reading STD_FUSE_ID_2.\n");
52 }
53 pkg_type = (fuse_id_2 & 0x00030000) >> 16;  // FUSE_ID_2[17:16] = pkg_type
55 switch(id_code) {
56         case 0x0B9BC02F:
57                 print("AM571x SR1.0 detected.\n");
58                 device_type = 571;
59                 break;
60         case 0x1B9BC02F:
61                 if(pkg_type == 1) {
62                         print("AM570x SR2.0 detected.\n");
63                         device_type = 570;
64                 } else if(pkg_type == 2) {
65                         print("AM571x SR2.0 detected.\n");
66                         device_type = 571;
67                 } else
68                         print("AM571x/AM570x SR2.0 unrecognized package type\n")
69                 break;
70         case 0x2B9BC02F:
71                 if(pkg_type == 1) {
72                         print("AM570x SR2.1 detected.\n");
73                         device_type = 570;
74                 } else if(pkg_type == 2) {
75                         print("AM571x SR2.1 detected.\n");
76                         device_type = 571;
77                 } else
78                         print("AM571x/AM570x SR2.1 unrecognized package type\n")
79                 break;
80         case 0x0B99002F:
81                 print("AM572x SR1.0 detected.\n");
82                 device_type = 572;
83                 break;
84         case 0x1B99002F:
85                 print("AM572x SR1.1 detected.\n");
86                 device_type = 572;
87                 break;
88         case 0x2B99002F:
89                 print("AM572x SR2.0 detected.\n");
90                 device_type = 572;
91                 break;
92         case 0x0BB5002F:
93                 print("AM574x SR1.0 detected.\n");
94                 device_type = 574;
95                 break;
96         default:
97                 print("Unable to identify which AM57xx variant.\n");
98                 debugSessionDAP.target.disconnect();
99                 throw("Terminating script.\n")
100                 break;
103 //Build a filename that includes date/time
104 var today = new Date();
105 var year4digit = today.getFullYear();
106 var month2digit = ("0" + (today.getMonth()+1)).slice(-2);
107 var day2digit = ("0" + today.getDate()).slice(-2);
108 var hour2digit = ("0" + today.getHours()).slice(-2);
109 var minutes2digit = ("0" + today.getMinutes()).slice(-2);
110 var seconds2digit = ("0" + today.getSeconds()).slice(-2);
111 var filename_date = '_' + year4digit + '-' + month2digit + '-' + day2digit + '_' + hour2digit + minutes2digit + seconds2digit;
112 var userHomeFolder = System.getProperty("user.home");
113 var filename = userHomeFolder + '/Desktop/' + 'am57xx-ddr' + filename_date + '.txt';
115 file = new java.io.FileWriter(filename);
117 if (device_type == 570) {
118         num_emifs = 1;
119 } else if (device_type == 571) {
120         num_emifs = 1;
121 } else if (device_type == 572) {
122         num_emifs = 2;
123 } else if (device_type == 574) {
124         num_emifs = 2;
125 } else {
126         throw("Error -- code shouldn't get here.")
129 // helper function to create 8-digit hex numbers in ascii format
130 function d2h(d) {
131         // bottom half
132         bottom = d & 0xFFFF;
133         bottom_ascii = ("0000" + bottom.toString(16)).slice(-4);
135         // top half
136         top = d >>> 16;  // unsigned right shift - avoids major sign issues...
137         top_ascii = ("0000" + top.toString(16)).slice(-4);
138         return (top_ascii + bottom_ascii);
141 // helper function to create decimal numbers in ascii format
142 function d2d(d) {return ((+d).toString());}
144 var newline = "\n";
146 file.write("********************** DPLL_DDR **********************" + newline + newline);
147 // CTRL_CORE_BOOTSTRAP
148 reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_BOOTSTRAP", 0x4A0026C4);
149 speedselect_pins = (reg_val >> 8) & 3;
150 switch (speedselect_pins) {
151         case 0:
152                 file.write("  * Reserved value latched by SYSBOOT[9:8]" + newline);
153                 input_clock = 0;
154                 break;
155         case 1:
156                 file.write("  * SPEEDSELECT = 20 MHz" + newline);
157                 input_clock = 20;
158                 break;
159         case 2:
160                 file.write("  * SPEEDSELECT = 27 MHz" + newline);
161                 input_clock = 27;
162                 break;
163         case 3:
164                 file.write("  * SPEEDSELECT = 19.2 MHz" + newline);
165                 input_clock = 19.2;
166                 break;
169 // CM_CLKSEL_DPLL_DDR
170 reg_val = printRegisterValue(debugSessionDAP, "CM_CLKSEL_DPLL_DDR", 0x4A00521C);
171 dpll_mult = (reg_val >> 8) & 0x7FF;
172 file.write("  * DPLL_MULT = " + d2d(dpll_mult) + " (x" + d2d(dpll_mult) + ")" + newline);
173 dpll_div = reg_val & 0x7F;
174 file.write("  * DPLL_DIV = " + d2d(dpll_div) + " (/" + d2d(dpll_div+1) + ")" + newline);
175 f_dpll_ddr = input_clock*2*dpll_mult/(dpll_div+1);
177 // CM_DIV_M2_DPLL_DDR
178 reg_val = printRegisterValue(debugSessionDAP, "CM_DIV_M2_DPLL_DDR", 0x4A005220);
179 if (reg_val & (1<<9))  // CLKST = 1
180         file.write("  * CLKST = 1: M2 output clock enabled" + newline);
181 else
182         file.write("  * CLKST = 0: M2 output clock disabled" + newline);;
183 div_m2 = reg_val & 0x1F;
184 file.write("  * DIVHS = " + d2d(div_m2) + " (/" + d2d(div_m2) + ")" + newline);
186 // CM_DIV_H11_DPLL_DDR
187 reg_val = printRegisterValue(debugSessionDAP, "CM_DIV_H11_DPLL_DDR", 0x4A005228);
188 if (reg_val & (1<<9))  // CLKST = 1
189         file.write("  * CLKST = 1: H11 output clock enabled" + newline);
190 else
191         file.write("  * CLKST = 0: H11 output clock disabled" + newline);;
192 div_h11 = reg_val & 0x1F;
193 file.write("  * DIVHS = " + d2d(div_h11) + " (/" + d2d(div_h11) + ")" + newline);
195 file.write(newline + "DPLL_DDR Summary" + newline);
196 file.write(" -> F_input = " + d2d(input_clock) + " MHz" + newline);
197 file.write(" -> F_dpll_ddr = " + d2d(f_dpll_ddr) + " MHz" + newline);
198 file.write(" -> CLKOUT_M2 = EMIF_PHY_GCLK = " + f_dpll_ddr / 2 / div_m2 + " MHz" + newline);
199 file.write(" -> CLKOUTX2_H11 = EMIF_DLL_GCLK = " + f_dpll_ddr / div_h11 + " MHz" + newline);
201 file.write(newline);
203 file.write("********************** DMM - LISA **********************" + newline + newline);
204 reg_val = printRegisterValue(debugSessionDAP, "DMM_LISA_MAP_0", 0x4E000040);
205 decodeLisaEntry(reg_val);
206 reg_val = printRegisterValue(debugSessionDAP, "DMM_LISA_MAP_1", 0x4E000044);
207 decodeLisaEntry(reg_val);
208 reg_val = printRegisterValue(debugSessionDAP, "DMM_LISA_MAP_2", 0x4E000048);
209 decodeLisaEntry(reg_val);
210 reg_val = printRegisterValue(debugSessionDAP, "DMM_LISA_MAP_3", 0x4E00004C);
211 decodeLisaEntry(reg_val);
212 file.write(newline);
214 file.write("********************** EMIF1 **********************" + newline + newline);
216 // CTRL_CORE_CONTROL_DDRCACH1_0
217 reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRCACH1_0", 0x4A002E30);
218 file.write("ddr1_casn, ddr1_rasn, ddr1_rst, ddr1_wen, ddr1_csn[0], ddr1_cke, ddr1_odt[0]" + newline);
219 InterpretDdrByte(reg_val, 3, 0);
220 file.write("ddr1_a[15:0]" + newline);
221 InterpretDdrByte(reg_val, 2, 0);
222 file.write("ddr1_ba[0], ddr1_ba[1], ddr1_ba[2]" + newline);
223 InterpretDdrByte(reg_val, 1, 0);
224 file.write("ddr1_ck, ddr1_nck" + newline);
225 InterpretDdrByte(reg_val, 0, 1);
226 file.write(newline);
228 // CTRL_CORE_CONTROL_DDRCH1_0
229 reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRCH1_0", 0x4A002E38);
230 file.write("ddr1_d[7:0], ddr1_dqm[0]" + newline);
231 InterpretDdrByte(reg_val, 3, 0);
232 file.write("ddr1_dqs[0], ddr1_dqsn[0]" + newline);
233 InterpretDdrByte(reg_val, 2, 1);
234 file.write("ddr1_d[15:8], ddr1_dqm[1]" + newline);
235 InterpretDdrByte(reg_val, 1, 0);
236 file.write("ddr1_dqs[1], ddr1_dqsn[1]" + newline);
237 InterpretDdrByte(reg_val, 0, 1);
238 file.write(newline);
240 // CTRL_CORE_CONTROL_DDRCH1_1
241 reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRCH1_1", 0x4A002E3C);
242 file.write("ddr1_d[23:16], ddr1_dqm[2]" + newline);
243 InterpretDdrByte(reg_val, 3, 0);
244 file.write("ddr1_dqs[2], ddr1_dqsn[2]" + newline);
245 InterpretDdrByte(reg_val, 2, 1);
246 file.write("ddr1_d[31:24], ddr1_dqm[3]" + newline);
247 InterpretDdrByte(reg_val, 1, 0);
248 file.write("ddr1_dqs[3], ddr1_dqsn[3]" + newline);
249 InterpretDdrByte(reg_val, 0, 1);
250 file.write(newline);
252 // CTRL_CORE_CONTROL_DDRCH1_2
253 reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRCH1_2", 0x4A002E48);
254 file.write("ddr1_ecc_d[7:0], ddr1_dqm_ecc" + newline);
255 InterpretDdrByte(reg_val, 2, 0);
256 file.write("ddr1_dqs_ecc, ddr1_dqsn_ecc" + newline);
257 InterpretDdrByte(reg_val, 1, 1);
258 file.write(newline);
260 // CTRL_CORE_CONTROL_DDRIO_0
261 reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRIO_0", 0x4A002E50);
262 file.write("ddr1_d[7:0], ddr1_d[15:8]" + newline);
263 InterpretDdrVref(reg_val, 15);
264 file.write("ddr1_d[23:16], ddr1_d[31:24], ddr1_ecc_d[7:0]" + newline);
265 InterpretDdrVref(reg_val, 10);
266 file.write(newline);
268 // If EMIF1 clock is enabled, print the registers
269 reg_val = debugSessionDAP.memory.readWord(0,0x4A008B30,false);
270 reg_val = reg_val >> 16;  // Check IDLEST (bits 17:16)
271 if (reg_val == 3)
272         file.write("EMIF1 is disabled." + newline);
273 else
274         printEmifRegs(0x4C000000);
276 if (num_emifs == 2)
278         file.write("********************** EMIF2 **********************" + newline + newline);
280         // CTRL_CORE_CONTROL_DDRCACH2_0
281         reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRCACH2_0", 0x4A002E34);
282         file.write("ddr2_casn, ddr2_rasn, ddr2_rst, ddr2_wen, ddr2_csn[0], ddr2_cke, ddr2_odt[0]" + newline);
283         InterpretDdrByte(reg_val, 3, 0);
284         file.write("ddr2_a[15:0]" + newline);
285         InterpretDdrByte(reg_val, 2, 0);
286         file.write("ddr2_ba[0], ddr2_ba[1], ddr2_ba[2]" + newline);
287         InterpretDdrByte(reg_val, 1, 0);
288         file.write("ddr2_ck, ddr2_nck" + newline);
289         InterpretDdrByte(reg_val, 0, 1);
290         file.write(newline);
292         // CTRL_CORE_CONTROL_DDRCH2_0
293         reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRCH2_0", 0x4A002E40);
294         file.write("ddr2_d[7:0], ddr2_dqm[0]" + newline);
295         InterpretDdrByte(reg_val, 3, 0);
296         file.write("ddr2_dqs[0], ddr2_dqsn[0]" + newline);
297         InterpretDdrByte(reg_val, 2, 1);
298         file.write("ddr2_d[15:8], ddr2_dqm[1]" + newline);
299         InterpretDdrByte(reg_val, 1, 0);
300         file.write("ddr2_dqs[1], ddr2_dqsn[1]" + newline);
301         InterpretDdrByte(reg_val, 0, 1);
302         file.write(newline);
304         // CTRL_CORE_CONTROL_DDRCH2_1
305         reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRCH2_1", 0x4A002E44);
306         file.write("ddr2_d[23:16], ddr2_dqm[2]" + newline);
307         InterpretDdrByte(reg_val, 3, 0);
308         file.write("ddr2_dqs[2], ddr2_dqsn[2]" + newline);
309         InterpretDdrByte(reg_val, 2, 1);
310         file.write("ddr2_d[31:24], ddr2_dqm[3]" + newline);
311         InterpretDdrByte(reg_val, 1, 0);
312         file.write("ddr2_dqs[3], ddr2_dqsn[3]" + newline);
313         InterpretDdrByte(reg_val, 0, 1);
314         file.write(newline);
316         // CTRL_CORE_CONTROL_DDRIO_1
317         reg_val = printRegisterValue(debugSessionDAP, "CTRL_CORE_CONTROL_DDRIO_1", 0x4A002E54);
318         file.write("ddr2_d[7:0], ddr2_d[15:8]" + newline);
319         InterpretDdrVref(reg_val, 22);
320         file.write("ddr2_d[23:16], ddr2_d[31:24]" + newline);
321         InterpretDdrVref(reg_val, 17);
322         file.write(newline);
324         // If EMIF2 clock is enabled, print the registers
325         reg_val = debugSessionDAP.memory.readWord(0,0x4A008B38,false);
326         reg_val = reg_val >> 16;  // Check IDLEST (bits 17:16)
327         if (reg_val == 3)
328                 file.write("EMIF2 is disabled." + newline);
329         else
330                 printEmifRegs(0x4D000000);
334 print("Data collection complete.");
336 file.close();
337 debugSessionDAP.target.disconnect();
338 print("Created file " + filename);
340 /* value is the contents read from the register
341    byte should be 0-3 where 0 is LSB and 3 is MSB
342 */
343 function InterpretDdrByte(value, byte_num, is_differential)
345         value = value >> (8*byte_num);
346         value = value & 0xFF;
348         weak_driver = value & 3;                // Bits 1:0
349         slew_rate = (value >> 2) & 7;   // Bits 4:2
350         impedance = (value >> 5) & 7;   // Bits 7:5
352         if(is_differential)
353         {
354                 switch (weak_driver) {
355                         case 0:
356                                 file.write("  * Pull logic is disabled" + newline);
357                                 break;
358                         case 1:
359                                 file.write("  * Pull-up selected for padp, pull-down selected for padn" + newline);
360                                 break;
361                         case 2:
362                                 file.write("  * Pull-down selected for padp, pull-up selected for padn" + newline);
363                                 break;
364                         case 3:
365                                 file.write("  * Maintain the previous output value" + newline);
366                                 break;
367                 }
368         } else
369         {
370                 switch (weak_driver) {
371                         case 0:
372                                 file.write("  * Pull logic is disabled" + newline);
373                                 break;
374                         case 1:
375                                 file.write("  * Pull-up selected" + newline);
376                                 break;
377                         case 2:
378                                 file.write("  * Pull-down selected" + newline);
379                                 break;
380                         case 3:
381                                 file.write("  * Maintain the previous output value" + newline);
382                                 break;
383                 }
384         }
385         file.write("  * Slew rate is " + slew_rate + ", where 0=fastest and 7=slowest" + newline);
387                 switch (impedance) {
388                 case 0:
389                         file.write("  * Output Impedance = 80 Ohms" + newline);
390                         break;
391                 case 1:
392                         file.write("  * Output Impedance = 60 Ohms" + newline);
393                         break;
394                 case 2:
395                         file.write("  * Output Impedance = 48 Ohms" + newline);
396                         break;
397                 case 3:
398                         file.write("  * Output Impedance = 40 Ohms" + newline);
399                         break;
400                 case 4:
401                         file.write("  * Output Impedance = 34 Ohms" + newline);
402                         break;
403                 default:
404                         file.write("  * Output Impedance = Reserved" + newline);
405                         break;
406         }
409 function InterpretDdrVref(value, start_bit)
411         value = value >> start_bit;
412         value = value & 0x1F;
414         if (value & 1)
415         {
416                 file.write("  * Internal VREF enabled" + newline);
417                 if (value & 0x10) file.write("  * Capacitor between Vbias and ground" + newline);
418                 if (value & 0x08) file.write("  * Capacitor between Vbias and vdds_ddr" + newline);
419                 tap0 = (value >> 2) & 1;
420                 tap1 = (value >> 1) & 1;
421                 ddr_tap = (tap1 << 1) | tap0;
423                 switch(ddr_tap) {
424                         case 0:
425                                 file.write("  * 2-uA VREF output drive capability" + newline);
426                                 break;
427                         case 1:
428                                 file.write("  * 4-uA VREF output drive capability" + newline);
429                                 break;
430                         case 2:
431                                 file.write("  * 8-uA VREF output drive capability" + newline);
432                                 break;
433                         case 3:
434                                 file.write("  * 32-uA VREF output drive capability" + newline);
435                                 break;
436                 }
437         }
438         else
439                 file.write("  * Internal VREF disabled" + newline);
442 function printEmifRegs(baseaddr)
444         if (baseaddr == 0x4C000000)
445                 reg_val = printRegisterValue(debugSessionDAP, "CTRL_WKUP_EMIF1_SDRAM_CONFIG_EXT", 0x4AE0C144);
446         else
447                 reg_val = printRegisterValue(debugSessionDAP, "CTRL_WKUP_EMIF2_SDRAM_CONFIG_EXT", 0x4AE0C148);
449         reg_val = printRegisterValue(debugSessionDAP, "EMIF_STATUS", baseaddr + 0x04);
450         file.write(newline);
452         reg_val = printRegisterValue(debugSessionDAP, "EMIF_SDRAM_CONFIG", baseaddr + 0x08);
453         reg_val = printRegisterValue(debugSessionDAP, "EMIF_SDRAM_CONFIG_2", baseaddr + 0x0C);
454         reg_val = printRegisterValue(debugSessionDAP, "EMIF_SDRAM_REFRESH_CONTROL", baseaddr + 0x10);
455         reg_val = printRegisterValue(debugSessionDAP, "EMIF_SDRAM_TIMING_1", baseaddr + 0x18);
456         reg_val = printRegisterValue(debugSessionDAP, "EMIF_SDRAM_TIMING_2", baseaddr + 0x20);
457         reg_val = printRegisterValue(debugSessionDAP, "EMIF_SDRAM_TIMING_3", baseaddr + 0x28);
458         reg_val = printRegisterValue(debugSessionDAP, "EMIF_READ_WRITE_LEVELING_RAMP_WINDOW", baseaddr + 0xD4);
459         reg_val = printRegisterValue(debugSessionDAP, "EMIF_READ_WRITE_LEVELING_RAMP_CONTROL", baseaddr + 0xD8);
460         reg_val = printRegisterValue(debugSessionDAP, "EMIF_READ_WRITE_LEVELING_CONTROL", baseaddr + 0xDC);
461         reg_val = printRegisterValue(debugSessionDAP, "EMIF_DDR_PHY_CONTROL_1", baseaddr + 0xE4);
462         file.write("  * Bits 4:0 READ_LATENCY = " + d2d(reg_val & 0x1F) + newline);
463         file.write("  * Bit 9 PHY_FAST_DLL_LOCK = " + d2d((reg_val >> 9)&1) + newline);
464         file.write("  * Bits 17:10 PHY_DLL_LOCK_DIFF = " + d2d((reg_val >> 10)&0xFF) + newline);
465         file.write("  * Bit 18 PHY_INVERT_CLKOUT = " + d2d((reg_val >> 18)&1) + newline);
466         file.write("  * Bit 19 PHY_DIS_CALIB_RST = " + d2d((reg_val >> 19)&1) + newline);
467         file.write("  * Bit 20 PHY_CLK_STALL_LEVEL = " + d2d((reg_val >> 20)&1) + newline);
468         file.write("  * Bit 21 PHY_HALF_DELAYS = " + d2d((reg_val >> 21)&1) + newline);
469         file.write("  * Bit 25 WRLVL_MASK = " + d2d((reg_val >> 25)&1) + newline);
470         file.write("  * Bit 26 RDLVLGATE_MASK = " + d2d((reg_val >> 26)&1) + newline);
471         file.write("  * Bit 27 RDLVL_MASK = " + d2d((reg_val >> 27)&1) + newline);
472         file.write(newline);
474         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_1 ", baseaddr + 0x200);
475         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_2 ", baseaddr + 0x208);
476         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_3 ", baseaddr + 0x210);
477         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_4 ", baseaddr + 0x218);
478         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_5 ", baseaddr + 0x220);
479         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_6 ", baseaddr + 0x228);
480         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_7 ", baseaddr + 0x230);
481         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_8 ", baseaddr + 0x238);
482         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_9 ", baseaddr + 0x240);
483         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_10", baseaddr + 0x248);
484         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_11", baseaddr + 0x250);
485         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_12", baseaddr + 0x258);
486         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_13", baseaddr + 0x260);
487         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_14", baseaddr + 0x268);
488         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_15", baseaddr + 0x270);
489         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_16", baseaddr + 0x278);
490         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_17", baseaddr + 0x280);
491         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_18", baseaddr + 0x288);
492         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_19", baseaddr + 0x290);
493         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_20", baseaddr + 0x298);
494         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_21", baseaddr + 0x2A0);
495         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_22", baseaddr + 0x2A8);
496         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_23", baseaddr + 0x2B0);
497         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_24", baseaddr + 0x2B8);
498         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_25", baseaddr + 0x2C0);
499         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_26", baseaddr + 0x2C8);
500         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_27", baseaddr + 0x2D0);
501         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_28", baseaddr + 0x2D8);
502         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_29", baseaddr + 0x2E0);
503         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_30", baseaddr + 0x2E8);
504         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_31", baseaddr + 0x2F0);
505         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_32", baseaddr + 0x2F8);
506         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_33", baseaddr + 0x300);
507         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_34", baseaddr + 0x308);
508         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_35", baseaddr + 0x310);
509         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_CONTROL_36", baseaddr + 0x318);
510         file.write(newline);
512         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_1 ", baseaddr + 0x144);
513         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_2 ", baseaddr + 0x148);
514         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_3 ", baseaddr + 0x14C);
515         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_4 ", baseaddr + 0x150);
516         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_5 ", baseaddr + 0x154);
517         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_6 ", baseaddr + 0x158);
518         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_7 ", baseaddr + 0x15C);
519         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_8 ", baseaddr + 0x160);
520         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_9 ", baseaddr + 0x164);
521         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_10", baseaddr + 0x168);
522         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_11", baseaddr + 0x16C);
523         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_12", baseaddr + 0x170);
524         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_13", baseaddr + 0x174);
525         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_14", baseaddr + 0x178);
526         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_15", baseaddr + 0x17C);
527         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_16", baseaddr + 0x180);
528         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_17", baseaddr + 0x184);
529         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_18", baseaddr + 0x188);
530         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_19", baseaddr + 0x19C);
531         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_20", baseaddr + 0x190);
532         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_21", baseaddr + 0x194);
533         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_22", baseaddr + 0x198);
534         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_23", baseaddr + 0x19C);
535         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_24", baseaddr + 0x1A0);
536         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_25", baseaddr + 0x1A4);
537         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_26", baseaddr + 0x1A8);
538         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_27", baseaddr + 0x1AC);
539         reg_val = printRegisterValue(debugSessionDAP, "EMIF_EXT_PHY_STATUS_28", baseaddr + 0x1B0);
540         file.write(newline);
543 function printRegisterValue(ds, name, addr)
545         value = ds.memory.readWord(0,addr,false);
546         value_string = d2h(value);
547         file.write(name + " = 0x" + value_string + newline);
548         return value; // return the register value for interrogation
551 function decodeLisaEntry(lisa_val)
553         // Don't print anything for unmapped entries
554         sdrc_map = (lisa_val >> 8) & 3;
555         if ( sdrc_map == 0 )
556                 return;
558         file.write("  * System Address Mapping = 0x" + d2h(lisa_val & 0xFF000000) + newline);
559         val = (lisa_val >> 20) & 7;
560         sys_size = Math.pow(2,val)*16;
561         file.write("  * Section Size = " + d2d(sys_size) + " MB" + newline);
563         sdrc_intl = (lisa_val >> 18) & 3;
564         if ( sdrc_map == 3 )
565         {
566                 file.write("  * Mapped to EMIF1 and EMIF2: ");
567                 if ( sdrc_intl == 0 ) file.write("Illegal combo of SDRC_INTL and SDRC_MAP");
568                 if ( sdrc_intl == 1 ) file.write("128-byte interleaving");
569                 if ( sdrc_intl == 2 ) file.write("256-byte interleaving");
570                 if ( sdrc_intl == 3 ) file.write("512-byte interleaving");
571                 file.write(newline);
572         }
573         else
574                 file.write("  * Mapped to EMIF" + d2d(sdrc_map) + newline);