From f86d7bcd329012fab497e2360a9e7515d9cdf097 Mon Sep 17 00:00:00 2001 From: theseven Date: Thu, 11 Mar 2010 03:07:51 +0000 Subject: [PATCH] Nano2G __dbg_hw_info (courtesy of Franz-Josef Haider) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25111 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/s5l8700/debug-s5l8700.c | 118 +++++++++++++++++++-- .../target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 2 +- 2 files changed, 109 insertions(+), 11 deletions(-) diff --git a/firmware/target/arm/s5l8700/debug-s5l8700.c b/firmware/target/arm/s5l8700/debug-s5l8700.c index 51321760e..fc8b58240 100644 --- a/firmware/target/arm/s5l8700/debug-s5l8700.c +++ b/firmware/target/arm/s5l8700/debug-s5l8700.c @@ -27,6 +27,13 @@ #include "lcd.h" #include "font.h" #include "sprintf.h" +#include "storage.h" +#include "action.h" +#ifdef IPOD_NANO2G +#include "power.h" +#include "pmu-target.h" +#include "nand-target.h" +#endif /* Skeleton for adding target specific debug info to the debug menu */ @@ -35,35 +42,126 @@ snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf); \ } while(0) +extern int lcd_type; +extern uint32_t nand_type[4]; bool __dbg_hw_info(void) { char buf[50]; int line; + int i; +#ifdef IPOD_NANO2G + unsigned int state; + const unsigned int max_states=2; + int nand_bank_count; + struct storage_info info; + const struct nand_device_info_type *nand_devicetype[4]; + nand_get_info(&info); + nand_bank_count = 0; + for(i=0;i<4;i++) + { + nand_devicetype[i] = nand_get_device_type(i); + if(nand_devicetype[i] != NULL) nand_bank_count++; + } + state=0; +#endif lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); + state=0; + while(1) { - while(1) - { lcd_clear_display(); line = 0; - + /* _DEBUG_PRINTF statements can be added here to show debug info */ +#ifdef IPOD_NANO2G + + if(state == 0) + { + _DEBUG_PRINTF("CPU:"); + _DEBUG_PRINTF("current_tick: %d", (unsigned int)current_tick); + line++; + + _DEBUG_PRINTF("LCD:"); + _DEBUG_PRINTF("type: %d, %s", lcd_type, lcd_type ? "(7) LDS176" : "(2) ILI9320"); + line++; + + _DEBUG_PRINTF("NAND:"); + _DEBUG_PRINTF("banks: %d",nand_bank_count); + + for(i=0;i<4;i++) + { + if(nand_devicetype[i] != NULL) + { + _DEBUG_PRINTF("bank: %d, id: %08X", i, (unsigned int)(*nand_devicetype[i]).id); + } + } + + _DEBUG_PRINTF("sectors: %d", info.num_sectors); + _DEBUG_PRINTF("sector size: %d", info.sector_size); + _DEBUG_PRINTF("last disk activity: %d", (unsigned int)nand_last_disk_activity()); + } + else if(state==1) + { + _DEBUG_PRINTF("PMU:"); + for(i=0;i<7;i++) + { + if(i == 1) + { + _DEBUG_PRINTF("ldo %d: %dmV (CLICKWHEEL)",i,900 + pmu_read(0x2d + (i << 1))*100); + } + else if(i == 3) + { + _DEBUG_PRINTF("ldo %d: %dmV (AUDIO)",i,900 + pmu_read(0x2d + (i << 1))*100); + } + else if(i == 4) + { + _DEBUG_PRINTF("ldo %d: %dmV (NAND)",i,900 + pmu_read(0x2d + (i << 1))*100); + } + else + { + _DEBUG_PRINTF("ldo %d: %dmV",i,900 + pmu_read(0x2d + (i << 1))*100); + } + } + _DEBUG_PRINTF("cpu voltage: %dmV",625 + pmu_read(0x1e)*25); + _DEBUG_PRINTF("memory voltage: %dmV",625 + pmu_read(0x22)*25); + line++; + _DEBUG_PRINTF("charging: %s", charging_state() ? "true" : "false"); + _DEBUG_PRINTF("backlight: %s", pmu_read(0x29) ? "on" : "off"); + _DEBUG_PRINTF("brightness value: %d", pmu_read(0x28)); + } + else + { + state=0; + } + +#else _DEBUG_PRINTF("__dbg_hw_info"); +#endif - lcd_update(); - int btn = button_get_w_tmo(HZ/10); - if(btn == (DEBUG_CANCEL|BUTTON_REL)) - goto end; - else if(btn == (BUTTON_PLAY|BUTTON_REL)) - break; + lcd_update(); + switch(get_action(CONTEXT_STD,HZ/20)) + { + case ACTION_STD_PREV: + if(state!=0) state--; + break; + + case ACTION_STD_NEXT: + if(state!=max_states-1) + { + state++; + } + break; + + case ACTION_STD_CANCEL: + lcd_setfont(FONT_UI); + return false; } } -end: lcd_setfont(FONT_UI); return false; } diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c index c430a327a..e29708f40 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c @@ -60,7 +60,7 @@ /** globals **/ -static int lcd_type; +int lcd_type; /* also needed in debug-s5l8700.c */ static int xoffset; /* needed for flip */ /** hardware access functions */ -- 2.11.4.GIT