1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Heikki Hannikainen
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
29 #include "debug_menu.h"
35 #include "powermgmt.h"
39 #include "mp3_playback.h"
42 #include "statusbar.h"
53 #include "lcd-remote.h"
56 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
64 #include "eeprom_24cxx.h"
65 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
68 #if (CONFIG_STORAGE & STORAGE_ATA)
77 #ifdef HAVE_LCD_BITMAP
78 #include "scrollbar.h"
79 #include "peakmeter.h"
82 #if CONFIG_CODEC == SWCODEC
84 #include "buffering.h"
86 #if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
90 #ifdef IRIVER_H300_SERIES
91 #include "pcf50606.h" /* for pcf50606_read */
98 #if CONFIG_RTC == RTC_PCF50605
101 #include "appevents.h"
103 #if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 \
104 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 || CONFIG_CPU == JZ4732 \
105 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2
106 #include "debug-target.h"
109 #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \
110 || (CONFIG_CPU == AS3525 && defined(CONFIG_CHARGING)) \
111 || CONFIG_CPU == AS3525v2
117 #include "pmu-target.h"
121 #include "usb_core.h"
124 #if defined(IPOD_ACCESSORY_PROTOCOL)
128 /*---------------------------------------------------*/
129 /* SPECIAL DEBUG STUFF */
130 /*---------------------------------------------------*/
131 extern struct thread_entry threads
[MAXTHREADS
];
133 static char thread_status_char(unsigned status
)
135 static const char thread_status_chars
[THREAD_NUM_STATES
+1] =
137 [0 ... THREAD_NUM_STATES
] = '?',
138 [STATE_RUNNING
] = 'R',
139 [STATE_BLOCKED
] = 'B',
140 [STATE_SLEEPING
] = 'S',
141 [STATE_BLOCKED_W_TMO
] = 'T',
142 [STATE_FROZEN
] = 'F',
143 [STATE_KILLED
] = 'K',
146 if (status
> THREAD_NUM_STATES
)
147 status
= THREAD_NUM_STATES
;
149 return thread_status_chars
[status
];
152 static const char* threads_getname(int selected_item
, void *data
,
153 char *buffer
, size_t buffer_len
)
156 struct thread_entry
*thread
;
160 if (selected_item
< (int)NUM_CORES
)
162 snprintf(buffer
, buffer_len
, "Idle (%d): %2d%%", selected_item
,
163 idle_stack_usage(selected_item
));
167 selected_item
-= NUM_CORES
;
170 thread
= &threads
[selected_item
];
172 if (thread
->state
== STATE_KILLED
)
174 snprintf(buffer
, buffer_len
, "%2d: ---", selected_item
);
178 thread_get_name(name
, 32, thread
);
180 snprintf(buffer
, buffer_len
,
181 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s",
183 IF_COP(thread
->core
,)
184 #ifdef HAVE_SCHEDULER_BOOSTCTRL
185 (thread
->cpu_boost
) ? '+' :
187 ((thread
->state
== STATE_RUNNING
) ? '*' : ' '),
188 thread_status_char(thread
->state
),
189 IF_PRIO(thread
->base_priority
, thread
->priority
, )
190 thread_stack_usage(thread
), name
);
195 static int dbg_threads_action_callback(int action
, struct gui_synclist
*lists
)
198 #ifdef ROCKBOX_HAS_LOGF
199 if (action
== ACTION_STD_OK
)
201 int selpos
= gui_synclist_get_sel_pos(lists
);
203 if (selpos
>= NUM_CORES
)
204 remove_thread(threads
[selpos
- NUM_CORES
].id
);
206 remove_thread(threads
[selpos
].id
);
208 return ACTION_REDRAW
;
210 #endif /* ROCKBOX_HAS_LOGF */
211 if (action
== ACTION_NONE
)
212 action
= ACTION_REDRAW
;
216 static bool dbg_os(void)
218 struct simplelist_info info
;
219 simplelist_info_init(&info
, IF_COP("Core and ") "Stack usage:",
223 MAXTHREADS
+NUM_CORES
,
226 #ifndef ROCKBOX_HAS_LOGF
227 info
.hide_selection
= true;
228 info
.scroll_all
= true;
230 info
.action_callback
= dbg_threads_action_callback
;
231 info
.get_name
= threads_getname
;
232 return simplelist_show_list(&info
);
235 #ifdef HAVE_LCD_BITMAP
236 #if CONFIG_CODEC != SWCODEC
238 static bool dbg_audio_thread(void)
240 struct audio_debug d
;
242 lcd_setfont(FONT_SYSFIXED
);
246 if (action_userabort(HZ
/5))
249 audio_get_debugdata(&d
);
253 lcd_putsf(0, 0, "read: %x", d
.audiobuf_read
);
254 lcd_putsf(0, 1, "write: %x", d
.audiobuf_write
);
255 lcd_putsf(0, 2, "swap: %x", d
.audiobuf_swapwrite
);
256 lcd_putsf(0, 3, "playing: %d", d
.playing
);
257 lcd_putsf(0, 4, "playable: %x", d
.playable_space
);
258 lcd_putsf(0, 5, "unswapped: %x", d
.unswapped_space
);
260 /* Playable space left */
261 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8, 112, 4, d
.audiobuflen
, 0,
262 d
.playable_space
, HORIZONTAL
);
264 /* Show the watermark limit */
265 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8+4, 112, 4, d
.audiobuflen
, 0,
266 d
.low_watermark_level
, HORIZONTAL
);
268 lcd_putsf(0, 7, "wm: %x - %x",
269 d
.low_watermark_level
, d
.lowest_watermark_level
);
273 lcd_setfont(FONT_UI
);
276 #endif /* !SIMULATOR */
277 #else /* CONFIG_CODEC == SWCODEC */
278 static unsigned int ticks
, boost_ticks
, freq_sum
;
280 static void dbg_audio_task(void)
282 #ifdef CPUFREQ_NORMAL
283 if(FREQ
> CPUFREQ_NORMAL
)
285 freq_sum
+= FREQ
/1000000; /* in MHz */
290 static bool dbg_buffering_thread(void)
296 size_t bufsize
= pcmbuf_get_bufsize();
297 int pcmbufdescs
= pcmbuf_descs();
298 struct buffering_debug d
;
299 size_t filebuflen
= audio_get_filebuflen();
300 /* This is a size_t, but call it a long so it puts a - when it's bad. */
302 ticks
= boost_ticks
= freq_sum
= 0;
304 tick_add_task(dbg_audio_task
);
307 screens
[i
].setfont(FONT_SYSFIXED
);
311 button
= get_action(CONTEXT_STD
,HZ
/5);
314 case ACTION_STD_NEXT
:
317 case ACTION_STD_PREV
:
320 case ACTION_STD_CANCEL
:
325 buffering_get_debugdata(&d
);
326 bufused
= bufsize
- pcmbuf_free();
331 screens
[i
].clear_display();
334 screens
[i
].putsf(0, line
++, "pcm: %6ld/%ld", (long) bufused
, (long) bufsize
);
336 gui_scrollbar_draw(&screens
[i
],0, line
*8, screens
[i
].lcdwidth
, 6,
337 bufsize
, 0, bufused
, HORIZONTAL
);
340 screens
[i
].putsf(0, line
++, "alloc: %6ld/%ld", audio_filebufused(),
343 #if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80)
344 if (screens
[i
].lcdheight
> 80)
346 gui_scrollbar_draw(&screens
[i
],0, line
*8, screens
[i
].lcdwidth
, 6,
347 filebuflen
, 0, audio_filebufused(), HORIZONTAL
);
350 screens
[i
].putsf(0, line
++, "real: %6ld/%ld", (long)d
.buffered_data
,
353 gui_scrollbar_draw(&screens
[i
],0, line
*8, screens
[i
].lcdwidth
, 6,
354 filebuflen
, 0, (long)d
.buffered_data
, HORIZONTAL
);
359 screens
[i
].putsf(0, line
++, "usefl: %6ld/%ld", (long)(d
.useful_data
),
362 #if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80)
363 if (screens
[i
].lcdheight
> 80)
365 gui_scrollbar_draw(&screens
[i
],0, line
*8, screens
[i
].lcdwidth
, 6,
366 filebuflen
, 0, d
.useful_data
, HORIZONTAL
);
371 screens
[i
].putsf(0, line
++, "data_rem: %ld", (long)d
.data_rem
);
373 screens
[i
].putsf(0, line
++, "track count: %2d", audio_track_count());
375 screens
[i
].putsf(0, line
++, "handle count: %d", (int)d
.num_handles
);
377 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
378 screens
[i
].putsf(0, line
++, "cpu freq: %3dMHz",
379 (int)((FREQ
+ 500000) / 1000000));
384 int boostquota
= boost_ticks
* 1000 / ticks
; /* in 0.1 % */
385 int avgclock
= freq_sum
* 10 / ticks
; /* in 100 kHz */
386 screens
[i
].putsf(0, line
++, "boost:%3d.%d%% (%d.%dMHz)",
387 boostquota
/10, boostquota
%10, avgclock
/10, avgclock
%10);
390 screens
[i
].putsf(0, line
++, "pcmbufdesc: %2d/%2d",
391 pcmbuf_used_descs(), pcmbufdescs
);
392 screens
[i
].putsf(0, line
++, "watermark: %6d",
399 tick_remove_task(dbg_audio_task
);
402 screens
[i
].setfont(FONT_UI
);
406 #endif /* CONFIG_CODEC */
407 #endif /* HAVE_LCD_BITMAP */
410 #if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE))
411 /* Tool function to read the flash manufacturer and type, if available.
412 Only chips which could be reprogrammed in system will return values.
413 (The mode switch addresses vary between flash manufacturers, hence addr1/2) */
414 /* In IRAM to avoid problems when running directly from Flash */
415 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
416 unsigned addr1
, unsigned addr2
)
417 ICODE_ATTR
__attribute__((noinline
));
418 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
419 unsigned addr1
, unsigned addr2
)
422 unsigned not_manu
, not_id
; /* read values before switching to ID mode */
423 unsigned manu
, id
; /* read values when in ID mode */
425 #if CONFIG_CPU == SH7034
426 volatile unsigned char* flash
= (unsigned char*)0x2000000; /* flash mapping */
427 #elif defined(CPU_COLDFIRE)
428 volatile unsigned short* flash
= (unsigned short*)0; /* flash mapping */
430 int old_level
; /* saved interrupt level */
432 not_manu
= flash
[0]; /* read the normal content */
433 not_id
= flash
[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */
435 /* disable interrupts, prevent any stray flash access */
436 old_level
= disable_irq_save();
438 flash
[addr1
] = 0xAA; /* enter command mode */
440 flash
[addr1
] = 0x90; /* ID command */
441 /* Atmel wants 20ms pause here */
442 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
444 manu
= flash
[0]; /* read the IDs */
447 flash
[0] = 0xF0; /* reset flash (back to normal read mode) */
448 /* Atmel wants 20ms pause here */
449 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
451 restore_irq(old_level
); /* enable interrupts again */
453 /* I assume success if the obtained values are different from
454 the normal flash content. This is not perfectly bulletproof, they
455 could theoretically be the same by chance, causing us to fail. */
456 if (not_manu
!= manu
|| not_id
!= id
) /* a value has changed */
458 *p_manufacturer
= manu
; /* return the results */
460 return true; /* success */
462 return false; /* fail */
464 #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
466 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
468 static int perfcheck(void)
474 "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */
477 "ldr r0, [%[timr]] \n"
478 "add r0, r0, %[tmo] \n"
480 "add %[res], %[res], #1 \n"
481 "ldr r1, [%[timr]] \n"
484 "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */
488 [timr
]"r"(&USEC_TIMER
),
490 #if CONFIG_CPU == PP5002
492 #else /* PP5020/5022/5024 */
503 #ifdef HAVE_LCD_BITMAP
504 static bool dbg_hw_info(void)
506 #if CONFIG_CPU == SH7034
507 int bitmask
= HW_MASK
;
508 int rom_version
= ROM_VERSION
;
509 unsigned manu
, id
; /* flash IDs */
510 bool got_id
; /* flag if we managed to get the flash IDs */
511 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
512 bool has_bootrom
; /* flag for boot ROM present */
513 int oldmode
; /* saved memory guard mode */
515 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
517 /* get flash ROM type */
518 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
520 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
522 /* check if the boot ROM area is a flash mirror */
523 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
524 if (has_bootrom
) /* if ROM and Flash different */
526 /* calculate CRC16 checksum of boot ROM */
527 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
530 system_memory_guard(oldmode
); /* re-enable memory guard */
532 lcd_setfont(FONT_SYSFIXED
);
535 lcd_puts(0, 0, "[Hardware info]");
537 lcd_putsf(0, 1, "ROM: %d.%02d", rom_version
/100, rom_version
%100);
539 lcd_putsf(0, 2, "Mask: 0x%04x", bitmask
);
542 lcd_putsf(0, 3, "Flash: M=%02x D=%02x", manu
, id
);
544 lcd_puts(0, 3, "Flash: M=?? D=??"); /* unknown, sorry */
548 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
549 lcd_puts(0, 4, "Boot ROM: V1");
551 lcd_putsf(0, 4, "ROMcrc: 0x%08x", rom_crc
);
555 lcd_puts(0, 4, "Boot ROM: none");
560 while (!(action_userabort(TIMEOUT_BLOCK
)));
562 #elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
563 unsigned manu
, id
; /* flash IDs */
564 int got_id
; /* flag if we managed to get the flash IDs */
565 int oldmode
; /* saved memory guard mode */
568 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
570 /* get flash ROM type */
571 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
573 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
575 system_memory_guard(oldmode
); /* re-enable memory guard */
577 lcd_setfont(FONT_SYSFIXED
);
580 lcd_puts(0, line
++, "[Hardware info]");
583 lcd_putsf(0, line
++, "Flash: M=%04x D=%04x", manu
, id
);
585 lcd_puts(0, line
++, "Flash: M=???? D=????"); /* unknown, sorry */
591 lcd_puts(0, ++line
, "Serial Number:");
593 got_id
= ds2411_read_id(&id
);
595 if (got_id
== DS2411_OK
)
597 lcd_putsf(0, ++line
, " FC=%02x", (unsigned)id
.family_code
);
598 lcd_putsf(0, ++line
, " ID=%02X %02X %02X %02X %02X %02X",
599 (unsigned)id
.uid
[0], (unsigned)id
.uid
[1], (unsigned)id
.uid
[2],
600 (unsigned)id
.uid
[3], (unsigned)id
.uid
[4], (unsigned)id
.uid
[5]);
601 lcd_putsf(0, ++line
, " CRC=%02X", (unsigned)id
.crc
);
605 lcd_putsf(0, ++line
, "READ ERR=%d", got_id
);
612 while (!(action_userabort(TIMEOUT_BLOCK
)));
614 #elif defined(CPU_PP502x)
616 char pp_version
[] = { (PP_VER2
>> 24) & 0xff, (PP_VER2
>> 16) & 0xff,
617 (PP_VER2
>> 8) & 0xff, (PP_VER2
) & 0xff,
618 (PP_VER1
>> 24) & 0xff, (PP_VER1
>> 16) & 0xff,
619 (PP_VER1
>> 8) & 0xff, (PP_VER1
) & 0xff, '\0' };
621 lcd_setfont(FONT_SYSFIXED
);
624 lcd_puts(0, line
++, "[Hardware info]");
627 lcd_putsf(0, line
++, "HW rev: 0x%08lx", IPOD_HW_REVISION
);
631 extern int lcd_type
; /* Defined in lcd-colornano.c */
633 lcd_putsf(0, line
++, "LCD type: %d", lcd_type
);
636 lcd_putsf(0, line
++, "PP version: %s", pp_version
);
638 lcd_putsf(0, line
++, "Est. clock (kHz): %d", perfcheck());
642 while (!(action_userabort(TIMEOUT_BLOCK
)));
644 #elif CONFIG_CPU == PP5002
646 char pp_version
[] = { (PP_VER4
>> 8) & 0xff, PP_VER4
& 0xff,
647 (PP_VER3
>> 8) & 0xff, PP_VER3
& 0xff,
648 (PP_VER2
>> 8) & 0xff, PP_VER2
& 0xff,
649 (PP_VER1
>> 8) & 0xff, PP_VER1
& 0xff, '\0' };
652 lcd_setfont(FONT_SYSFIXED
);
655 lcd_puts(0, line
++, "[Hardware info]");
658 lcd_putsf(0, line
++, "HW rev: 0x%08lx", IPOD_HW_REVISION
);
661 lcd_putsf(0, line
++, "PP version: %s", pp_version
);
663 lcd_putsf(0, line
++, "Est. clock (kHz): %d", perfcheck());
667 while (!(action_userabort(TIMEOUT_BLOCK
)));
670 /* Define this function in your target tree */
671 return __dbg_hw_info();
672 #endif /* CONFIG_CPU */
673 lcd_setfont(FONT_UI
);
676 #else /* !HAVE_LCD_BITMAP */
677 static bool dbg_hw_info(void)
681 int rom_version
= ROM_VERSION
;
682 unsigned manu
, id
; /* flash IDs */
683 bool got_id
; /* flag if we managed to get the flash IDs */
684 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
685 bool has_bootrom
; /* flag for boot ROM present */
686 int oldmode
; /* saved memory guard mode */
688 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
690 /* get flash ROM type */
691 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
693 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
695 /* check if the boot ROM area is a flash mirror */
696 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
697 if (has_bootrom
) /* if ROM and Flash different */
699 /* calculate CRC16 checksum of boot ROM */
700 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
703 system_memory_guard(oldmode
); /* re-enable memory guard */
707 lcd_puts(0, 0, "[HW Info]");
713 lcd_putsf(0, 1, "ROM: %d.%02d",
714 rom_version
/100, rom_version
%100);
718 lcd_putsf(0, 1, "Flash:%02x,%02x", manu
, id
);
720 lcd_puts(0, 1, "Flash:??,??"); /* unknown, sorry */
725 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
726 lcd_puts(0, 1, "BootROM: V1");
727 else if (rom_crc
== 0x358099E8)
728 lcd_puts(0, 1, "BootROM: V2");
729 /* alternative boot ROM found in one single player so far */
731 lcd_putsf(0, 1, "R: %08x", rom_crc
);
734 lcd_puts(0, 1, "BootROM: no");
739 button
= get_action(CONTEXT_SETTINGS
,TIMEOUT_BLOCK
);
743 case ACTION_STD_CANCEL
:
746 case ACTION_SETTINGS_DEC
:
752 case ACTION_SETTINGS_INC
:
761 #endif /* !HAVE_LCD_BITMAP */
762 #endif /* PLATFORM_NATIVE */
764 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
765 static const char* dbg_partitions_getname(int selected_item
, void *data
,
766 char *buffer
, size_t buffer_len
)
769 int partition
= selected_item
/2;
770 struct partinfo
* p
= disk_partinfo(partition
);
773 snprintf(buffer
, buffer_len
, " T:%x %ld MB", p
->type
, p
->size
/ ( 2048 / ( SECTOR_SIZE
/ 512 )));
777 snprintf(buffer
, buffer_len
, "P%d: S:%lx", partition
, p
->start
);
782 bool dbg_partitions(void)
784 struct simplelist_info info
;
785 simplelist_info_init(&info
, "Partition Info", 4, NULL
);
786 info
.selection_size
= 2;
787 info
.hide_selection
= true;
788 info
.scroll_all
= true;
789 info
.get_name
= dbg_partitions_getname
;
790 return simplelist_show_list(&info
);
792 #endif /* PLATFORM_NATIVE */
794 #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
795 static bool dbg_spdif(void)
798 unsigned int control
;
803 unsigned int interruptstat
;
804 bool valnogood
, symbolerr
, parityerr
;
807 int spdif_source
= spdif_get_output_source(&spdif_src_on
);
808 spdif_set_output_source(AUDIO_SRC_SPDIF
IF_SPDIF_POWER_(, true));
811 lcd_setfont(FONT_SYSFIXED
);
813 #ifdef HAVE_SPDIF_POWER
814 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
821 control
= EBU1RCVCCHANNEL1
;
822 interruptstat
= INTERRUPTSTAT
;
823 INTERRUPTCLEAR
= 0x03c00000;
825 valnogood
= (interruptstat
& 0x01000000)?true:false;
826 symbolerr
= (interruptstat
& 0x00800000)?true:false;
827 parityerr
= (interruptstat
& 0x00400000)?true:false;
829 lcd_putsf(0, line
++, "Val: %s Sym: %s Par: %s",
832 parityerr
?"--":"OK");
834 lcd_putsf(0, line
++, "Status word: %08x", (int)control
);
839 lcd_putsf(0, line
++, "PRO: %d (%s)",
840 x
, x
?"Professional":"Consumer");
842 x
= (control
>> 30) & 1;
843 lcd_putsf(0, line
++, "Audio: %d (%s)",
844 x
, x
?"Non-PCM":"PCM");
846 x
= (control
>> 29) & 1;
847 lcd_putsf(0, line
++, "Copy: %d (%s)",
848 x
, x
?"Permitted":"Inhibited");
850 x
= (control
>> 27) & 7;
863 lcd_putsf(0, line
++, "Preemphasis: %d (%s)", x
, s
);
865 x
= (control
>> 24) & 3;
866 lcd_putsf(0, line
++, "Mode: %d", x
);
868 category
= (control
>> 17) & 127;
880 lcd_putsf(0, line
++, "Category: 0x%02x (%s)", category
, s
);
882 x
= (control
>> 16) & 1;
884 if(((category
& 0x70) == 0x10) ||
885 ((category
& 0x70) == 0x40) ||
886 ((category
& 0x78) == 0x38))
888 generation
= !generation
;
890 lcd_putsf(0, line
++, "Generation: %d (%s)",
891 x
, generation
?"Original":"No ind.");
893 x
= (control
>> 12) & 15;
894 lcd_putsf(0, line
++, "Source: %d", x
);
897 x
= (control
>> 8) & 15;
913 lcd_putsf(0, line
++, "Channel: %d (%s)", x
, s
);
915 x
= (control
>> 4) & 15;
928 lcd_putsf(0, line
++, "Frequency: %d (%s)", x
, s
);
930 x
= (control
>> 2) & 3;
931 lcd_putsf(0, line
++, "Clock accuracy: %d", x
);
934 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
935 lcd_putsf(0, line
++, "Measured freq: %ldHz",
936 spdif_measure_frequency());
941 if (action_userabort(HZ
/10))
945 spdif_set_output_source(spdif_source
IF_SPDIF_POWER_(, spdif_src_on
));
947 #ifdef HAVE_SPDIF_POWER
948 spdif_power_enable(global_settings
.spdif_enable
);
951 lcd_setfont(FONT_UI
);
954 #endif /* CPU_COLDFIRE */
956 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
957 #ifdef HAVE_LCD_BITMAP
958 /* button definitions */
959 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
960 (CONFIG_KEYPAD == IRIVER_H300_PAD)
961 # define DEBUG_CANCEL BUTTON_OFF
963 #elif CONFIG_KEYPAD == RECORDER_PAD
964 # define DEBUG_CANCEL BUTTON_OFF
966 #elif CONFIG_KEYPAD == ONDIO_PAD
967 # define DEBUG_CANCEL BUTTON_MENU
969 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
970 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
971 (CONFIG_KEYPAD == IPOD_4G_PAD)
972 # define DEBUG_CANCEL BUTTON_MENU
974 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
975 # define DEBUG_CANCEL BUTTON_PLAY
977 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
978 # define DEBUG_CANCEL BUTTON_REC
980 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
981 # define DEBUG_CANCEL BUTTON_RC_REC
983 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
984 # define DEBUG_CANCEL BUTTON_REW
986 #elif (CONFIG_KEYPAD == MROBE100_PAD)
987 # define DEBUG_CANCEL BUTTON_MENU
989 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
990 (CONFIG_KEYPAD == SANSA_C200_PAD) || \
991 (CONFIG_KEYPAD == SANSA_FUZE_PAD)
992 # define DEBUG_CANCEL BUTTON_LEFT
994 /* This is temporary until the SA9200 touchpad works */
995 #elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
996 (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
997 # define DEBUG_CANCEL BUTTON_POWER
999 #elif (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD)
1000 # define DEBUG_CANCEL BUTTON_PREV
1002 #elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
1003 # define DEBUG_CANCEL BUTTON_PLAY
1005 #elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
1006 # define DEBUG_CANCEL BUTTON_CANCEL
1008 #elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
1009 # define DEBUG_CANCEL BUTTON_REC
1011 #endif /* key definitions */
1014 bool dbg_ports(void)
1016 #if CONFIG_CPU == SH7034
1017 int adc_battery_voltage
, adc_battery_level
;
1019 lcd_setfont(FONT_SYSFIXED
);
1020 lcd_clear_display();
1024 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR
);
1025 lcd_putsf(0, 1, "PBDR: %04x", (unsigned short)PBDR
);
1027 lcd_putsf(0, 2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
1028 lcd_putsf(0, 3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
1029 lcd_putsf(0, 4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
1030 lcd_putsf(0, 5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
1032 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1033 lcd_putsf(0, 6, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1034 adc_battery_voltage
% 1000, adc_battery_level
);
1037 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1039 lcd_setfont(FONT_UI
);
1043 #elif defined(CPU_COLDFIRE)
1044 unsigned int gpio_out
;
1045 unsigned int gpio1_out
;
1046 unsigned int gpio_read
;
1047 unsigned int gpio1_read
;
1048 unsigned int gpio_function
;
1049 unsigned int gpio1_function
;
1050 unsigned int gpio_enable
;
1051 unsigned int gpio1_enable
;
1052 int adc_buttons
, adc_remote
;
1053 int adc_battery_voltage
, adc_battery_level
;
1056 lcd_clear_display();
1057 lcd_setfont(FONT_SYSFIXED
);
1062 gpio_read
= GPIO_READ
;
1063 gpio1_read
= GPIO1_READ
;
1064 gpio_out
= GPIO_OUT
;
1065 gpio1_out
= GPIO1_OUT
;
1066 gpio_function
= GPIO_FUNCTION
;
1067 gpio1_function
= GPIO1_FUNCTION
;
1068 gpio_enable
= GPIO_ENABLE
;
1069 gpio1_enable
= GPIO1_ENABLE
;
1071 lcd_putsf(0, line
++, "GPIO_READ: %08x", gpio_read
);
1072 lcd_putsf(0, line
++, "GPIO_OUT: %08x", gpio_out
);
1073 lcd_putsf(0, line
++, "GPIO_FUNC: %08x", gpio_function
);
1074 lcd_putsf(0, line
++, "GPIO_ENA: %08x", gpio_enable
);
1076 lcd_putsf(0, line
++, "GPIO1_READ: %08x", gpio1_read
);
1077 lcd_putsf(0, line
++, "GPIO1_OUT: %08x", gpio1_out
);
1078 lcd_putsf(0, line
++, "GPIO1_FUNC: %08x", gpio1_function
);
1079 lcd_putsf(0, line
++, "GPIO1_ENA: %08x", gpio1_enable
);
1081 adc_buttons
= adc_read(ADC_BUTTONS
);
1082 adc_remote
= adc_read(ADC_REMOTE
);
1083 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1084 #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
1085 lcd_putsf(0, line
++, "ADC_BUTTONS (%c): %02x",
1086 button_scan_enabled() ? '+' : '-', adc_buttons
);
1088 lcd_putsf(0, line
++, "ADC_BUTTONS: %02x", adc_buttons
);
1090 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
1091 lcd_putsf(0, line
++, "ADC_REMOTE (%c): %02x",
1092 remote_detect() ? '+' : '-', adc_remote
);
1094 lcd_putsf(0, line
++, "ADC_REMOTE: %02x", adc_remote
);
1096 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1097 lcd_putsf(0, line
++, "ADC_REMOTEDETECT: %02x",
1098 adc_read(ADC_REMOTEDETECT
));
1101 lcd_putsf(0, line
++, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1102 adc_battery_voltage
% 1000, adc_battery_level
);
1104 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1105 lcd_putsf(0, line
++, "remotetype: %d", remote_type());
1109 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1111 lcd_setfont(FONT_UI
);
1116 #elif defined(CPU_PP502x)
1119 lcd_clear_display();
1120 lcd_setfont(FONT_SYSFIXED
);
1125 #if (LCD_HEIGHT >= 176) /* Only for displays with appropriate height. */
1126 lcd_puts(0, line
++, "GPIO ENABLE: GPIO OUTPUT ENABLE:");
1127 lcd_putsf(0, line
++, "A: %02x E: %02x I: %02x A: %02x E: %02x I: %02x",
1128 (unsigned int)GPIOA_ENABLE
,
1129 (unsigned int)GPIOE_ENABLE
,
1130 (unsigned int)GPIOI_ENABLE
,
1131 (unsigned int)GPIOA_OUTPUT_EN
,
1132 (unsigned int)GPIOE_OUTPUT_EN
,
1133 (unsigned int)GPIOI_OUTPUT_EN
);
1134 lcd_putsf(0, line
++, "B: %02x F: %02x J: %02x B: %02x F: %02x J: %02x",
1135 (unsigned int)GPIOB_ENABLE
,
1136 (unsigned int)GPIOF_ENABLE
,
1137 (unsigned int)GPIOJ_ENABLE
,
1138 (unsigned int)GPIOB_OUTPUT_EN
,
1139 (unsigned int)GPIOF_OUTPUT_EN
,
1140 (unsigned int)GPIOJ_OUTPUT_EN
);
1141 lcd_putsf(0, line
++, "C: %02x G: %02x K: %02x C: %02x G: %02x K: %02x",
1142 (unsigned int)GPIOC_ENABLE
,
1143 (unsigned int)GPIOG_ENABLE
,
1144 (unsigned int)GPIOK_ENABLE
,
1145 (unsigned int)GPIOC_OUTPUT_EN
,
1146 (unsigned int)GPIOG_OUTPUT_EN
,
1147 (unsigned int)GPIOK_OUTPUT_EN
);
1148 lcd_putsf(0, line
++, "D: %02x H: %02x L: %02x D: %02x H: %02x L: %02x",
1149 (unsigned int)GPIOD_ENABLE
,
1150 (unsigned int)GPIOH_ENABLE
,
1151 (unsigned int)GPIOL_ENABLE
,
1152 (unsigned int)GPIOD_OUTPUT_EN
,
1153 (unsigned int)GPIOH_OUTPUT_EN
,
1154 (unsigned int)GPIOL_OUTPUT_EN
);
1157 lcd_puts(0, line
++, "GPIO INPUT VAL:");
1158 lcd_putsf(0, line
++, "A: %02x E: %02x I: %02x",
1159 (unsigned int)GPIOA_INPUT_VAL
,
1160 (unsigned int)GPIOE_INPUT_VAL
,
1161 (unsigned int)GPIOI_INPUT_VAL
);
1162 lcd_putsf(0, line
++, "B: %02x F: %02x J: %02x",
1163 (unsigned int)GPIOB_INPUT_VAL
,
1164 (unsigned int)GPIOF_INPUT_VAL
,
1165 (unsigned int)GPIOJ_INPUT_VAL
);
1166 lcd_putsf(0, line
++, "C: %02x G: %02x K: %02x",
1167 (unsigned int)GPIOC_INPUT_VAL
,
1168 (unsigned int)GPIOG_INPUT_VAL
,
1169 (unsigned int)GPIOK_INPUT_VAL
);
1170 lcd_putsf(0, line
++, "D: %02x H: %02x L: %02x",
1171 (unsigned int)GPIOD_INPUT_VAL
,
1172 (unsigned int)GPIOH_INPUT_VAL
,
1173 (unsigned int)GPIOL_INPUT_VAL
);
1175 lcd_putsf(0, line
++, "GPO32_VAL: %08lx", GPO32_VAL
);
1176 lcd_putsf(0, line
++, "GPO32_EN: %08lx", GPO32_ENABLE
);
1177 lcd_putsf(0, line
++, "DEV_EN: %08lx", DEV_EN
);
1178 lcd_putsf(0, line
++, "DEV_EN2: %08lx", DEV_EN2
);
1179 lcd_putsf(0, line
++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */
1180 lcd_putsf(0, line
++, "DEV_INIT1: %08lx", DEV_INIT1
);
1181 lcd_putsf(0, line
++, "DEV_INIT2: %08lx", DEV_INIT2
);
1182 #ifdef ADC_ACCESSORY
1183 lcd_putsf(0, line
++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY
));
1186 lcd_putsf(0, line
++, "4066_ISTAT: %d", adc_read(ADC_4066_ISTAT
));
1189 #if defined(IPOD_ACCESSORY_PROTOCOL)
1190 const unsigned char *serbuf
= iap_get_serbuf();
1191 lcd_putsf(0, line
++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
1192 serbuf
[0], serbuf
[1], serbuf
[2], serbuf
[3], serbuf
[4], serbuf
[5],
1193 serbuf
[6], serbuf
[7]);
1196 #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1198 lcd_putsf(0, line
++, "BATT: %03x UNK1: %03x",
1199 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1200 lcd_putsf(0, line
++, "REM: %03x PAD: %03x",
1201 adc_read(ADC_REMOTE
), adc_read(ADC_SCROLLPAD
));
1202 #elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
1204 lcd_putsf(0, line
++, "BATT: %03x UNK1: %03x",
1205 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1206 #elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
1207 lcd_putsf(0, line
++, "ADC_BVDD: %4d", adc_read(ADC_BVDD
));
1208 lcd_putsf(0, line
++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP
));
1209 lcd_putsf(0, line
++, "ADC_UVDD: %4d", adc_read(ADC_UVDD
));
1210 lcd_putsf(0, line
++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN
));
1211 lcd_putsf(0, line
++, "ADC_CVDD: %4d", adc_read(ADC_CVDD
));
1212 lcd_putsf(0, line
++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP
));
1213 lcd_putsf(0, line
++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1
));
1214 lcd_putsf(0, line
++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2
));
1215 lcd_putsf(0, line
++, "ADC_VBE1: %4d", adc_read(ADC_VBE1
));
1216 lcd_putsf(0, line
++, "ADC_VBE2: %4d", adc_read(ADC_VBE2
));
1217 lcd_putsf(0, line
++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1
));
1218 #if !defined(PHILIPS_SA9200)
1219 lcd_putsf(0, line
++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2
));
1220 lcd_putsf(0, line
++, "ADC_VBAT: %4d", adc_read(ADC_VBAT
));
1224 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1226 lcd_setfont(FONT_UI
);
1231 #elif CONFIG_CPU == PP5002
1234 lcd_clear_display();
1235 lcd_setfont(FONT_SYSFIXED
);
1240 lcd_putsf(0, line
++, "GPIO_A: %02x GPIO_B: %02x",
1241 (unsigned int)GPIOA_INPUT_VAL
, (unsigned int)GPIOB_INPUT_VAL
);
1242 lcd_putsf(0, line
++, "GPIO_C: %02x GPIO_D: %02x",
1243 (unsigned int)GPIOC_INPUT_VAL
, (unsigned int)GPIOD_INPUT_VAL
);
1245 lcd_putsf(0, line
++, "DEV_EN: %08lx", DEV_EN
);
1246 lcd_putsf(0, line
++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE
);
1247 lcd_putsf(0, line
++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE
);
1248 lcd_putsf(0, line
++, "PLL_CONTROL: %08lx", PLL_CONTROL
);
1249 lcd_putsf(0, line
++, "PLL_DIV: %08lx", PLL_DIV
);
1250 lcd_putsf(0, line
++, "PLL_MULT: %08lx", PLL_MULT
);
1251 lcd_putsf(0, line
++, "TIMING1_CTL: %08lx", TIMING1_CTL
);
1252 lcd_putsf(0, line
++, "TIMING2_CTL: %08lx", TIMING2_CTL
);
1255 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1257 lcd_setfont(FONT_UI
);
1261 lcd_setfont(FONT_UI
);
1263 return __dbg_ports();
1267 #else /* !HAVE_LCD_BITMAP */
1268 bool dbg_ports(void)
1271 int adc_battery_voltage
;
1274 lcd_clear_display();
1279 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR
);
1280 } else if (currval
== 1) {
1281 lcd_putsf(0, 0, "PBDR: %04x", (unsigned short)PBDR
);
1283 int idx
= currval
- 2; /* idx < 7 */
1284 lcd_putsf(0, 0, "AN%d: %03x", idx
, adc_read(idx
));
1287 battery_read_info(&adc_battery_voltage
, NULL
);
1288 lcd_putsf(0, 1, "Batt: %d.%03dV", adc_battery_voltage
/ 1000,
1289 adc_battery_voltage
% 1000);
1292 button
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1296 case ACTION_STD_CANCEL
:
1299 case ACTION_SETTINGS_DEC
:
1305 case ACTION_SETTINGS_INC
:
1314 #endif /* !HAVE_LCD_BITMAP */
1315 #endif /* PLATFORM_NATIVE */
1317 #if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
1318 static bool dbg_pcf(void)
1322 #ifdef HAVE_LCD_BITMAP
1323 lcd_setfont(FONT_SYSFIXED
);
1325 lcd_clear_display();
1331 lcd_putsf(0, line
++, "DCDC1: %02x", pcf50605_read(0x1b));
1332 lcd_putsf(0, line
++, "DCDC2: %02x", pcf50605_read(0x1c));
1333 lcd_putsf(0, line
++, "DCDC3: %02x", pcf50605_read(0x1d));
1334 lcd_putsf(0, line
++, "DCDC4: %02x", pcf50605_read(0x1e));
1335 lcd_putsf(0, line
++, "DCDEC1: %02x", pcf50605_read(0x1f));
1336 lcd_putsf(0, line
++, "DCDEC2: %02x", pcf50605_read(0x20));
1337 lcd_putsf(0, line
++, "DCUDC1: %02x", pcf50605_read(0x21));
1338 lcd_putsf(0, line
++, "DCUDC2: %02x", pcf50605_read(0x22));
1339 lcd_putsf(0, line
++, "IOREGC: %02x", pcf50605_read(0x23));
1340 lcd_putsf(0, line
++, "D1REGC: %02x", pcf50605_read(0x24));
1341 lcd_putsf(0, line
++, "D2REGC: %02x", pcf50605_read(0x25));
1342 lcd_putsf(0, line
++, "D3REGC: %02x", pcf50605_read(0x26));
1343 lcd_putsf(0, line
++, "LPREG1: %02x", pcf50605_read(0x27));
1345 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1347 lcd_setfont(FONT_UI
);
1352 lcd_setfont(FONT_UI
);
1357 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
1358 static bool dbg_cpufreq(void)
1363 #ifdef HAVE_LCD_BITMAP
1364 lcd_setfont(FONT_SYSFIXED
);
1366 lcd_clear_display();
1372 lcd_putsf(0, line
++, "Frequency: %ld", FREQ
);
1373 lcd_putsf(0, line
++, "boost_counter: %d", get_cpu_boost_counter());
1376 button
= get_action(CONTEXT_STD
,HZ
/10);
1380 case ACTION_STD_PREV
:
1384 case ACTION_STD_NEXT
:
1389 while (get_cpu_boost_counter() > 0)
1391 set_cpu_frequency(CPUFREQ_DEFAULT
);
1394 case ACTION_STD_CANCEL
:
1395 lcd_setfont(FONT_UI
);
1399 lcd_setfont(FONT_UI
);
1402 #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1404 #if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
1405 #include "tsc2100.h"
1406 static char *itob(int n
, int len
)
1408 static char binary
[64];
1410 for (i
=1, j
=0;i
<=len
;i
++)
1412 binary
[j
++] = n
&(1<<(len
-i
))?'1':'0';
1420 static const char* tsc2100_debug_getname(int selected_item
, void * data
,
1421 char *buffer
, size_t buffer_len
)
1423 int *page
= (int*)data
;
1424 bool reserved
= false;
1428 if ((selected_item
> 0x0a) ||
1429 (selected_item
== 0x04) ||
1430 (selected_item
== 0x08))
1434 if ((selected_item
> 0x05) ||
1435 (selected_item
== 0x02))
1439 if (selected_item
> 0x1e)
1444 snprintf(buffer
, buffer_len
, "%02x: RESERVED", selected_item
);
1446 snprintf(buffer
, buffer_len
, "%02x: %s", selected_item
,
1447 itob(tsc2100_readreg(*page
, selected_item
)&0xffff,16));
1450 static int tsc2100debug_action_callback(int action
, struct gui_synclist
*lists
)
1452 int *page
= (int*)lists
->data
;
1453 if (action
== ACTION_STD_OK
)
1455 *page
= (*page
+1)%3;
1456 snprintf(lists
->title
, 32,
1457 "tsc2100 registers - Page %d", *page
);
1458 return ACTION_REDRAW
;
1462 static bool tsc2100_debug(void)
1465 char title
[32] = "tsc2100 registers - Page 0";
1466 struct simplelist_info info
;
1467 simplelist_info_init(&info
, title
, 32, &page
);
1468 info
.timeout
= HZ
/100;
1469 info
.get_name
= tsc2100_debug_getname
;
1470 info
.action_callback
= tsc2100debug_action_callback
;
1471 return simplelist_show_list(&info
);
1474 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1475 #ifdef HAVE_LCD_BITMAP
1477 * view_battery() shows a automatically scaled graph of the battery voltage
1478 * over time. Usable for estimating battery life / charging rate.
1479 * The power_history array is updated in power_thread of powermgmt.c.
1482 #define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
1483 #define BAT_YSPACE (LCD_HEIGHT - 20)
1486 static bool view_battery(void)
1489 int i
, x
, y
, y1
, y2
, grid
, graph
;
1490 unsigned short maxv
, minv
;
1492 lcd_setfont(FONT_SYSFIXED
);
1496 lcd_clear_display();
1498 case 0: /* voltage history graph */
1499 /* Find maximum and minimum voltage for scaling */
1500 minv
= power_history
[0];
1502 for (i
= 1; i
< BAT_LAST_VAL
&& power_history
[i
]; i
++) {
1503 if (power_history
[i
] > maxv
)
1504 maxv
= power_history
[i
];
1505 if (power_history
[i
] < minv
)
1506 minv
= power_history
[i
];
1509 /* adjust grid scale */
1510 if ((maxv
- minv
) > 50)
1516 lcd_putsf(0, 0, "battery %d.%03dV", power_history
[0] / 1000,
1517 power_history
[0] % 1000);
1518 lcd_putsf(0, 1, "%d.%03d-%d.%03dV (%2dmV)",
1519 minv
/ 1000, minv
% 1000, maxv
/ 1000, maxv
% 1000,
1523 while ((y
= (minv
- (minv
% grid
)+i
*grid
)) < maxv
)
1525 graph
= ((y
-minv
)*BAT_YSPACE
)/(maxv
-minv
);
1526 graph
= LCD_HEIGHT
-1 - graph
;
1528 /* draw dotted horizontal grid line */
1529 for (x
=0; x
<LCD_WIDTH
;x
=x
+2)
1530 lcd_drawpixel(x
,graph
);
1536 /* draw plot of power history
1537 * skip empty entries
1539 for (i
= BAT_LAST_VAL
- 1; i
> 0; i
--)
1541 if (power_history
[i
] && power_history
[i
-1])
1543 y1
= (power_history
[i
] - minv
) * BAT_YSPACE
/
1545 y1
= MIN(MAX(LCD_HEIGHT
-1 - y1
, 20),
1547 y2
= (power_history
[i
-1] - minv
) * BAT_YSPACE
/
1549 y2
= MIN(MAX(LCD_HEIGHT
-1 - y2
, 20),
1552 lcd_set_drawmode(DRMODE_SOLID
);
1554 /* make line thicker */
1555 lcd_drawline(((x
*LCD_WIDTH
)/(BAT_LAST_VAL
)),
1557 (((x
+1)*LCD_WIDTH
)/(BAT_LAST_VAL
)),
1559 lcd_drawline(((x
*LCD_WIDTH
)/(BAT_LAST_VAL
))+1,
1561 (((x
+1)*LCD_WIDTH
)/(BAT_LAST_VAL
))+1,
1568 case 1: /* status: */
1569 #if CONFIG_CHARGING >= CHARGING_MONITOR
1570 lcd_putsf(0, 0, "Pwr status: %s",
1571 charging_state() ? "charging" : "discharging");
1573 lcd_puts(0, 0, "Power status:");
1575 battery_read_info(&y
, NULL
);
1576 lcd_putsf(0, 1, "Battery: %d.%03d V", y
/ 1000, y
% 1000);
1577 #ifdef ADC_EXT_POWER
1578 y
= (adc_read(ADC_EXT_POWER
) * EXT_SCALE_FACTOR
) / 1000;
1579 lcd_putsf(0, 2, "External: %d.%03d V", y
/ 1000, y
% 1000);
1582 #if defined ARCHOS_RECORDER
1583 lcd_putsf(0, 3, "Chgr: %s %s",
1584 charger_inserted() ? "present" : "absent",
1585 charger_enabled() ? "on" : "off");
1586 lcd_putsf(0, 5, "short delta: %d", short_delta
);
1587 lcd_putsf(0, 6, "long delta: %d", long_delta
);
1588 lcd_puts(0, 7, power_message
);
1589 lcd_putsf(0, 8, "USB Inserted: %s",
1590 usb_inserted() ? "yes" : "no");
1591 #elif defined IPOD_NANO || defined IPOD_VIDEO
1592 int usb_pwr
= (GPIOL_INPUT_VAL
& 0x10)?true:false;
1593 int ext_pwr
= (GPIOL_INPUT_VAL
& 0x08)?false:true;
1594 int dock
= (GPIOA_INPUT_VAL
& 0x10)?true:false;
1595 int charging
= (GPIOB_INPUT_VAL
& 0x01)?false:true;
1596 int headphone
= (GPIOA_INPUT_VAL
& 0x80)?true:false;
1598 lcd_putsf(0, 3, "USB pwr: %s",
1599 usb_pwr
? "present" : "absent");
1600 lcd_putsf(0, 4, "EXT pwr: %s",
1601 ext_pwr
? "present" : "absent");
1602 lcd_putsf(0, 5, "Battery: %s",
1603 charging
? "charging" : (usb_pwr
||ext_pwr
) ? "charged" : "discharging");
1604 lcd_putsf(0, 6, "Dock mode: %s",
1605 dock
? "enabled" : "disabled");
1606 lcd_putsf(0, 7, "Headphone: %s",
1607 headphone
? "connected" : "disconnected");
1609 if(probed_ramsize
== 64)
1610 x
= (adc_read(ADC_4066_ISTAT
) * 2400) / (1024 * 2);
1612 x
= (adc_read(ADC_4066_ISTAT
) * 2400) / (1024 * 3);
1613 lcd_putsf(0, 8, "Ibat: %d mA", x
);
1614 lcd_putsf(0, 9, "Vbat * Ibat: %d mW", x
* y
/ 1000);
1616 #elif defined TOSHIBA_GIGABEAT_S
1620 static const unsigned char * const chrgstate_strings
[] =
1631 lcd_putsf(0, line
++, "Charger: %s",
1632 charger_inserted() ? "present" : "absent");
1634 st
= power_input_status() &
1635 (POWER_INPUT_CHARGER
| POWER_INPUT_BATTERY
);
1636 lcd_putsf(0, line
++, "%s%s",
1637 (st
& POWER_INPUT_MAIN_CHARGER
) ? " Main" : "",
1638 (st
& POWER_INPUT_USB_CHARGER
) ? " USB" : "");
1640 y
= ARRAYLEN(chrgstate_strings
) - 1;
1642 switch (charge_state
)
1644 case CHARGE_STATE_DISABLED
: y
--;
1645 case CHARGE_STATE_ERROR
: y
--;
1646 case DISCHARGING
: y
--;
1653 lcd_putsf(0, line
++, "State: %s", chrgstate_strings
[y
]);
1655 lcd_putsf(0, line
++, "Battery Switch: %s",
1656 (st
& POWER_INPUT_BATTERY
) ? "On" : "Off");
1658 y
= chrgraw_adc_voltage();
1659 lcd_putsf(0, line
++, "CHRGRAW: %d.%03d V",
1660 y
/ 1000, y
% 1000);
1662 y
= application_supply_adc_voltage();
1663 lcd_putsf(0, line
++, "BP : %d.%03d V",
1664 y
/ 1000, y
% 1000);
1666 y
= battery_adc_charge_current();
1667 if (y
< 0) x
= '-', y
= -y
;
1669 lcd_putsf(0, line
++, "CHRGISN:%c%d mA", x
, y
);
1671 y
= cccv_regulator_dissipation();
1672 lcd_putsf(0, line
++, "P CCCV : %d mW", y
);
1674 y
= battery_charge_current();
1675 if (y
< 0) x
= '-', y
= -y
;
1677 lcd_putsf(0, line
++, "I Charge:%c%d mA", x
, y
);
1679 y
= battery_adc_temp();
1682 lcd_putsf(0, line
++, "T Battery: %dC (%dF)", y
,
1685 /* Conversion disabled */
1686 lcd_puts(0, line
++, "T Battery: ?");
1689 #elif defined(SANSA_E200) || defined(SANSA_C200) || CONFIG_CPU == AS3525 || \
1690 CONFIG_CPU == AS3525v2
1691 static const char * const chrgstate_strings
[] =
1693 [CHARGE_STATE_DISABLED
- CHARGE_STATE_DISABLED
]= "Disabled",
1694 [CHARGE_STATE_ERROR
- CHARGE_STATE_DISABLED
] = "Error",
1695 [DISCHARGING
- CHARGE_STATE_DISABLED
] = "Discharging",
1696 [CHARGING
- CHARGE_STATE_DISABLED
] = "Charging",
1698 const char *str
= NULL
;
1700 lcd_putsf(0, 3, "Charger: %s",
1701 charger_inserted() ? "present" : "absent");
1703 y
= charge_state
- CHARGE_STATE_DISABLED
;
1704 if ((unsigned)y
< ARRAYLEN(chrgstate_strings
))
1705 str
= chrgstate_strings
[y
];
1707 lcd_putsf(0, 4, "State: %s",
1708 str
? str
: "<unknown>");
1710 lcd_putsf(0, 5, "CHARGER: %02X", ascodec_read_charger());
1711 #elif defined(IPOD_NANO2G)
1712 y
= pmu_read_battery_voltage();
1713 lcd_putsf(17, 1, "RAW: %d.%03d V", y
/ 1000, y
% 1000);
1714 y
= pmu_read_battery_current();
1715 lcd_putsf(0, 2, "Battery current: %d mA", y
);
1716 lcd_putsf(0, 3, "PWRCON: %8x", PWRCON
);
1717 lcd_putsf(0, 4, "PWRCONEXT: %8x", PWRCONEXT
);
1718 x
= pmu_read(0x1b) & 0xf;
1719 y
= pmu_read(0x1a) * 25 + 625;
1720 lcd_putsf(0, 5, "AUTO: %x / %d mV", x
, y
);
1721 x
= pmu_read(0x1f) & 0xf;
1722 y
= pmu_read(0x1e) * 25 + 625;
1723 lcd_putsf(0, 6, "DOWN1: %x / %d mV", x
, y
);
1724 x
= pmu_read(0x23) & 0xf;
1725 y
= pmu_read(0x22) * 25 + 625;
1726 lcd_putsf(0, 7, "DOWN2: %x / %d mV", x
, y
);
1727 x
= pmu_read(0x27) & 0xf;
1728 y
= pmu_read(0x26) * 100 + 900;
1729 lcd_putsf(0, 8, "MEMLDO: %x / %d mV", x
, y
);
1730 for (i
= 0; i
< 6; i
++)
1732 x
= pmu_read(0x2e + (i
<< 1)) & 0xf;
1733 y
= pmu_read(0x2d + (i
<< 1)) * 100 + 900;
1734 lcd_putsf(0, 9 + i
, "LDO%d: %x / %d mV", i
+ 1, x
, y
);
1736 lcd_putsf(0, 15, "CLKCON: %8x", CLKCON
);
1737 lcd_putsf(17, 15, "PLL0: %6x", PLL0PMS
);
1739 lcd_putsf(0, 3, "Charger: %s",
1740 charger_inserted() ? "present" : "absent");
1741 #endif /* target type */
1742 #endif /* CONFIG_CHARGING */
1745 case 2: /* voltage deltas: */
1746 lcd_puts(0, 0, "Voltage deltas:");
1748 for (i
= 0; i
<= 6; i
++) {
1749 y
= power_history
[i
] - power_history
[i
+1];
1750 lcd_putsf(0, i
+1, "-%d min: %s%d.%03d V", i
,
1751 (y
< 0) ? "-" : "", ((y
< 0) ? y
* -1 : y
) / 1000,
1752 ((y
< 0) ? y
* -1 : y
) % 1000);
1756 case 3: /* remaining time estimation: */
1758 #ifdef ARCHOS_RECORDER
1759 lcd_putsf(0, 0, "charge_state: %d", charge_state
);
1761 lcd_putsf(0, 1, "Cycle time: %d m", powermgmt_last_cycle_startstop_min
);
1763 lcd_putsf(0, 2, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level
);
1765 lcd_putsf(0, 3, "P=%2d I=%2d", pid_p
, pid_i
);
1767 lcd_putsf(0, 4, "Trickle sec: %d/60", trickle_sec
);
1768 #endif /* ARCHOS_RECORDER */
1770 lcd_putsf(0, 5, "Last PwrHist: %d.%03dV",
1771 power_history
[0] / 1000,
1772 power_history
[0] % 1000);
1774 lcd_putsf(0, 6, "battery level: %d%%", battery_level());
1776 lcd_putsf(0, 7, "Est. remain: %d m", battery_time());
1782 switch(get_action(CONTEXT_STD
,HZ
/2))
1784 case ACTION_STD_PREV
:
1789 case ACTION_STD_NEXT
:
1794 case ACTION_STD_CANCEL
:
1795 lcd_setfont(FONT_UI
);
1799 lcd_setfont(FONT_UI
);
1803 #endif /* HAVE_LCD_BITMAP */
1806 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1807 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
1809 #if (CONFIG_STORAGE & STORAGE_MMC)
1810 #define CARDTYPE "MMC"
1811 #elif (CONFIG_STORAGE & STORAGE_SD)
1812 #define CARDTYPE "microSD"
1815 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1818 int *cardnum
= (int*)lists
->data
;
1819 unsigned char card_name
[6];
1820 unsigned char pbuf
[32];
1821 char *title
= lists
->title
;
1822 static const unsigned char i_vmin
[] = { 0, 1, 5, 10, 25, 35, 60, 100 };
1823 static const unsigned char i_vmax
[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
1824 static const unsigned char * const kbit_units
[] = { "kBit/s", "MBit/s", "GBit/s" };
1825 static const unsigned char * const nsec_units
[] = { "ns", "µs", "ms" };
1826 #if (CONFIG_STORAGE & STORAGE_MMC)
1827 static const char * const mmc_spec_vers
[] = { "1.0-1.2", "1.4", "2.0-2.2",
1828 "3.1-3.31", "4.0" };
1831 if ((btn
== ACTION_STD_OK
) || (btn
== SYS_FS_CHANGED
) || (btn
== ACTION_REDRAW
))
1834 if (btn
== ACTION_STD_OK
)
1836 *cardnum
^= 0x1; /* change cards */
1840 simplelist_set_line_count(0);
1842 card
= card_get_info(*cardnum
);
1844 if (card
->initialized
> 0)
1847 for (i
=0; i
<sizeof(card_name
); i
++)
1849 card_name
[i
] = card_extract_bits(card
->cid
, (103-8*i
), 8);
1851 strlcpy(card_name
, card_name
, sizeof(card_name
));
1852 simplelist_addline(SIMPLELIST_ADD_LINE
,
1853 "%s Rev %d.%d", card_name
,
1854 (int) card_extract_bits(card
->cid
, 63, 4),
1855 (int) card_extract_bits(card
->cid
, 59, 4));
1856 simplelist_addline(SIMPLELIST_ADD_LINE
,
1858 #if (CONFIG_STORAGE & STORAGE_SD)
1859 (int) card_extract_bits(card
->cid
, 11, 4),
1860 (int) card_extract_bits(card
->cid
, 19, 8) + 2000
1861 #elif (CONFIG_STORAGE & STORAGE_MMC)
1862 (int) card_extract_bits(card
->cid
, 15, 4),
1863 (int) card_extract_bits(card
->cid
, 11, 4) + 1997
1866 simplelist_addline(SIMPLELIST_ADD_LINE
,
1867 #if (CONFIG_STORAGE & STORAGE_SD)
1869 card_extract_bits(card
->cid
, 55, 32)
1870 #elif (CONFIG_STORAGE & STORAGE_MMC)
1872 card_extract_bits(card
->cid
, 47, 16)
1876 simplelist_addline(SIMPLELIST_ADD_LINE
, "M=%02x, "
1877 #if (CONFIG_STORAGE & STORAGE_SD)
1879 (int) card_extract_bits(card
->cid
, 127, 8),
1880 card_extract_bits(card
->cid
, 119, 8),
1881 card_extract_bits(card
->cid
, 111, 8)
1882 #elif (CONFIG_STORAGE & STORAGE_MMC)
1884 (int) card_extract_bits(card
->cid
, 127, 8),
1885 (int) card_extract_bits(card
->cid
, 119, 16)
1889 #if (CONFIG_STORAGE & STORAGE_MMC)
1890 int temp
= card_extract_bits(card
->csd
, 125, 4);
1891 simplelist_addline(SIMPLELIST_ADD_LINE
,
1892 "MMC v%s", temp
< 5 ?
1893 mmc_spec_vers
[temp
] : "?.?");
1895 simplelist_addline(SIMPLELIST_ADD_LINE
,
1896 "Blocks: 0x%08lx", card
->numblocks
);
1897 output_dyn_value(pbuf
, sizeof pbuf
, card
->speed
/ 1000,
1899 simplelist_addline(SIMPLELIST_ADD_LINE
,
1901 output_dyn_value(pbuf
, sizeof pbuf
, card
->taac
,
1903 simplelist_addline(SIMPLELIST_ADD_LINE
,
1905 simplelist_addline(SIMPLELIST_ADD_LINE
,
1906 "Nsac: %d clk", card
->nsac
);
1907 simplelist_addline(SIMPLELIST_ADD_LINE
,
1908 "R2W: *%d", card
->r2w_factor
);
1909 simplelist_addline(SIMPLELIST_ADD_LINE
,
1911 i_vmin
[card_extract_bits(card
->csd
, 61, 3)],
1912 i_vmax
[card_extract_bits(card
->csd
, 58, 3)]);
1913 simplelist_addline(SIMPLELIST_ADD_LINE
,
1915 i_vmin
[card_extract_bits(card
->csd
, 55, 3)],
1916 i_vmax
[card_extract_bits(card
->csd
, 52, 3)]);
1918 else if (card
->initialized
== 0)
1920 simplelist_addline(SIMPLELIST_ADD_LINE
, "Not Found!");
1922 #if (CONFIG_STORAGE & STORAGE_SD)
1923 else /* card->initialized < 0 */
1925 simplelist_addline(SIMPLELIST_ADD_LINE
, "Init Error! (%d)", card
->initialized
);
1928 snprintf(title
, 16, "[" CARDTYPE
" %d]", *cardnum
);
1929 gui_synclist_set_title(lists
, title
, Icon_NOICON
);
1930 gui_synclist_set_nb_items(lists
, simplelist_get_line_count());
1931 gui_synclist_select_item(lists
, 0);
1932 btn
= ACTION_REDRAW
;
1936 #elif (CONFIG_STORAGE & STORAGE_ATA)
1937 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1942 unsigned short* identify_info
= ata_get_identify();
1943 bool timing_info_present
= false;
1946 simplelist_set_line_count(0);
1948 for (i
=0; i
< 20; i
++)
1949 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+27]);
1951 /* kill trailing space */
1952 for (i
=39; i
&& buf
[i
]==' '; i
--)
1954 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", buf
);
1955 for (i
=0; i
< 4; i
++)
1956 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+23]);
1958 simplelist_addline(SIMPLELIST_ADD_LINE
,
1959 "Firmware: %s", buf
);
1960 snprintf(buf
, sizeof buf
, "%ld MB",
1961 ((unsigned long)identify_info
[61] << 16 |
1962 (unsigned long)identify_info
[60]) / 2048 );
1963 simplelist_addline(SIMPLELIST_ADD_LINE
,
1966 fat_size( IF_MV2(0,) NULL
, &free
);
1967 simplelist_addline(SIMPLELIST_ADD_LINE
,
1968 "Free: %ld MB", free
/ 1024);
1969 simplelist_addline(SIMPLELIST_ADD_LINE
,
1970 "Spinup time: %d ms", storage_spinup_time() * (1000/HZ
));
1971 i
= identify_info
[83] & (1<<3);
1972 simplelist_addline(SIMPLELIST_ADD_LINE
,
1973 "Power mgmt: %s", i
? "enabled" : "unsupported");
1974 i
= identify_info
[83] & (1<<9);
1975 simplelist_addline(SIMPLELIST_ADD_LINE
,
1976 "Noise mgmt: %s", i
? "enabled" : "unsupported");
1977 i
= identify_info
[82] & (1<<6);
1978 simplelist_addline(SIMPLELIST_ADD_LINE
,
1979 "Read-ahead: %s", i
? "enabled" : "unsupported");
1980 timing_info_present
= identify_info
[53] & (1<<1);
1981 if(timing_info_present
) {
1982 char pio3
[2], pio4
[2];pio3
[1] = 0;
1984 pio3
[0] = (identify_info
[64] & (1<<0)) ? '3' : 0;
1985 pio4
[0] = (identify_info
[64] & (1<<1)) ? '4' : 0;
1986 simplelist_addline(SIMPLELIST_ADD_LINE
,
1987 "PIO modes: 0 1 2 %s %s", pio3
, pio4
);
1990 simplelist_addline(SIMPLELIST_ADD_LINE
,
1991 "No PIO mode info");
1993 timing_info_present
= identify_info
[53] & (1<<1);
1994 if(timing_info_present
) {
1995 simplelist_addline(SIMPLELIST_ADD_LINE
,
1996 "Cycle times %dns/%dns",
1998 identify_info
[68] );
2000 simplelist_addline(SIMPLELIST_ADD_LINE
,
2003 int sector_size
= 512;
2004 if((identify_info
[106] & 0xe000) == 0x6000)
2005 sector_size
*= BIT_N(identify_info
[106] & 0x000f);
2006 simplelist_addline(SIMPLELIST_ADD_LINE
,
2007 "Physical sector size: %d", sector_size
);
2009 if (identify_info
[63] & (1<<0)) {
2010 char mdma0
[2], mdma1
[2], mdma2
[2];
2011 mdma0
[1] = mdma1
[1] = mdma2
[1] = 0;
2012 mdma0
[0] = (identify_info
[63] & (1<<0)) ? '0' : 0;
2013 mdma1
[0] = (identify_info
[63] & (1<<1)) ? '1' : 0;
2014 mdma2
[0] = (identify_info
[63] & (1<<2)) ? '2' : 0;
2015 simplelist_addline(SIMPLELIST_ADD_LINE
,
2016 "MDMA modes: %s %s %s", mdma0
, mdma1
, mdma2
);
2017 simplelist_addline(SIMPLELIST_ADD_LINE
,
2018 "MDMA Cycle times %dns/%dns",
2020 identify_info
[66] );
2023 simplelist_addline(SIMPLELIST_ADD_LINE
,
2024 "No MDMA mode info");
2026 if (identify_info
[53] & (1<<2)) {
2027 char udma0
[2], udma1
[2], udma2
[2], udma3
[2], udma4
[2], udma5
[2], udma6
[2];
2028 udma0
[1] = udma1
[1] = udma2
[1] = udma3
[1] = udma4
[1] = udma5
[1] = udma6
[1] = 0;
2029 udma0
[0] = (identify_info
[88] & (1<<0)) ? '0' : 0;
2030 udma1
[0] = (identify_info
[88] & (1<<1)) ? '1' : 0;
2031 udma2
[0] = (identify_info
[88] & (1<<2)) ? '2' : 0;
2032 udma3
[0] = (identify_info
[88] & (1<<3)) ? '3' : 0;
2033 udma4
[0] = (identify_info
[88] & (1<<4)) ? '4' : 0;
2034 udma5
[0] = (identify_info
[88] & (1<<5)) ? '5' : 0;
2035 udma6
[0] = (identify_info
[88] & (1<<6)) ? '6' : 0;
2036 simplelist_addline(SIMPLELIST_ADD_LINE
,
2037 "UDMA modes: %s %s %s %s %s %s %s", udma0
, udma1
, udma2
,
2038 udma3
, udma4
, udma5
, udma6
);
2041 simplelist_addline(SIMPLELIST_ADD_LINE
,
2042 "No UDMA mode info");
2044 #endif /* HAVE_ATA_DMA */
2045 timing_info_present
= identify_info
[53] & (1<<1);
2046 if(timing_info_present
) {
2047 i
= identify_info
[49] & (1<<11);
2048 simplelist_addline(SIMPLELIST_ADD_LINE
,
2049 "IORDY support: %s", i
? "yes" : "no");
2050 i
= identify_info
[49] & (1<<10);
2051 simplelist_addline(SIMPLELIST_ADD_LINE
,
2052 "IORDY disable: %s", i
? "yes" : "no");
2054 simplelist_addline(SIMPLELIST_ADD_LINE
,
2057 simplelist_addline(SIMPLELIST_ADD_LINE
,
2058 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2060 i
= ata_get_dma_mode();
2062 simplelist_addline(SIMPLELIST_ADD_LINE
,
2065 simplelist_addline(SIMPLELIST_ADD_LINE
,
2067 (i
& 0x40) ? "UDMA" : "MDMA",
2070 #endif /* HAVE_ATA_DMA */
2073 #else /* No SD, MMC or ATA */
2074 static int disk_callback(int btn
, struct gui_synclist
*lists
)
2078 struct storage_info info
;
2079 storage_get_info(0,&info
);
2080 simplelist_addline(SIMPLELIST_ADD_LINE
, "Vendor: %s", info
.vendor
);
2081 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", info
.product
);
2082 simplelist_addline(SIMPLELIST_ADD_LINE
, "Firmware: %s", info
.revision
);
2083 simplelist_addline(SIMPLELIST_ADD_LINE
,
2084 "Size: %ld MB", info
.num_sectors
*(info
.sector_size
/512)/2024);
2086 fat_size( IF_MV2(0,) NULL
, &free
);
2087 simplelist_addline(SIMPLELIST_ADD_LINE
,
2088 "Free: %ld MB", free
/ 1024);
2089 simplelist_addline(SIMPLELIST_ADD_LINE
,
2090 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2095 #if (CONFIG_STORAGE & STORAGE_ATA)
2096 static bool dbg_identify_info(void)
2098 int fd
= creat("/identify_info.bin", 0666);
2101 #ifdef ROCKBOX_LITTLE_ENDIAN
2102 ecwrite(fd
, ata_get_identify(), SECTOR_SIZE
/2, "s", true);
2104 write(fd
, ata_get_identify(), SECTOR_SIZE
);
2112 static bool dbg_disk_info(void)
2114 struct simplelist_info info
;
2115 simplelist_info_init(&info
, "Disk Info", 1, NULL
);
2116 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
2119 info
.callback_data
= (void*)&card
;
2122 info
.action_callback
= disk_callback
;
2123 info
.hide_selection
= true;
2124 info
.scroll_all
= true;
2125 return simplelist_show_list(&info
);
2127 #endif /* PLATFORM_NATIVE */
2129 #ifdef HAVE_DIRCACHE
2130 static int dircache_callback(int btn
, struct gui_synclist
*lists
)
2132 (void)btn
; (void)lists
;
2133 simplelist_set_line_count(0);
2134 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache initialized: %s",
2135 dircache_is_enabled() ? "Yes" : "No");
2136 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache size: %d B",
2137 dircache_get_cache_size());
2138 simplelist_addline(SIMPLELIST_ADD_LINE
, "Last size: %d B",
2139 global_status
.dircache_size
);
2140 simplelist_addline(SIMPLELIST_ADD_LINE
, "Limit: %d B",
2142 simplelist_addline(SIMPLELIST_ADD_LINE
, "Reserve: %d/%d B",
2143 dircache_get_reserve_used(), DIRCACHE_RESERVE
);
2144 simplelist_addline(SIMPLELIST_ADD_LINE
, "Scanning took: %d s",
2145 dircache_get_build_ticks() / HZ
);
2146 simplelist_addline(SIMPLELIST_ADD_LINE
, "Entry count: %d",
2147 dircache_get_entry_count());
2151 static bool dbg_dircache_info(void)
2153 struct simplelist_info info
;
2154 simplelist_info_init(&info
, "Dircache Info", 7, NULL
);
2155 info
.action_callback
= dircache_callback
;
2156 info
.hide_selection
= true;
2157 info
.scroll_all
= true;
2158 return simplelist_show_list(&info
);
2161 #endif /* HAVE_DIRCACHE */
2163 #ifdef HAVE_TAGCACHE
2164 static int database_callback(int btn
, struct gui_synclist
*lists
)
2167 struct tagcache_stat
*stat
= tagcache_get_stat();
2168 static bool synced
= false;
2170 simplelist_set_line_count(0);
2172 simplelist_addline(SIMPLELIST_ADD_LINE
, "Initialized: %s",
2173 stat
->initialized
? "Yes" : "No");
2174 simplelist_addline(SIMPLELIST_ADD_LINE
, "DB Ready: %s",
2175 stat
->ready
? "Yes" : "No");
2176 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM Cache: %s",
2177 stat
->ramcache
? "Yes" : "No");
2178 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM: %d/%d B",
2179 stat
->ramcache_used
, stat
->ramcache_allocated
);
2180 simplelist_addline(SIMPLELIST_ADD_LINE
, "Progress: %d%% (%d entries)",
2181 stat
->progress
, stat
->processed_entries
);
2182 simplelist_addline(SIMPLELIST_ADD_LINE
, "Curfile: %s",
2183 stat
->curentry
? stat
->curentry
: "---");
2184 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit step: %d",
2186 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit delayed: %s",
2187 stat
->commit_delayed
? "Yes" : "No");
2189 simplelist_addline(SIMPLELIST_ADD_LINE
, "Queue length: %d",
2190 stat
->queue_length
);
2195 tagcache_screensync_event();
2198 if (!btn
&& stat
->curentry
)
2201 return ACTION_REDRAW
;
2204 if (btn
== ACTION_STD_CANCEL
)
2205 tagcache_screensync_enable(false);
2209 static bool dbg_tagcache_info(void)
2211 struct simplelist_info info
;
2212 simplelist_info_init(&info
, "Database Info", 8, NULL
);
2213 info
.action_callback
= database_callback
;
2214 info
.hide_selection
= true;
2215 info
.scroll_all
= true;
2217 /* Don't do nonblock here, must give enough processing time
2218 for tagcache thread. */
2219 /* info.timeout = TIMEOUT_NOBLOCK; */
2221 tagcache_screensync_enable(true);
2222 return simplelist_show_list(&info
);
2226 #if CONFIG_CPU == SH7034
2227 static bool dbg_save_roms(void)
2230 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2232 fd
= creat("/internal_rom_0000-FFFF.bin", 0666);
2235 write(fd
, (void *)0, 0x10000);
2239 fd
= creat("/internal_rom_2000000-203FFFF.bin", 0666);
2242 write(fd
, (void *)0x2000000, 0x40000);
2246 system_memory_guard(oldmode
);
2249 #elif defined CPU_COLDFIRE
2250 static bool dbg_save_roms(void)
2253 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2255 #if defined(IRIVER_H100_SERIES)
2256 fd
= creat("/internal_rom_000000-1FFFFF.bin", 0666);
2257 #elif defined(IRIVER_H300_SERIES)
2258 fd
= creat("/internal_rom_000000-3FFFFF.bin", 0666);
2259 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3)
2260 fd
= creat("/internal_rom_000000-3FFFFF.bin", 0666);
2261 #elif defined(MPIO_HD200)
2262 fd
= creat("/internal_rom_000000-1FFFFF.bin", 0666);
2266 write(fd
, (void *)0, FLASH_SIZE
);
2269 system_memory_guard(oldmode
);
2272 fd
= creat("/internal_eeprom.bin", 0666);
2276 char buf
[EEPROM_SIZE
];
2279 old_irq_level
= disable_irq_save();
2281 err
= eeprom_24cxx_read(0, buf
, sizeof buf
);
2283 restore_irq(old_irq_level
);
2286 splashf(HZ
*3, "Eeprom read failure (%d)", err
);
2289 write(fd
, buf
, sizeof buf
);
2298 #elif defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)
2299 static bool dbg_save_roms(void)
2303 fd
= creat("/internal_rom_000000-0FFFFF.bin", 0666);
2306 write(fd
, (void *)0x20000000, FLASH_SIZE
);
2312 #elif CONFIG_CPU == IMX31L
2313 static bool dbg_save_roms(void)
2317 fd
= creat("/flash_rom_A0000000-A01FFFFF.bin", 0666);
2320 write(fd
, (void*)0xa0000000, FLASH_SIZE
);
2326 #elif defined(CPU_TCC780X)
2327 static bool dbg_save_roms(void)
2331 fd
= creat("/eeprom_E0000000-E0001FFF.bin", 0666);
2334 write(fd
, (void*)0xe0000000, 0x2000);
2345 #ifdef CONFIG_TUNER_MULTI
2346 static int tuner_type
= 0;
2347 #define IF_TUNER_TYPE(type) if(tuner_type==type)
2349 #define IF_TUNER_TYPE(type)
2352 static int radio_callback(int btn
, struct gui_synclist
*lists
)
2355 if (btn
== ACTION_STD_CANCEL
)
2357 simplelist_set_line_count(1);
2359 #if (CONFIG_TUNER & LV24020LP)
2360 simplelist_addline(SIMPLELIST_ADD_LINE
,
2361 "CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT
) );
2362 simplelist_addline(SIMPLELIST_ADD_LINE
,
2363 "RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT
) );
2364 simplelist_addline(SIMPLELIST_ADD_LINE
,
2365 "MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM
) );
2366 simplelist_addline(SIMPLELIST_ADD_LINE
,
2367 "MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF
) );
2368 simplelist_addline(SIMPLELIST_ADD_LINE
,
2369 "MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD
) );
2370 simplelist_addline(SIMPLELIST_ADD_LINE
,
2371 "if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET
) );
2372 simplelist_addline(SIMPLELIST_ADD_LINE
,
2373 "sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET
) );
2374 #endif /* LV24020LP */
2375 #if (CONFIG_TUNER & S1A0903X01)
2376 simplelist_addline(SIMPLELIST_ADD_LINE
,
2377 "Samsung regs: %08X", s1a0903x01_get(RADIO_ALL
));
2378 /* This one doesn't return dynamic data atm */
2379 #endif /* S1A0903X01 */
2380 #if (CONFIG_TUNER & TEA5767)
2381 struct tea5767_dbg_info nfo
;
2382 tea5767_dbg_info(&nfo
);
2383 simplelist_addline(SIMPLELIST_ADD_LINE
, "Philips regs:");
2384 simplelist_addline(SIMPLELIST_ADD_LINE
,
2385 " Read: %02X %02X %02X %02X %02X",
2386 (unsigned)nfo
.read_regs
[0], (unsigned)nfo
.read_regs
[1],
2387 (unsigned)nfo
.read_regs
[2], (unsigned)nfo
.read_regs
[3],
2388 (unsigned)nfo
.read_regs
[4]);
2389 simplelist_addline(SIMPLELIST_ADD_LINE
,
2390 " Write: %02X %02X %02X %02X %02X",
2391 (unsigned)nfo
.write_regs
[0], (unsigned)nfo
.write_regs
[1],
2392 (unsigned)nfo
.write_regs
[2], (unsigned)nfo
.write_regs
[3],
2393 (unsigned)nfo
.write_regs
[4]);
2394 #endif /* TEA5767 */
2395 #if (CONFIG_TUNER & SI4700)
2396 IF_TUNER_TYPE(SI4700
)
2398 struct si4700_dbg_info nfo
;
2400 si4700_dbg_info(&nfo
);
2401 simplelist_addline(SIMPLELIST_ADD_LINE
, "SI4700 regs:");
2402 for (i
= 0; i
< 16; i
+= 4) {
2403 simplelist_addline(SIMPLELIST_ADD_LINE
,"%02X: %04X %04X %04X %04X",
2404 i
, nfo
.regs
[i
], nfo
.regs
[i
+1], nfo
.regs
[i
+2], nfo
.regs
[i
+3]);
2408 #if (CONFIG_TUNER & RDA5802)
2409 IF_TUNER_TYPE(RDA5802
)
2411 struct rda5802_dbg_info nfo
;
2413 rda5802_dbg_info(&nfo
);
2414 simplelist_addline(SIMPLELIST_ADD_LINE
, "RDA5802 regs:");
2415 for (i
= 0; i
< 16; i
+= 4) {
2416 simplelist_addline(SIMPLELIST_ADD_LINE
,"%02X: %04X %04X %04X %04X",
2417 i
, nfo
.regs
[i
], nfo
.regs
[i
+1], nfo
.regs
[i
+2], nfo
.regs
[i
+3]);
2420 #endif /* RDA55802 */
2421 return ACTION_REDRAW
;
2423 static bool dbg_fm_radio(void)
2425 struct simplelist_info info
;
2426 #ifdef CONFIG_TUNER_MULTI
2427 tuner_type
= tuner_detect_type();
2429 info
.scroll_all
= true;
2430 simplelist_info_init(&info
, "FM Radio", 1, NULL
);
2431 simplelist_set_line_count(0);
2432 simplelist_addline(SIMPLELIST_ADD_LINE
, "HW detected: %s",
2433 radio_hardware_present() ? "yes" : "no");
2435 info
.action_callback
= radio_hardware_present()?radio_callback
: NULL
;
2436 info
.hide_selection
= true;
2437 return simplelist_show_list(&info
);
2439 #endif /* CONFIG_TUNER */
2440 #endif /* !SIMULATOR */
2442 #ifdef HAVE_LCD_BITMAP
2443 extern bool do_screendump_instead_of_usb
;
2445 static bool dbg_screendump(void)
2447 do_screendump_instead_of_usb
= !do_screendump_instead_of_usb
;
2448 splashf(HZ
, "Screendump %s",
2449 do_screendump_instead_of_usb
?"enabled":"disabled");
2452 #endif /* HAVE_LCD_BITMAP */
2454 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2455 static bool dbg_set_memory_guard(void)
2457 static const struct opt_items names
[MAXMEMGUARD
] = {
2459 { "Flash ROM writes", -1 },
2460 { "Zero area (all)", -1 }
2462 int mode
= system_memory_guard(MEMGUARD_KEEP
);
2464 set_option( "Catch mem accesses", &mode
, INT
, names
, MAXMEMGUARD
, NULL
);
2465 system_memory_guard(mode
);
2469 #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
2471 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2472 static bool dbg_write_eeprom(void)
2477 char buf
[EEPROM_SIZE
];
2480 fd
= open("/internal_eeprom.bin", O_RDONLY
);
2484 rc
= read(fd
, buf
, EEPROM_SIZE
);
2486 if(rc
== EEPROM_SIZE
)
2488 old_irq_level
= disable_irq_save();
2490 err
= eeprom_24cxx_write(0, buf
, sizeof buf
);
2492 splashf(HZ
*3, "Eeprom write failure (%d)", err
);
2494 splash(HZ
*3, "Eeprom written successfully");
2496 restore_irq(old_irq_level
);
2500 splashf(HZ
*3, "File read error (%d)",rc
);
2506 splash(HZ
*3, "Failed to open 'internal_eeprom.bin'");
2511 #endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
2512 #ifdef CPU_BOOST_LOGGING
2513 static bool cpu_boost_log(void)
2516 int count
= cpu_boost_log_getcount();
2517 int lines
= LCD_HEIGHT
/SYSFONT_HEIGHT
;
2520 lcd_setfont(FONT_SYSFIXED
);
2521 str
= cpu_boost_log_getlog_first();
2524 lcd_clear_display();
2525 for(j
=0; j
<lines
; j
++,i
++)
2528 str
= cpu_boost_log_getlog_next();
2531 if(strlen(str
) > LCD_WIDTH
/SYSFONT_WIDTH
)
2532 lcd_puts_scroll(0, j
, str
);
2542 switch(get_action(CONTEXT_STD
,TIMEOUT_BLOCK
))
2545 case ACTION_STD_PREV
:
2546 case ACTION_STD_NEXT
:
2549 case ACTION_STD_CANCEL
:
2557 get_action(CONTEXT_STD
,TIMEOUT_BLOCK
);
2558 lcd_setfont(FONT_UI
);
2563 #if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
2564 && !defined(IPOD_MINI) && !defined(SIMULATOR))
2565 extern bool wheel_is_touched
;
2566 extern int old_wheel_value
;
2567 extern int new_wheel_value
;
2568 extern int wheel_delta
;
2569 extern unsigned int accumulated_wheel_delta
;
2570 extern unsigned int wheel_velocity
;
2572 static bool dbg_scrollwheel(void)
2576 lcd_setfont(FONT_SYSFIXED
);
2580 if (action_userabort(HZ
/10))
2583 lcd_clear_display();
2585 /* show internal variables of scrollwheel driver */
2586 lcd_putsf(0, 0, "wheel touched: %s", (wheel_is_touched
) ? "true" : "false");
2587 lcd_putsf(0, 1, "new position: %2d", new_wheel_value
);
2588 lcd_putsf(0, 2, "old position: %2d", old_wheel_value
);
2589 lcd_putsf(0, 3, "wheel delta: %2d", wheel_delta
);
2590 lcd_putsf(0, 4, "accumulated delta: %2d", accumulated_wheel_delta
);
2591 lcd_putsf(0, 5, "velo [deg/s]: %4d", (int)wheel_velocity
);
2593 /* show effective accelerated scrollspeed */
2594 speed
= button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity
);
2595 lcd_putsf(0, 6, "accel. speed: %4d", speed
);
2599 lcd_setfont(FONT_UI
);
2604 #if defined (HAVE_USBSTACK)
2606 #if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
2607 static bool toggle_usb_core_driver(int driver
, char *msg
)
2609 bool enabled
= !usb_core_driver_enabled(driver
);
2611 usb_core_enable_driver(driver
,enabled
);
2612 splashf(HZ
, "%s %s", msg
, enabled
?"enabled":"disabled");
2617 static bool toggle_usb_serial(void)
2619 return toggle_usb_core_driver(USB_DRIVER_SERIAL
,"USB Serial");
2625 #if CONFIG_USBOTG == USBOTG_ISP1583
2626 extern int dbg_usb_num_items(void);
2627 extern const char* dbg_usb_item(int selected_item
, void *data
,
2628 char *buffer
, size_t buffer_len
);
2630 static int isp1583_action_callback(int action
, struct gui_synclist
*lists
)
2633 if (action
== ACTION_NONE
)
2634 action
= ACTION_REDRAW
;
2638 static bool dbg_isp1583(void)
2640 struct simplelist_info isp1583
;
2641 isp1583
.scroll_all
= true;
2642 simplelist_info_init(&isp1583
, "ISP1583", dbg_usb_num_items(), NULL
);
2643 isp1583
.timeout
= HZ
/100;
2644 isp1583
.hide_selection
= true;
2645 isp1583
.get_name
= dbg_usb_item
;
2646 isp1583
.action_callback
= isp1583_action_callback
;
2647 return simplelist_show_list(&isp1583
);
2651 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2652 extern int pic_dbg_num_items(void);
2653 extern const char* pic_dbg_item(int selected_item
, void *data
,
2654 char *buffer
, size_t buffer_len
);
2656 static int pic_action_callback(int action
, struct gui_synclist
*lists
)
2659 if (action
== ACTION_NONE
)
2660 action
= ACTION_REDRAW
;
2664 static bool dbg_pic(void)
2666 struct simplelist_info pic
;
2667 pic
.scroll_all
= true;
2668 simplelist_info_init(&pic
, "PIC", pic_dbg_num_items(), NULL
);
2669 pic
.timeout
= HZ
/100;
2670 pic
.hide_selection
= true;
2671 pic
.get_name
= pic_dbg_item
;
2672 pic
.action_callback
= pic_action_callback
;
2673 return simplelist_show_list(&pic
);
2678 /****** The menu *********/
2679 struct the_menu_item
{
2680 unsigned char *desc
; /* string or ID */
2681 bool (*function
) (void); /* return true if USB was connected */
2683 static const struct the_menu_item menuitems
[] = {
2684 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2685 (defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)) || \
2686 CONFIG_CPU == IMX31L || defined(CPU_TCC780X)
2687 { "Dump ROM contents", dbg_save_roms
},
2689 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \
2690 || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 \
2691 || CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2
2692 { "View I/O ports", dbg_ports
},
2694 #if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
2695 { "View PCF registers", dbg_pcf
},
2697 #if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
2698 { "TSC2100 debug", tsc2100_debug
},
2700 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
2701 { "CPU frequency", dbg_cpufreq
},
2703 #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
2704 { "S/PDIF analyzer", dbg_spdif
},
2706 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2707 { "Catch mem accesses", dbg_set_memory_guard
},
2709 { "View OS stacks", dbg_os
},
2710 #ifdef HAVE_LCD_BITMAP
2711 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2712 { "View battery", view_battery
},
2714 { "Screendump", dbg_screendump
},
2716 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2717 { "View HW info", dbg_hw_info
},
2719 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2720 { "View partitions", dbg_partitions
},
2722 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2723 { "View disk info", dbg_disk_info
},
2724 #if (CONFIG_STORAGE & STORAGE_ATA)
2725 { "Dump ATA identify info", dbg_identify_info
},
2728 #ifdef HAVE_DIRCACHE
2729 { "View dircache info", dbg_dircache_info
},
2731 #ifdef HAVE_TAGCACHE
2732 { "View database info", dbg_tagcache_info
},
2734 #ifdef HAVE_LCD_BITMAP
2735 #if CONFIG_CODEC == SWCODEC
2736 { "View buffering thread", dbg_buffering_thread
},
2737 #elif !defined(SIMULATOR)
2738 { "View audio thread", dbg_audio_thread
},
2741 { "pm histogram", peak_meter_histogram
},
2742 #endif /* PM_DEBUG */
2743 #endif /* HAVE_LCD_BITMAP */
2746 { "FM Radio", dbg_fm_radio
},
2749 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2750 { "Write back EEPROM", dbg_write_eeprom
},
2752 #if CONFIG_USBOTG == USBOTG_ISP1583
2753 { "View ISP1583 info", dbg_isp1583
},
2755 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2756 { "View PIC info", dbg_pic
},
2758 #ifdef ROCKBOX_HAS_LOGF
2759 {"Show Log File", logfdisplay
},
2760 {"Dump Log File", logfdump
},
2762 #if defined(HAVE_USBSTACK)
2763 #if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
2764 {"USB Serial driver (logf)", toggle_usb_serial
},
2766 #endif /* HAVE_USBSTACK */
2767 #ifdef CPU_BOOST_LOGGING
2768 {"cpu_boost log",cpu_boost_log
},
2770 #if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
2771 && !defined(IPOD_MINI) && !defined(SIMULATOR))
2772 {"Debug scrollwheel", dbg_scrollwheel
},
2775 static int menu_action_callback(int btn
, struct gui_synclist
*lists
)
2778 if (btn
== ACTION_STD_OK
)
2781 viewportmanager_theme_enable(i
, false, NULL
);
2782 menuitems
[gui_synclist_get_sel_pos(lists
)].function();
2783 btn
= ACTION_REDRAW
;
2785 viewportmanager_theme_undo(i
, false);
2790 static const char* dbg_menu_getname(int item
, void * data
,
2791 char *buffer
, size_t buffer_len
)
2793 (void)data
; (void)buffer
; (void)buffer_len
;
2794 return menuitems
[item
].desc
;
2797 bool debug_menu(void)
2799 struct simplelist_info info
;
2801 simplelist_info_init(&info
, "Debug Menu", ARRAYLEN(menuitems
), NULL
);
2802 info
.action_callback
= menu_action_callback
;
2803 info
.get_name
= dbg_menu_getname
;
2804 return simplelist_show_list(&info
);