diff options
author | William Wilgus <me.theuser@yahoo.com> | 2017-11-14 05:17:02 +0100 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2018-07-26 04:00:28 +0200 |
commit | 056d4b0ec044aedd14bd657f4b6a6f8e96c127e3 (patch) | |
tree | 0f20a0d32fc0308bb557a8324556aea0b7b443ca /firmware | |
parent | ff7d2bdee1e25148bc9775f9b804424c8e1a37b9 (diff) | |
download | rockbox-056d4b0ec044aedd14bd657f4b6a6f8e96c127e3.tar.gz rockbox-056d4b0ec044aedd14bd657f4b6a6f8e96c127e3.zip |
Update AS3525 v1/v2 debug menu; add scrolling and missing frequencies
On the clip zip most debug menu items get cut off and there is
no way to read most of the debug menu items.
This patch makes the menu button scroll the text 1 character
to the right with each press and the center (select) button
re-aligns the text
Adds SSP frequency(v2) & register
Adds SD slot frequency(v2)
Change-Id: If4705d6790e25061931ca654062e22fc2e0a6f16
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/arm/as3525/debug-as3525.c | 380 |
1 files changed, 188 insertions, 192 deletions
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index bb731242aa..c4c4a7f4dc 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "button.h" | 25 | #include "action.h" |
26 | #include "lcd.h" | 26 | #include "lcd.h" |
27 | #include "font.h" | 27 | #include "font.h" |
28 | #include "cpu.h" | 28 | #include "cpu.h" |
@@ -31,7 +31,13 @@ | |||
31 | #include "adc.h" | 31 | #include "adc.h" |
32 | #include "storage.h" | 32 | #include "storage.h" |
33 | 33 | ||
34 | #define DEBUG_CANCEL BUTTON_LEFT | 34 | #define DEBUG_CANCEL ACTION_STD_CANCEL |
35 | #define DEBUG_NEXT ACTION_STD_NEXT | ||
36 | #define DEBUG_LEFT_JUSTIFY ACTION_STD_OK | ||
37 | #define DEBUG_LEFT_SCROLL ACTION_STD_MENU | ||
38 | |||
39 | /* if the possiblity exists to divide by zero protect with this macro */ | ||
40 | #define DIV_FINITE(dividend, divisor) ((divisor == 0)? divisor : dividend/divisor) | ||
35 | 41 | ||
36 | #define ON "Enabled" | 42 | #define ON "Enabled" |
37 | #define OFF "Disabled" | 43 | #define OFF "Disabled" |
@@ -41,21 +47,28 @@ | |||
41 | #define CP15_IC (1<<12) /* icache off/on */ | 47 | #define CP15_IC (1<<12) /* icache off/on */ |
42 | 48 | ||
43 | #define CLK_MAIN 24000000 /* 24 MHz */ | 49 | #define CLK_MAIN 24000000 /* 24 MHz */ |
50 | #define D_MHZ 1000000 | ||
51 | #define D_KHZ 1000 | ||
44 | 52 | ||
45 | #define CLK_PLLA 0 | 53 | enum dbg_clocks |
46 | #define CLK_PLLB 1 | 54 | { |
47 | #define CLK_PROC 2 | 55 | CLK_PLLA = 0x0, |
48 | #define CLK_FCLK 3 | 56 | CLK_PLLB, |
49 | #define CLK_EXTMEM 4 | 57 | CLK_PROC, |
50 | #define CLK_PCLK 5 | 58 | CLK_FCLK, |
51 | #define CLK_IDE 6 | 59 | CLK_EXTMEM, |
52 | #define CLK_I2C 7 | 60 | CLK_PCLK, |
53 | #define CLK_I2SI 8 | 61 | CLK_IDE, |
54 | #define CLK_I2SO 9 | 62 | CLK_I2C, |
55 | #define CLK_DBOP 10 | 63 | CLK_I2SI, |
56 | #define CLK_SD_MCLK_NAND 11 | 64 | CLK_I2SO, |
57 | #define CLK_SD_MCLK_MSD 12 | 65 | CLK_DBOP, |
58 | #define CLK_USB 13 | 66 | CLK_SD_MCLK_NAND, |
67 | CLK_SD_MCLK_MSD, | ||
68 | CLK_SD_SLOT, | ||
69 | CLK_USB, | ||
70 | CLK_SSP, | ||
71 | }; | ||
59 | 72 | ||
60 | #define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04)) | 73 | #define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04)) |
61 | #define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04)) | 74 | #define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04)) |
@@ -79,6 +92,7 @@ static int calc_freq(int clk) | |||
79 | unsigned int postdiv = ((unsigned int)CGU_PROC>>4) & 0xf; | 92 | unsigned int postdiv = ((unsigned int)CGU_PROC>>4) & 0xf; |
80 | unsigned int u_out_div; | 93 | unsigned int u_out_div; |
81 | #if CONFIG_CPU == AS3525 | 94 | #if CONFIG_CPU == AS3525 |
95 | |||
82 | switch(clk) { | 96 | switch(clk) { |
83 | /* clk_main = clk_int = 24MHz oscillator */ | 97 | /* clk_main = clk_int = 24MHz oscillator */ |
84 | case CLK_PLLA: | 98 | case CLK_PLLA: |
@@ -89,10 +103,9 @@ static int calc_freq(int clk) | |||
89 | u_out_div = ((CGU_PLLA>>13) & 0x3); /* bits 13:14 */ | 103 | u_out_div = ((CGU_PLLA>>13) & 0x3); /* bits 13:14 */ |
90 | if (u_out_div == 3) /* for 11 NO=4 */ | 104 | if (u_out_div == 3) /* for 11 NO=4 */ |
91 | u_out_div=4; | 105 | u_out_div=4; |
92 | if(u_out_div) /* NO = 0 not allowed */ | 106 | /* NO = 0 not allowed */ |
93 | return ((2 * (CGU_PLLA & 0xff))*CLK_MAIN)/ | 107 | return DIV_FINITE(((2 * (CGU_PLLA & 0xff))*CLK_MAIN), |
94 | (((CGU_PLLA>>8) & 0x1f)*u_out_div); | 108 | (((CGU_PLLA>>8) & 0x1f)*u_out_div)); |
95 | return 0; | ||
96 | case CLK_PLLB: | 109 | case CLK_PLLB: |
97 | if(CGU_PLLBSUP & (1<<3)) | 110 | if(CGU_PLLBSUP & (1<<3)) |
98 | return 0; | 111 | return 0; |
@@ -101,12 +114,12 @@ static int calc_freq(int clk) | |||
101 | u_out_div = ((CGU_PLLB>>13) & 0x3); /* bits 13:14 */ | 114 | u_out_div = ((CGU_PLLB>>13) & 0x3); /* bits 13:14 */ |
102 | if (u_out_div == 3) /* for 11 NO=4 */ | 115 | if (u_out_div == 3) /* for 11 NO=4 */ |
103 | u_out_div=4; | 116 | u_out_div=4; |
104 | if(u_out_div) /* NO = 0 not allowed */ | 117 | /* NO = 0 not allowed */ |
105 | return ((2 * (CGU_PLLB & 0xff))*CLK_MAIN)/ | 118 | return DIV_FINITE(((2 * (CGU_PLLB & 0xff))*CLK_MAIN), |
106 | (((CGU_PLLB>>8) & 0x1f)*u_out_div); | 119 | (((CGU_PLLB>>8) & 0x1f)*u_out_div)); |
107 | return 0; | 120 | #else /* AS3525v2 */ |
108 | #else | ||
109 | int od, f, r; | 121 | int od, f, r; |
122 | |||
110 | /* AS3525v2 */ | 123 | /* AS3525v2 */ |
111 | switch(clk) { | 124 | switch(clk) { |
112 | case CLK_PLLA: | 125 | case CLK_PLLA: |
@@ -126,7 +139,20 @@ static int calc_freq(int clk) | |||
126 | r = ((CGU_PLLB >> 7) & 0x7) + 1; | 139 | r = ((CGU_PLLB >> 7) & 0x7) + 1; |
127 | od = (CGU_PLLB >> 10) & 1 ? 2 : 1; | 140 | od = (CGU_PLLB >> 10) & 1 ? 2 : 1; |
128 | return (CLK_MAIN / 2) * f / (r * od); | 141 | return (CLK_MAIN / 2) * f / (r * od); |
129 | #endif | 142 | |
143 | case CLK_SD_SLOT: | ||
144 | switch(CGU_SDSLOT & 3) { | ||
145 | case 0: | ||
146 | return CLK_MAIN/(((CGU_SDSLOT>>2)& 0xf)+1); | ||
147 | case 1: | ||
148 | return calc_freq(CLK_PLLA)/(((CGU_SDSLOT>>2)& 0xf)+1); | ||
149 | case 2: | ||
150 | return calc_freq(CLK_PLLB)/(((CGU_SDSLOT>>2)& 0xf)+1); | ||
151 | default: | ||
152 | return 0; | ||
153 | } | ||
154 | #endif /* CONFIG_CPU == AS3525 */ | ||
155 | |||
130 | case CLK_PROC: | 156 | case CLK_PROC: |
131 | #if CONFIG_CPU == AS3525 /* not in arm926-ejs */ | 157 | #if CONFIG_CPU == AS3525 /* not in arm926-ejs */ |
132 | if (!(read_cp15()>>30)) /* fastbus */ | 158 | if (!(read_cp15()>>30)) /* fastbus */ |
@@ -150,10 +176,10 @@ static int calc_freq(int clk) | |||
150 | case CLK_EXTMEM: | 176 | case CLK_EXTMEM: |
151 | #if CONFIG_CPU == AS3525 | 177 | #if CONFIG_CPU == AS3525 |
152 | switch(CGU_PERI & 3) { | 178 | switch(CGU_PERI & 3) { |
153 | #else | 179 | #else /* as3525v2 */ |
154 | /* bits 1:0 of CGU_PERI always read as 0 and source = FCLK */ | 180 | /* bits 1:0 of CGU_PERI always read as 0 and source = FCLK */ |
155 | switch(3) { | 181 | switch(3) { |
156 | #endif | 182 | #endif /* CONFIG_CPU == AS3525 */ |
157 | case 0: | 183 | case 0: |
158 | return CLK_MAIN/(((CGU_PERI>>2)& 0xf)+1); | 184 | return CLK_MAIN/(((CGU_PERI>>2)& 0xf)+1); |
159 | case 1: | 185 | case 1: |
@@ -179,7 +205,8 @@ static int calc_freq(int clk) | |||
179 | } | 205 | } |
180 | case CLK_I2C: | 206 | case CLK_I2C: |
181 | ams_i2c_get_debug_cpsr(&u_out_div); | 207 | ams_i2c_get_debug_cpsr(&u_out_div); |
182 | return calc_freq(CLK_PCLK)/(u_out_div); | 208 | /* NO = 0 not allowed */ |
209 | return DIV_FINITE(calc_freq(CLK_PCLK), (u_out_div)); | ||
183 | case CLK_I2SI: | 210 | case CLK_I2SI: |
184 | switch((CGU_AUDIO>>12) & 3) { | 211 | switch((CGU_AUDIO>>12) & 3) { |
185 | case 0: | 212 | case 0: |
@@ -219,7 +246,12 @@ static int calc_freq(int clk) | |||
219 | return calc_freq(CLK_PCLK); | 246 | return calc_freq(CLK_PCLK); |
220 | else | 247 | else |
221 | return calc_freq(CLK_PCLK)/(((MCI_SD & 0xff)+1)*2); | 248 | return calc_freq(CLK_PCLK)/(((MCI_SD & 0xff)+1)*2); |
222 | #endif | 249 | #else /* as3525v2 */ |
250 | case CLK_SSP: | ||
251 | /* NO = 0 not allowed */ | ||
252 | return DIV_FINITE(calc_freq(CLK_PCLK), SSP_CPSR); | ||
253 | #endif /* CONFIG_CPU == AS3525 */ | ||
254 | |||
223 | case CLK_USB: | 255 | case CLK_USB: |
224 | switch(CGU_USB & 3) { /* 0-> div=1 other->div=1/(2*n) */ | 256 | switch(CGU_USB & 3) { /* 0-> div=1 other->div=1/(2*n) */ |
225 | case 0: | 257 | case 0: |
@@ -245,174 +277,172 @@ static int calc_freq(int clk) | |||
245 | } | 277 | } |
246 | } | 278 | } |
247 | 279 | ||
280 | static bool dbg_btn(bool *done, int *x) | ||
281 | { | ||
282 | bool cont = !*done; | ||
283 | if (cont) | ||
284 | { | ||
285 | lcd_update(); | ||
286 | int button = get_action(CONTEXT_STD,HZ/10); | ||
287 | switch(button) | ||
288 | { | ||
289 | case DEBUG_CANCEL: | ||
290 | *done = true; | ||
291 | case DEBUG_NEXT: | ||
292 | cont = false; | ||
293 | case DEBUG_LEFT_JUSTIFY: | ||
294 | (*x) = 0; | ||
295 | sleep(HZ/5); | ||
296 | break; | ||
297 | case DEBUG_LEFT_SCROLL: | ||
298 | (*x)--; | ||
299 | } | ||
300 | } | ||
301 | lcd_clear_display(); | ||
302 | return cont; | ||
303 | } | ||
304 | |||
248 | bool dbg_hw_info(void) | 305 | bool dbg_hw_info(void) |
249 | { | 306 | { |
250 | int line; | 307 | int line; |
308 | int x = 0; | ||
309 | bool done = false; | ||
310 | |||
251 | lcd_clear_display(); | 311 | lcd_clear_display(); |
252 | lcd_setfont(FONT_SYSFIXED); | 312 | lcd_setfont(FONT_SYSFIXED); |
253 | 313 | ||
254 | while(1) | 314 | while(!done) |
255 | { | 315 | { |
256 | while(1) | 316 | while(dbg_btn(&done, &x)) |
257 | { | 317 | { |
258 | #if defined(SANSA_C200V2) || defined(SANSA_FUZEV2) || \ | 318 | #if defined(SANSA_C200V2) || defined(SANSA_FUZEV2) || \ |
259 | defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP) | 319 | defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP) |
260 | lcd_clear_display(); | 320 | |
261 | line = 0; | 321 | line = 0; |
262 | lcd_puts(0, line++, "[Submodel:]"); | 322 | lcd_puts(x, line++, "[Submodel:]"); |
263 | #if defined(SANSA_C200V2) | 323 | #if defined(SANSA_C200V2) |
264 | lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant); | 324 | lcd_putsf(x, line++, "C200v2 variant %d", c200v2_variant); |
265 | #elif defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || \ | 325 | #elif defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || \ |
266 | defined(SANSA_CLIPZIP) | 326 | defined(SANSA_CLIPZIP) |
267 | lcd_putsf(0, line++, "AMSv2 variant %d", amsv2_variant); | 327 | lcd_putsf(x, line++, "AMSv2 variant %d", amsv2_variant); |
268 | #endif | 328 | #endif |
269 | lcd_update(); | ||
270 | int btn = button_get_w_tmo(HZ/10); | ||
271 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
272 | goto end; | ||
273 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
274 | break; | ||
275 | } | 329 | } |
276 | while(1) | 330 | while(dbg_btn(&done, &x)) |
277 | { | 331 | { |
278 | #endif | 332 | #endif |
279 | lcd_clear_display(); | ||
280 | line = 0; | 333 | line = 0; |
281 | lcd_puts(0, line++, "[Clock Frequencies:]"); | 334 | lcd_puts(x, line++, "[Clock Frequencies:]"); |
282 | lcd_puts(0, line++, " SET ACTUAL"); | 335 | lcd_puts(x, line++, " SET ACTUAL"); |
283 | #if CONFIG_CPU == AS3525 | 336 | #if CONFIG_CPU == AS3525 |
284 | lcd_putsf(0, line++, "922T:%s %3dMHz", | 337 | lcd_putsf(x, line++, "922T:%s %3dMHz", |
285 | (!(read_cp15()>>30)) ? "FAST " : | 338 | (!(read_cp15()>>30)) ? "FAST " : |
286 | (read_cp15()>>31) ? "ASYNC" : "SYNC ", | 339 | (read_cp15()>>31) ? "ASYNC" : "SYNC ", |
287 | #else | 340 | #else /* as3525v2 */ |
288 | lcd_putsf(0, line++, "926ejs: %3dMHz", | 341 | lcd_putsf(x, line++, "926ejs: %3dMHz", |
289 | #endif | 342 | #endif |
290 | calc_freq(CLK_PROC)/1000000); | 343 | calc_freq(CLK_PROC)/D_MHZ); |
291 | lcd_putsf(0, line++, "PLLA:%3dMHz %3dMHz", AS3525_PLLA_FREQ/1000000, | 344 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "PLLA", AS3525_PLLA_FREQ/D_MHZ, |
292 | calc_freq(CLK_PLLA)/1000000); | 345 | calc_freq(CLK_PLLA)/D_MHZ); |
293 | lcd_putsf(0, line++, "PLLB: %3dMHz", calc_freq(CLK_PLLB)/1000000); | 346 | lcd_putsf(x, line++, "PLLB: %3dMHz", calc_freq(CLK_PLLB)/D_MHZ); |
294 | lcd_putsf(0, line++, "FCLK: %3dMHz", calc_freq(CLK_FCLK)/1000000); | 347 | lcd_putsf(x, line++, "FCLK: %3dMHz", calc_freq(CLK_FCLK)/D_MHZ); |
295 | lcd_putsf(0, line++, "DRAM:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000, | 348 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "DRAM", AS3525_PCLK_FREQ/D_MHZ, |
296 | calc_freq(CLK_EXTMEM)/1000000); | 349 | calc_freq(CLK_EXTMEM)/D_MHZ); |
297 | lcd_putsf(0, line++, "PCLK:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000, | 350 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "PCLK", AS3525_PCLK_FREQ/D_MHZ, |
298 | calc_freq(CLK_PCLK)/1000000); | 351 | calc_freq(CLK_PCLK)/D_MHZ); |
299 | 352 | ||
300 | #if LCD_HEIGHT < 176 /* clip */ | 353 | #if LCD_HEIGHT < 176 /* clip */ |
301 | lcd_update(); | ||
302 | int btn = button_get_w_tmo(HZ/10); | ||
303 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
304 | goto end; | ||
305 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
306 | break; | ||
307 | } | 354 | } |
308 | while(1) | 355 | while(dbg_btn(&done, &x)) |
309 | { | 356 | { |
310 | lcd_clear_display(); | ||
311 | line = 0; | 357 | line = 0; |
312 | #endif /* LCD_HEIGHT < 176 */ | 358 | #endif /* LCD_HEIGHT < 176 */ |
313 | 359 | ||
314 | lcd_putsf(0, line++, "IDE :%3dMHz %3dMHz", AS3525_IDE_FREQ/1000000, | 360 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "IDE ", AS3525_IDE_FREQ/D_MHZ, |
315 | calc_freq(CLK_IDE)/1000000); | 361 | calc_freq(CLK_IDE)/D_MHZ); |
316 | lcd_putsf(0, line++, "DBOP:%3dMHz %3dMHz", AS3525_DBOP_FREQ/1000000, | 362 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "DBOP", AS3525_DBOP_FREQ/D_MHZ, |
317 | calc_freq(CLK_DBOP)/1000000); | 363 | calc_freq(CLK_DBOP)/D_MHZ); |
318 | lcd_putsf(0, line++, "I2C :%3dkHz %3dkHz", AS3525_I2C_FREQ/1000, | 364 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "I2C ", AS3525_I2C_FREQ/D_KHZ, |
319 | calc_freq(CLK_I2C)/1000); | 365 | calc_freq(CLK_I2C)/D_KHZ); |
320 | lcd_putsf(0, line++, "I2SI: %s %3dMHz", (CGU_AUDIO & (1<<23)) ? | 366 | lcd_putsf(x, line++, "I2SI: %s %3dMHz", (CGU_AUDIO & (1<<23)) ? |
321 | "on " : "off" , calc_freq(CLK_I2SI)/1000000); | 367 | "on " : "off" , calc_freq(CLK_I2SI)/D_MHZ); |
322 | lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ? | 368 | lcd_putsf(x, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ? |
323 | "on " : "off", calc_freq(CLK_I2SO)/1000000); | 369 | "on " : "off", calc_freq(CLK_I2SO)/D_MHZ); |
324 | #if CONFIG_CPU == AS3525 | 370 | #if CONFIG_CPU == AS3525 |
325 | struct ams_sd_debug_info dbg; | 371 | struct ams_sd_debug_info dbg; |
326 | ams_sd_get_debug_info(&dbg); | 372 | ams_sd_get_debug_info(&dbg); |
327 | 373 | ||
328 | lcd_putsf(0, line++, "SD :%3dMHz %3dMHz", | 374 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "SD ", |
329 | ((AS3525_IDE_FREQ/ 1000000) / | 375 | ((AS3525_IDE_FREQ/ D_MHZ) / |
330 | ((dbg.mci_nand & MCI_CLOCK_BYPASS)? 1:(((dbg.mci_nand & 0xff)+1) * 2))), | 376 | ((dbg.mci_nand & MCI_CLOCK_BYPASS)? 1:(((dbg.mci_nand & 0xff)+1) * 2))), |
331 | calc_freq(CLK_SD_MCLK_NAND)/1000000); | 377 | calc_freq(CLK_SD_MCLK_NAND)/D_MHZ); |
332 | #ifdef HAVE_MULTIDRIVE | 378 | #ifdef HAVE_MULTIDRIVE |
333 | lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz", | 379 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "uSD ", |
334 | ((AS3525_PCLK_FREQ/ 1000000) / | 380 | ((AS3525_PCLK_FREQ/ D_MHZ) / |
335 | ((dbg.mci_sd & MCI_CLOCK_BYPASS) ? 1: (((dbg.mci_sd & 0xff) + 1) * 2))), | 381 | ((dbg.mci_sd & MCI_CLOCK_BYPASS) ? 1: (((dbg.mci_sd & 0xff) + 1) * 2))), |
336 | calc_freq(CLK_SD_MCLK_MSD)/1000000); | 382 | calc_freq(CLK_SD_MCLK_MSD)/D_MHZ); |
337 | #endif | 383 | #endif |
384 | |||
385 | #else /*AS3525v2*/ | ||
386 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "SD ", AS3525_SDSLOT_FREQ/D_MHZ, | ||
387 | calc_freq(CLK_SD_SLOT)/D_MHZ); | ||
388 | long freq_ssp = calc_freq(CLK_SSP); | ||
389 | if (freq_ssp >= D_MHZ) | ||
390 | lcd_putsf(x, line++, "%s:%3dMHz %3dMHz", "SSP ", AS3525_SSP_FREQ/D_MHZ, | ||
391 | calc_freq(CLK_SSP)/D_MHZ); | ||
392 | else | ||
393 | lcd_putsf(x, line++, "SSP :%3dMHz %3dKHz", AS3525_SSP_FREQ/D_MHZ, | ||
394 | calc_freq(CLK_SSP)/D_KHZ); | ||
338 | #endif /* CONFIG_CPU == AS3525 */ | 395 | #endif /* CONFIG_CPU == AS3525 */ |
339 | lcd_putsf(0, line++, "USB : %3dMHz", calc_freq(CLK_USB)/1000000); | 396 | lcd_putsf(x, line++, "USB : %3dMHz", calc_freq(CLK_USB)/D_MHZ); |
340 | 397 | ||
341 | #if LCD_HEIGHT < 176 /* clip */ | 398 | #if LCD_HEIGHT < 176 /* clip */ |
342 | lcd_update(); | ||
343 | int btn = button_get_w_tmo(HZ/10); | ||
344 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
345 | goto end; | ||
346 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
347 | break; | ||
348 | } | 399 | } |
349 | while(1) | 400 | while(dbg_btn(&done, &x)) |
350 | { | 401 | { |
351 | lcd_clear_display(); | 402 | lcd_clear_display(); |
352 | line = 0; | 403 | line = 0; |
353 | #endif /* LCD_HEIGHT < 176 */ | 404 | #endif /* LCD_HEIGHT < 176 */ |
354 | 405 | ||
355 | lcd_putsf(0, line++, "MMU : %s CVDDP:%4d", (read_cp15() & CP15_MMU) ? | 406 | lcd_putsf(x, line++, "MMU : %s CVDDP:%4d", (read_cp15() & CP15_MMU) ? |
356 | " on" : "off", adc_read(ADC_CVDD) * 25); | 407 | " on" : "off", adc_read(ADC_CVDD) * 25); |
357 | lcd_putsf(0, line++, "Icache:%s Dcache:%s", | 408 | lcd_putsf(x, line++, "Icache:%s Dcache:%s", |
358 | (read_cp15() & CP15_IC) ? " on" : "off", | 409 | (read_cp15() & CP15_IC) ? " on" : "off", |
359 | (read_cp15() & CP15_DC) ? " on" : "off"); | 410 | (read_cp15() & CP15_DC) ? " on" : "off"); |
360 | |||
361 | lcd_update(); | ||
362 | int btn = button_get_w_tmo(HZ/10); | ||
363 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
364 | goto end; | ||
365 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
366 | break; | ||
367 | } | 411 | } |
368 | while(1) | 412 | while(dbg_btn(&done, &x)) |
369 | { | 413 | { |
370 | lcd_clear_display(); | ||
371 | line = 0; | 414 | line = 0; |
372 | 415 | ||
373 | lcd_putsf(0, line++, "CGU_PLLA :%8x", (unsigned int)(CGU_PLLA)); | 416 | lcd_putsf(x, line++, "CGU_PLLA :%8x", (unsigned int)(CGU_PLLA)); |
374 | lcd_putsf(0, line++, "CGU_PLLB :%8x", (unsigned int)(CGU_PLLB)); | 417 | lcd_putsf(x, line++, "CGU_PLLB :%8x", (unsigned int)(CGU_PLLB)); |
375 | lcd_putsf(0, line++, "CGU_PROC :%8x", (unsigned int)(CGU_PROC)); | 418 | lcd_putsf(x, line++, "CGU_PROC :%8x", (unsigned int)(CGU_PROC)); |
376 | lcd_putsf(0, line++, "CGU_PERI :%8x", (unsigned int)(CGU_PERI)); | 419 | lcd_putsf(x, line++, "CGU_PERI :%8x", (unsigned int)(CGU_PERI)); |
377 | lcd_putsf(0, line++, "CGU_IDE :%8x", (unsigned int)(CGU_IDE)); | 420 | lcd_putsf(x, line++, "CGU_IDE :%8x", (unsigned int)(CGU_IDE)); |
378 | lcd_putsf(0, line++, "CGU_DBOP :%8x", (unsigned int)(CGU_DBOP)); | 421 | lcd_putsf(x, line++, "CGU_DBOP :%8x", (unsigned int)(CGU_DBOP)); |
379 | lcd_putsf(0, line++, "CGU_AUDIO :%8x", (unsigned int)(CGU_AUDIO)); | 422 | lcd_putsf(x, line++, "CGU_AUDIO :%8x", (unsigned int)(CGU_AUDIO)); |
380 | lcd_putsf(0, line++, "CGU_USB :%8x", (unsigned int)(CGU_USB)); | 423 | lcd_putsf(x, line++, "CGU_USB :%8x", (unsigned int)(CGU_USB)); |
381 | 424 | ||
382 | #if LCD_HEIGHT < 176 /* clip */ | 425 | #if LCD_HEIGHT < 176 /* clip */ |
383 | lcd_update(); | ||
384 | int btn = button_get_w_tmo(HZ/10); | ||
385 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
386 | goto end; | ||
387 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
388 | break; | ||
389 | } | 426 | } |
390 | while(1) | 427 | while(dbg_btn(&done, &x)) |
391 | { | 428 | { |
392 | lcd_clear_display(); | ||
393 | line = 0; | 429 | line = 0; |
394 | #endif /* LCD_HEIGHT < 176 */ | 430 | #endif /* LCD_HEIGHT < 176 */ |
431 | |||
395 | unsigned int i2c_cpsr; | 432 | unsigned int i2c_cpsr; |
396 | ams_i2c_get_debug_cpsr(&i2c_cpsr); | 433 | ams_i2c_get_debug_cpsr(&i2c_cpsr); |
397 | lcd_putsf(0, line++, "I2C2_CPSR :%8x", i2c_cpsr); | 434 | lcd_putsf(x, line++, "I2C2_CPSR :%8x", i2c_cpsr); |
398 | #if CONFIG_CPU == AS3525 | 435 | #if CONFIG_CPU == AS3525 |
399 | lcd_putsf(0, line++, "MCI_NAND :%8x", (unsigned int)(MCI_NAND)); | 436 | lcd_putsf(x, line++, "MCI_NAND :%8x", (unsigned int)(MCI_NAND)); |
400 | lcd_putsf(0, line++, "MCI_SD :%8x", (unsigned int)(MCI_SD)); | 437 | lcd_putsf(x, line++, "MCI_SD :%8x", (unsigned int)(MCI_SD)); |
401 | #else | 438 | #else /* as3525v2 */ |
402 | lcd_putsf(0, line++, "CGU_MEMSTK:%8x", (unsigned int)(CGU_MEMSTICK)); | 439 | lcd_putsf(x, line++, "CGU_MEMSTK:%8x", (unsigned int)(CGU_MEMSTICK)); |
403 | lcd_putsf(0, line++, "CGU_SDSLOT:%8x", (unsigned int)(CGU_SDSLOT)); | 440 | lcd_putsf(x, line++, "CGU_SDSLOT:%8x", (unsigned int)(CGU_SDSLOT)); |
404 | #endif | 441 | #endif |
405 | 442 | lcd_putsf(x, line++, "SSP_CPSR :%8x", (unsigned int)(SSP_CPSR)); | |
406 | lcd_update(); | ||
407 | int btn = button_get_w_tmo(HZ/10); | ||
408 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
409 | goto end; | ||
410 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
411 | break; | ||
412 | } | 443 | } |
413 | } | 444 | } |
414 | 445 | ||
415 | end: | ||
416 | lcd_setfont(FONT_UI); | 446 | lcd_setfont(FONT_UI); |
417 | return false; | 447 | return false; |
418 | } | 448 | } |
@@ -429,38 +459,29 @@ void adc_set_voltage_mux(int channel) | |||
429 | 459 | ||
430 | bool dbg_ports(void) | 460 | bool dbg_ports(void) |
431 | { | 461 | { |
432 | int line, btn, i; | 462 | int line, i; |
433 | 463 | int x = 0; | |
464 | bool done = false; | ||
465 | lcd_clear_display(); | ||
434 | lcd_setfont(FONT_SYSFIXED); | 466 | lcd_setfont(FONT_SYSFIXED); |
435 | 467 | ||
436 | while(1) | 468 | while(!done) |
437 | { | 469 | { |
438 | lcd_clear_display(); | 470 | while(dbg_btn(&done, &x)) |
439 | |||
440 | while(1) | ||
441 | { | 471 | { |
442 | line = 0; | 472 | line = 0; |
443 | lcd_puts(0, line++, "[GPIO Vals and Dirs]"); | 473 | lcd_puts(x, line++, "[GPIO Vals and Dirs]"); |
444 | lcd_putsf(0, line++, "GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR); | 474 | lcd_putsf(x, line++, "%s: %2x DIR: %2x", "GPIOA", GPIOA_DATA, GPIOA_DIR); |
445 | lcd_putsf(0, line++, "GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR); | 475 | lcd_putsf(x, line++, "%s: %2x DIR: %2x", "GPIOB", GPIOB_DATA, GPIOB_DIR); |
446 | lcd_putsf(0, line++, "GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR); | 476 | lcd_putsf(x, line++, "%s: %2x DIR: %2x", "GPIOC", GPIOC_DATA, GPIOC_DIR); |
447 | lcd_putsf(0, line++, "GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR); | 477 | lcd_putsf(x, line++, "%s: %2x DIR: %2x", "GPIOD", GPIOD_DATA, GPIOD_DIR); |
448 | lcd_putsf(0, line++, "CCU_IO:%8x", CCU_IO); | 478 | lcd_putsf(x, line++, "CCU_IO:%8x", CCU_IO); |
449 | #ifdef DEBUG_DBOP | 479 | #ifdef DEBUG_DBOP |
450 | lcd_puts(0, line++, "[DBOP_DIN]"); | 480 | lcd_puts(x, line++, "[DBOP_DIN]"); |
451 | lcd_putsf(0, line++, "DBOP_DIN: %4x", dbop_debug()); | 481 | lcd_putsf(x, line++, "DBOP_DIN: %4x", dbop_debug()); |
452 | #endif | 482 | #endif |
453 | lcd_puts(0, line++, "[CP15]"); | 483 | lcd_puts(x, line++, "[CP15]"); |
454 | lcd_putsf(0, line++, "CP15: 0x%8x", read_cp15()); | 484 | lcd_putsf(x, line++, "CP15: 0x%8x", read_cp15()); |
455 | lcd_update(); | ||
456 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | ||
457 | break; | ||
458 | |||
459 | btn = button_get_w_tmo(HZ/10); | ||
460 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
461 | goto end; | ||
462 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
463 | break; | ||
464 | } | 485 | } |
465 | 486 | ||
466 | #if CONFIG_CPU == AS3525 /* as3525v2 channels are different */ | 487 | #if CONFIG_CPU == AS3525 /* as3525v2 channels are different */ |
@@ -516,72 +537,47 @@ bool dbg_ports(void) | |||
516 | #endif | 537 | #endif |
517 | 538 | ||
518 | lcd_clear_display(); | 539 | lcd_clear_display(); |
519 | while(1) | 540 | while(dbg_btn(&done, &x)) |
520 | { | 541 | { |
521 | line = 0; | 542 | line = 0; |
522 | 543 | ||
523 | for(i=0; i<5; i++) | 544 | for(i=0; i<5; i++) |
524 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i) * 5); | 545 | lcd_putsf(x, line++, "%s: %d mV", adc_name[i], adc_read(i) * 5); |
525 | for(; i<8; i++) | 546 | for(; i<8; i++) |
526 | if(adc_name[i]) | 547 | if(adc_name[i]) |
527 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], | 548 | lcd_putsf(x, line++, "%s: %d mV", adc_name[i], |
528 | adc_read(i) * BATTEMP_UNIT); | 549 | adc_read(i) * BATTEMP_UNIT); |
529 | #if LCD_HEIGHT < 176 /* clip */ | 550 | #if LCD_HEIGHT < 176 /* clip */ |
530 | lcd_update(); | ||
531 | |||
532 | btn = button_get_w_tmo(HZ/10); | ||
533 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
534 | goto end; | ||
535 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
536 | break; | ||
537 | } | 551 | } |
538 | lcd_clear_display(); | 552 | while(dbg_btn(&done, &x)) |
539 | while(1) | ||
540 | { | 553 | { |
541 | line = 0; | 554 | line = 0; |
542 | #endif /* LCD_HEIGHT < 176 */ | 555 | #endif /* LCD_HEIGHT < 176 */ |
543 | for(i=8; i<10; i++) | 556 | for(i=8; i<10; i++) |
544 | if(adc_name[i]) | 557 | if(adc_name[i]) |
545 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i)); | 558 | lcd_putsf(x, line++, "%s: %d mV", adc_name[i], adc_read(i)); |
546 | for(; i<12; i++) | 559 | for(; i<12; i++) |
547 | if(adc_name[i]) | 560 | if(adc_name[i]) |
548 | lcd_putsf(0, line++, "%s: %d uA", adc_name[i], adc_read(i)); | 561 | lcd_putsf(x, line++, "%s: %d uA", adc_name[i], adc_read(i)); |
549 | #if CONFIG_CPU == AS3525 /* different units */ | 562 | #if CONFIG_CPU == AS3525 /* different units */ |
550 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i)*5/2); | 563 | lcd_putsf(x, line++, "%s: %d mV", adc_name[i], adc_read(i)*5/2); |
551 | #elif CONFIG_CPU == AS3525v2 | 564 | #elif CONFIG_CPU == AS3525v2 |
552 | for(; i<16; i++) | 565 | for(; i<16; i++) |
553 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i)); | 566 | lcd_putsf(x, line++, "%s: %d mV", adc_name[i], adc_read(i)); |
554 | #endif | 567 | #endif |
555 | |||
556 | lcd_update(); | ||
557 | |||
558 | btn = button_get_w_tmo(HZ/10); | ||
559 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
560 | goto end; | ||
561 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
562 | break; | ||
563 | } | 568 | } |
564 | #if CONFIG_CPU == AS3525v2 /*extend AS3543 voltage registers*/ | 569 | #if CONFIG_CPU == AS3525v2 /*extend AS3543 voltage registers*/ |
565 | lcd_clear_display(); | 570 | while(dbg_btn(&done, &x)) |
566 | while(1) | ||
567 | { | 571 | { |
568 | line = 0; | 572 | line = 0; |
569 | for(i=1; i<9; i++){ | 573 | for(i=1; i<9; i++){ |
570 | adc_set_voltage_mux(i); /*change the voltage mux to a new channel*/ | 574 | adc_set_voltage_mux(i); /*change the voltage mux to a new channel*/ |
571 | lcd_putsf(0, line++, "%s: %d mV", adc_mux_name[i], adc_read(5) * 5); | 575 | lcd_putsf(x, line++, "%s: %d mV", adc_mux_name[i], adc_read(5) * 5); |
572 | } | 576 | } |
573 | lcd_update(); | ||
574 | |||
575 | btn = button_get_w_tmo(HZ/10); | ||
576 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
577 | goto end; | ||
578 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
579 | break; | ||
580 | } | 577 | } |
581 | #endif | 578 | #endif |
582 | } | 579 | } |
583 | 580 | ||
584 | end: | ||
585 | lcd_setfont(FONT_UI); | 581 | lcd_setfont(FONT_UI); |
586 | return false; | 582 | return false; |
587 | } | 583 | } |
@@ -614,4 +610,4 @@ int get_cpu_voltage_setting(void) | |||
614 | 610 | ||
615 | return value; | 611 | return value; |
616 | } | 612 | } |
617 | #endif /* HAVE_ADJUSTABLE_CPU_VOLTAGE */ | 613 | #endif /* HAVE_ADJUSTABLE_CPU_VOLTAGE */ \ No newline at end of file |