diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-07-02 05:16:40 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-07-02 05:16:40 +0000 |
commit | fe23dc8f15e9d01ea634d10b334984f1d8760007 (patch) | |
tree | 5e12734e3f510c393ca272048f5425435ea26bf3 /apps | |
parent | 36de1a4d084da18af22d47a435a4eebcf3c50fb2 (diff) | |
download | rockbox-fe23dc8f15e9d01ea634d10b334984f1d8760007.tar.gz rockbox-fe23dc8f15e9d01ea634d10b334984f1d8760007.zip |
Improved CPU clock setup for PP502x. PP5020 and PP5022 are not register compatible here, so define the PP5022 targets properly, and introduce a CPU_PP502x macro for easier family check. Improves stability on PP5020 (less freezing, tested with Mini G1) and reduces clock change penalty (500us on PP5020; uses the relock bit on PP5022).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13763 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index fe7d5b584b..086ca9e3a7 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -405,6 +405,34 @@ static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device, | |||
405 | #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */ | 405 | #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */ |
406 | 406 | ||
407 | #ifndef SIMULATOR | 407 | #ifndef SIMULATOR |
408 | #ifdef CPU_PP502x | ||
409 | static int perfcheck(void) | ||
410 | { | ||
411 | int result; | ||
412 | int old_level = set_irq_level(HIGHEST_IRQ_LEVEL); | ||
413 | |||
414 | asm ( | ||
415 | "mov %[res], #0 \n" | ||
416 | "ldr r0, [%[timr]] \n" | ||
417 | "add r0, r0, %[tmo] \n" | ||
418 | "1: \n" | ||
419 | "add %[res], %[res], #1 \n" | ||
420 | "ldr r1, [%[timr]] \n" | ||
421 | "cmp r1, r0 \n" | ||
422 | "bmi 1b \n" | ||
423 | : | ||
424 | [res]"=&r"(result) | ||
425 | : | ||
426 | [timr]"r"(&USEC_TIMER), | ||
427 | [tmo]"r"(10226) | ||
428 | : | ||
429 | "r0", "r1" | ||
430 | ); | ||
431 | set_irq_level(old_level); | ||
432 | return result; | ||
433 | } | ||
434 | #endif | ||
435 | |||
408 | #ifdef HAVE_LCD_BITMAP | 436 | #ifdef HAVE_LCD_BITMAP |
409 | static bool dbg_hw_info(void) | 437 | static bool dbg_hw_info(void) |
410 | { | 438 | { |
@@ -535,7 +563,7 @@ static bool dbg_hw_info(void) | |||
535 | if (action_userabort(TIMEOUT_BLOCK)) | 563 | if (action_userabort(TIMEOUT_BLOCK)) |
536 | return false; | 564 | return false; |
537 | } | 565 | } |
538 | #elif CONFIG_CPU == PP5020 | 566 | #elif defined(CPU_PP502x) |
539 | char buf[32]; | 567 | char buf[32]; |
540 | char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff, | 568 | char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff, |
541 | (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff, | 569 | (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff, |
@@ -553,6 +581,10 @@ static bool dbg_hw_info(void) | |||
553 | 581 | ||
554 | snprintf(buf, sizeof(buf), "PP version: %s", pp_version); | 582 | snprintf(buf, sizeof(buf), "PP version: %s", pp_version); |
555 | lcd_puts(0, 2, buf); | 583 | lcd_puts(0, 2, buf); |
584 | |||
585 | snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck()); | ||
586 | lcd_puts(0, 3, buf); | ||
587 | |||
556 | lcd_update(); | 588 | lcd_update(); |
557 | 589 | ||
558 | while(1) | 590 | while(1) |
@@ -1020,7 +1052,7 @@ bool dbg_ports(void) | |||
1020 | return false; | 1052 | return false; |
1021 | } | 1053 | } |
1022 | 1054 | ||
1023 | #elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5024 | 1055 | #elif defined(CPU_PP502x) |
1024 | 1056 | ||
1025 | unsigned int gpio_a, gpio_b, gpio_c, gpio_d; | 1057 | unsigned int gpio_a, gpio_b, gpio_c, gpio_d; |
1026 | unsigned int gpio_e, gpio_f, gpio_g, gpio_h; | 1058 | unsigned int gpio_e, gpio_f, gpio_g, gpio_h; |
@@ -1066,6 +1098,17 @@ bool dbg_ports(void) | |||
1066 | lcd_puts(0, line++, buf); | 1098 | lcd_puts(0, line++, buf); |
1067 | snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l); | 1099 | snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l); |
1068 | lcd_puts(0, line++, buf); | 1100 | lcd_puts(0, line++, buf); |
1101 | line++; | ||
1102 | |||
1103 | snprintf(buf, sizeof(buf), "CLOCK_SRC: %08lx", inl(0x60006020)); | ||
1104 | lcd_puts(0, line++, buf); | ||
1105 | snprintf(buf, sizeof(buf), "PLL_CONTROL: %08lx", inl(0x60006034)); | ||
1106 | lcd_puts(0, line++, buf); | ||
1107 | snprintf(buf, sizeof(buf), "PLL_STATUS: %08lx", inl(0x6000603c)); | ||
1108 | lcd_puts(0, line++, buf); | ||
1109 | snprintf(buf, sizeof(buf), "DEV_PLL: %08lx", inl(0x70000020)); | ||
1110 | lcd_puts(0, line++, buf); | ||
1111 | |||
1069 | #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) | 1112 | #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) |
1070 | line++; | 1113 | line++; |
1071 | snprintf(buf, sizeof(buf), "ADC_BATTERY: %02x", adc_read(ADC_BATTERY)); | 1114 | snprintf(buf, sizeof(buf), "ADC_BATTERY: %02x", adc_read(ADC_BATTERY)); |
@@ -1297,7 +1340,7 @@ static bool dbg_cpufreq(void) | |||
1297 | 1340 | ||
1298 | snprintf(buf, sizeof(buf), "boost_counter: %d", get_cpu_boost_counter()); | 1341 | snprintf(buf, sizeof(buf), "boost_counter: %d", get_cpu_boost_counter()); |
1299 | lcd_puts(0, line++, buf); | 1342 | lcd_puts(0, line++, buf); |
1300 | 1343 | ||
1301 | lcd_update(); | 1344 | lcd_update(); |
1302 | button = get_action(CONTEXT_STD,HZ/10); | 1345 | button = get_action(CONTEXT_STD,HZ/10); |
1303 | 1346 | ||