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"
36 #include "powermgmt.h"
40 #include "mp3_playback.h"
43 #include "statusbar.h"
54 #include "lcd-remote.h"
66 #include "eeprom_24cxx.h"
67 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
70 #if (CONFIG_STORAGE & STORAGE_ATA)
79 #ifdef HAVE_LCD_BITMAP
80 #include "scrollbar.h"
81 #include "peakmeter.h"
84 #if CONFIG_CODEC == SWCODEC
86 #include "buffering.h"
88 #if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
92 #ifdef IRIVER_H300_SERIES
93 #include "pcf50606.h" /* for pcf50606_read */
100 #if CONFIG_RTC == RTC_PCF50605
101 #include "pcf50605.h"
103 #include "appevents.h"
105 #if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 \
106 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 || CONFIG_CPU == JZ4732 \
107 || defined(CPU_S5L870X)
108 #include "debug-target.h"
111 #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \
112 || defined(SANSA_CLIP) || defined(SANSA_FUZE)
118 #include "pmu-target.h"
122 #include "usb_core.h"
125 /*---------------------------------------------------*/
126 /* SPECIAL DEBUG STUFF */
127 /*---------------------------------------------------*/
128 extern struct thread_entry threads
[MAXTHREADS
];
130 static char thread_status_char(unsigned status
)
132 static const char thread_status_chars
[THREAD_NUM_STATES
+1] =
134 [0 ... THREAD_NUM_STATES
] = '?',
135 [STATE_RUNNING
] = 'R',
136 [STATE_BLOCKED
] = 'B',
137 [STATE_SLEEPING
] = 'S',
138 [STATE_BLOCKED_W_TMO
] = 'T',
139 [STATE_FROZEN
] = 'F',
140 [STATE_KILLED
] = 'K',
143 if (status
> THREAD_NUM_STATES
)
144 status
= THREAD_NUM_STATES
;
146 return thread_status_chars
[status
];
149 static const char* threads_getname(int selected_item
, void *data
,
150 char *buffer
, size_t buffer_len
)
153 struct thread_entry
*thread
;
157 if (selected_item
< (int)NUM_CORES
)
159 snprintf(buffer
, buffer_len
, "Idle (%d): %2d%%", selected_item
,
160 idle_stack_usage(selected_item
));
164 selected_item
-= NUM_CORES
;
167 thread
= &threads
[selected_item
];
169 if (thread
->state
== STATE_KILLED
)
171 snprintf(buffer
, buffer_len
, "%2d: ---", selected_item
);
175 thread_get_name(name
, 32, thread
);
177 snprintf(buffer
, buffer_len
,
178 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s",
180 IF_COP(thread
->core
,)
181 #ifdef HAVE_SCHEDULER_BOOSTCTRL
182 (thread
->cpu_boost
) ? '+' :
184 ((thread
->state
== STATE_RUNNING
) ? '*' : ' '),
185 thread_status_char(thread
->state
),
186 IF_PRIO(thread
->base_priority
, thread
->priority
, )
187 thread_stack_usage(thread
), name
);
192 static int dbg_threads_action_callback(int action
, struct gui_synclist
*lists
)
195 #ifdef ROCKBOX_HAS_LOGF
196 if (action
== ACTION_STD_OK
)
198 int selpos
= gui_synclist_get_sel_pos(lists
);
200 if (selpos
>= NUM_CORES
)
201 remove_thread(threads
[selpos
- NUM_CORES
].id
);
203 remove_thread(threads
[selpos
].id
);
205 return ACTION_REDRAW
;
207 #endif /* ROCKBOX_HAS_LOGF */
208 if (action
== ACTION_NONE
)
209 action
= ACTION_REDRAW
;
213 static bool dbg_os(void)
215 struct simplelist_info info
;
216 simplelist_info_init(&info
, IF_COP("Core and ") "Stack usage:",
220 MAXTHREADS
+NUM_CORES
,
223 #ifndef ROCKBOX_HAS_LOGF
224 info
.hide_selection
= true;
225 info
.scroll_all
= true;
227 info
.action_callback
= dbg_threads_action_callback
;
228 info
.get_name
= threads_getname
;
229 return simplelist_show_list(&info
);
232 #ifdef HAVE_LCD_BITMAP
233 #if CONFIG_CODEC != SWCODEC
235 static bool dbg_audio_thread(void)
238 struct audio_debug d
;
240 lcd_setfont(FONT_SYSFIXED
);
244 if (action_userabort(HZ
/5))
247 audio_get_debugdata(&d
);
251 snprintf(buf
, sizeof(buf
), "read: %x", d
.audiobuf_read
);
253 snprintf(buf
, sizeof(buf
), "write: %x", d
.audiobuf_write
);
255 snprintf(buf
, sizeof(buf
), "swap: %x", d
.audiobuf_swapwrite
);
257 snprintf(buf
, sizeof(buf
), "playing: %d", d
.playing
);
259 snprintf(buf
, sizeof(buf
), "playable: %x", d
.playable_space
);
261 snprintf(buf
, sizeof(buf
), "unswapped: %x", d
.unswapped_space
);
264 /* Playable space left */
265 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8, 112, 4, d
.audiobuflen
, 0,
266 d
.playable_space
, HORIZONTAL
);
268 /* Show the watermark limit */
269 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8+4, 112, 4, d
.audiobuflen
, 0,
270 d
.low_watermark_level
, HORIZONTAL
);
272 snprintf(buf
, sizeof(buf
), "wm: %x - %x",
273 d
.low_watermark_level
, d
.lowest_watermark_level
);
278 lcd_setfont(FONT_UI
);
281 #endif /* !SIMULATOR */
282 #else /* CONFIG_CODEC == SWCODEC */
283 extern size_t filebuflen
;
284 /* This is a size_t, but call it a long so it puts a - when it's bad. */
286 static unsigned int ticks
, boost_ticks
, freq_sum
;
288 static void dbg_audio_task(void)
291 if(FREQ
> CPUFREQ_NORMAL
)
293 freq_sum
+= FREQ
/1000000; /* in MHz */
298 static bool dbg_buffering_thread(void)
305 size_t bufsize
= pcmbuf_get_bufsize();
306 int pcmbufdescs
= pcmbuf_descs();
307 struct buffering_debug d
;
309 ticks
= boost_ticks
= freq_sum
= 0;
311 tick_add_task(dbg_audio_task
);
313 lcd_setfont(FONT_SYSFIXED
);
316 button
= get_action(CONTEXT_STD
,HZ
/5);
319 case ACTION_STD_NEXT
:
322 case ACTION_STD_PREV
:
325 case ACTION_STD_CANCEL
:
330 buffering_get_debugdata(&d
);
335 bufused
= bufsize
- pcmbuf_free();
337 snprintf(buf
, sizeof(buf
), "pcm: %6ld/%ld", (long) bufused
, (long) bufsize
);
338 lcd_puts(0, line
++, buf
);
340 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
341 bufsize
, 0, bufused
, HORIZONTAL
);
344 snprintf(buf
, sizeof(buf
), "alloc: %6ld/%ld", audio_filebufused(),
346 lcd_puts(0, line
++, buf
);
349 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
350 filebuflen
, 0, audio_filebufused(), HORIZONTAL
);
353 snprintf(buf
, sizeof(buf
), "real: %6ld/%ld", (long)d
.buffered_data
,
355 lcd_puts(0, line
++, buf
);
357 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
358 filebuflen
, 0, (long)d
.buffered_data
, HORIZONTAL
);
362 snprintf(buf
, sizeof(buf
), "usefl: %6ld/%ld", (long)(d
.useful_data
),
364 lcd_puts(0, line
++, buf
);
367 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
368 filebuflen
, 0, d
.useful_data
, HORIZONTAL
);
372 snprintf(buf
, sizeof(buf
), "data_rem: %ld", (long)d
.data_rem
);
373 lcd_puts(0, line
++, buf
);
375 snprintf(buf
, sizeof(buf
), "track count: %2d", audio_track_count());
376 lcd_puts(0, line
++, buf
);
378 snprintf(buf
, sizeof(buf
), "handle count: %d", (int)d
.num_handles
);
379 lcd_puts(0, line
++, buf
);
382 snprintf(buf
, sizeof(buf
), "cpu freq: %3dMHz",
383 (int)((FREQ
+ 500000) / 1000000));
384 lcd_puts(0, line
++, buf
);
389 int boostquota
= boost_ticks
* 1000 / ticks
; /* in 0.1 % */
390 int avgclock
= freq_sum
* 10 / ticks
; /* in 100 kHz */
391 snprintf(buf
, sizeof(buf
), "boost:%3d.%d%% (%d.%dMHz)",
392 boostquota
/10, boostquota
%10, avgclock
/10, avgclock
%10);
393 lcd_puts(0, line
++, buf
);
396 snprintf(buf
, sizeof(buf
), "pcmbufdesc: %2d/%2d",
397 pcmbuf_used_descs(), pcmbufdescs
);
398 lcd_puts(0, line
++, buf
);
399 snprintf(buf
, sizeof(buf
), "watermark: %6d",
401 lcd_puts(0, line
++, buf
);
406 tick_remove_task(dbg_audio_task
);
407 lcd_setfont(FONT_UI
);
411 #endif /* CONFIG_CODEC */
412 #endif /* HAVE_LCD_BITMAP */
415 #if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE))
416 /* Tool function to read the flash manufacturer and type, if available.
417 Only chips which could be reprogrammed in system will return values.
418 (The mode switch addresses vary between flash manufacturers, hence addr1/2) */
419 /* In IRAM to avoid problems when running directly from Flash */
420 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
421 unsigned addr1
, unsigned addr2
)
422 ICODE_ATTR
__attribute__((noinline
));
423 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
424 unsigned addr1
, unsigned addr2
)
427 unsigned not_manu
, not_id
; /* read values before switching to ID mode */
428 unsigned manu
, id
; /* read values when in ID mode */
430 #if CONFIG_CPU == SH7034
431 volatile unsigned char* flash
= (unsigned char*)0x2000000; /* flash mapping */
432 #elif defined(CPU_COLDFIRE)
433 volatile unsigned short* flash
= (unsigned short*)0; /* flash mapping */
435 int old_level
; /* saved interrupt level */
437 not_manu
= flash
[0]; /* read the normal content */
438 not_id
= flash
[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */
440 /* disable interrupts, prevent any stray flash access */
441 old_level
= disable_irq_save();
443 flash
[addr1
] = 0xAA; /* enter command mode */
445 flash
[addr1
] = 0x90; /* ID command */
446 /* Atmel wants 20ms pause here */
447 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
449 manu
= flash
[0]; /* read the IDs */
452 flash
[0] = 0xF0; /* reset flash (back to normal read mode) */
453 /* Atmel wants 20ms pause here */
454 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
456 restore_irq(old_level
); /* enable interrupts again */
458 /* I assume success if the obtained values are different from
459 the normal flash content. This is not perfectly bulletproof, they
460 could theoretically be the same by chance, causing us to fail. */
461 if (not_manu
!= manu
|| not_id
!= id
) /* a value has changed */
463 *p_manufacturer
= manu
; /* return the results */
465 return true; /* success */
467 return false; /* fail */
469 #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
473 static int perfcheck(void)
479 "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */
482 "ldr r0, [%[timr]] \n"
483 "add r0, r0, %[tmo] \n"
485 "add %[res], %[res], #1 \n"
486 "ldr r1, [%[timr]] \n"
489 "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */
493 [timr
]"r"(&USEC_TIMER
),
495 #if CONFIG_CPU == PP5002
497 #else /* PP5020/5022/5024 */
508 #ifdef HAVE_LCD_BITMAP
509 static bool dbg_hw_info(void)
511 #if CONFIG_CPU == SH7034
513 int bitmask
= HW_MASK
;
514 int rom_version
= ROM_VERSION
;
515 unsigned manu
, id
; /* flash IDs */
516 bool got_id
; /* flag if we managed to get the flash IDs */
517 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
518 bool has_bootrom
; /* flag for boot ROM present */
519 int oldmode
; /* saved memory guard mode */
521 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
523 /* get flash ROM type */
524 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
526 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
528 /* check if the boot ROM area is a flash mirror */
529 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
530 if (has_bootrom
) /* if ROM and Flash different */
532 /* calculate CRC16 checksum of boot ROM */
533 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
536 system_memory_guard(oldmode
); /* re-enable memory guard */
538 lcd_setfont(FONT_SYSFIXED
);
541 lcd_puts(0, 0, "[Hardware info]");
543 snprintf(buf
, 32, "ROM: %d.%02d", rom_version
/100, rom_version
%100);
546 snprintf(buf
, 32, "Mask: 0x%04x", bitmask
);
550 snprintf(buf
, 32, "Flash: M=%02x D=%02x", manu
, id
);
552 snprintf(buf
, 32, "Flash: M=?? D=??"); /* unknown, sorry */
557 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
558 snprintf(buf
, 32, "Boot ROM: V1");
560 snprintf(buf
, 32, "ROMcrc: 0x%08x", rom_crc
);
564 snprintf(buf
, 32, "Boot ROM: none");
570 while (!(action_userabort(TIMEOUT_BLOCK
)));
572 #elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
574 unsigned manu
, id
; /* flash IDs */
575 int got_id
; /* flag if we managed to get the flash IDs */
576 int oldmode
; /* saved memory guard mode */
579 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
581 /* get flash ROM type */
582 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
584 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
586 system_memory_guard(oldmode
); /* re-enable memory guard */
588 lcd_setfont(FONT_SYSFIXED
);
591 lcd_puts(0, line
++, "[Hardware info]");
594 snprintf(buf
, 32, "Flash: M=%04x D=%04x", manu
, id
);
596 snprintf(buf
, 32, "Flash: M=???? D=????"); /* unknown, sorry */
597 lcd_puts(0, line
++, buf
);
603 lcd_puts(0, ++line
, "Serial Number:");
605 got_id
= ds2411_read_id(&id
);
607 if (got_id
== DS2411_OK
)
609 snprintf(buf
, 32, " FC=%02x", (unsigned)id
.family_code
);
610 lcd_puts(0, ++line
, buf
);
611 snprintf(buf
, 32, " ID=%02X %02X %02X %02X %02X %02X",
612 (unsigned)id
.uid
[0], (unsigned)id
.uid
[1], (unsigned)id
.uid
[2],
613 (unsigned)id
.uid
[3], (unsigned)id
.uid
[4], (unsigned)id
.uid
[5]);
614 lcd_puts(0, ++line
, buf
);
615 snprintf(buf
, 32, " CRC=%02X", (unsigned)id
.crc
);
619 snprintf(buf
, 32, "READ ERR=%d", got_id
);
622 lcd_puts(0, ++line
, buf
);
628 while (!(action_userabort(TIMEOUT_BLOCK
)));
630 #elif defined(CPU_PP502x)
633 char pp_version
[] = { (PP_VER2
>> 24) & 0xff, (PP_VER2
>> 16) & 0xff,
634 (PP_VER2
>> 8) & 0xff, (PP_VER2
) & 0xff,
635 (PP_VER1
>> 24) & 0xff, (PP_VER1
>> 16) & 0xff,
636 (PP_VER1
>> 8) & 0xff, (PP_VER1
) & 0xff, '\0' };
638 lcd_setfont(FONT_SYSFIXED
);
641 lcd_puts(0, line
++, "[Hardware info]");
644 snprintf(buf
, sizeof(buf
), "HW rev: 0x%08lx", IPOD_HW_REVISION
);
645 lcd_puts(0, line
++, buf
);
649 extern int lcd_type
; /* Defined in lcd-colornano.c */
651 snprintf(buf
, sizeof(buf
), "LCD type: %d", lcd_type
);
652 lcd_puts(0, line
++, buf
);
655 snprintf(buf
, sizeof(buf
), "PP version: %s", pp_version
);
656 lcd_puts(0, line
++, buf
);
658 snprintf(buf
, sizeof(buf
), "Est. clock (kHz): %d", perfcheck());
659 lcd_puts(0, line
++, buf
);
663 while (!(action_userabort(TIMEOUT_BLOCK
)));
665 #elif CONFIG_CPU == PP5002
668 char pp_version
[] = { (PP_VER4
>> 8) & 0xff, PP_VER4
& 0xff,
669 (PP_VER3
>> 8) & 0xff, PP_VER3
& 0xff,
670 (PP_VER2
>> 8) & 0xff, PP_VER2
& 0xff,
671 (PP_VER1
>> 8) & 0xff, PP_VER1
& 0xff, '\0' };
674 lcd_setfont(FONT_SYSFIXED
);
677 lcd_puts(0, line
++, "[Hardware info]");
680 snprintf(buf
, sizeof(buf
), "HW rev: 0x%08lx", IPOD_HW_REVISION
);
681 lcd_puts(0, line
++, buf
);
684 snprintf(buf
, sizeof(buf
), "PP version: %s", pp_version
);
685 lcd_puts(0, line
++, buf
);
687 snprintf(buf
, sizeof(buf
), "Est. clock (kHz): %d", perfcheck());
688 lcd_puts(0, line
++, buf
);
692 while (!(action_userabort(TIMEOUT_BLOCK
)));
695 /* Define this function in your target tree */
696 return __dbg_hw_info();
697 #endif /* CONFIG_CPU */
698 lcd_setfont(FONT_UI
);
701 #else /* !HAVE_LCD_BITMAP */
702 static bool dbg_hw_info(void)
707 int rom_version
= ROM_VERSION
;
708 unsigned manu
, id
; /* flash IDs */
709 bool got_id
; /* flag if we managed to get the flash IDs */
710 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
711 bool has_bootrom
; /* flag for boot ROM present */
712 int oldmode
; /* saved memory guard mode */
714 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
716 /* get flash ROM type */
717 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
719 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
721 /* check if the boot ROM area is a flash mirror */
722 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
723 if (has_bootrom
) /* if ROM and Flash different */
725 /* calculate CRC16 checksum of boot ROM */
726 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
729 system_memory_guard(oldmode
); /* re-enable memory guard */
733 lcd_puts(0, 0, "[HW Info]");
739 snprintf(buf
, 32, "ROM: %d.%02d",
740 rom_version
/100, rom_version
%100);
744 snprintf(buf
, 32, "Flash:%02x,%02x", manu
, id
);
746 snprintf(buf
, 32, "Flash:??,??"); /* unknown, sorry */
751 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
752 snprintf(buf
, 32, "BootROM: V1");
753 else if (rom_crc
== 0x358099E8)
754 snprintf(buf
, 32, "BootROM: V2");
755 /* alternative boot ROM found in one single player so far */
757 snprintf(buf
, 32, "R: %08x", rom_crc
);
760 snprintf(buf
, 32, "BootROM: no");
766 button
= get_action(CONTEXT_SETTINGS
,TIMEOUT_BLOCK
);
770 case ACTION_STD_CANCEL
:
773 case ACTION_SETTINGS_DEC
:
779 case ACTION_SETTINGS_INC
:
788 #endif /* !HAVE_LCD_BITMAP */
789 #endif /* !SIMULATOR */
792 static const char* dbg_partitions_getname(int selected_item
, void *data
,
793 char *buffer
, size_t buffer_len
)
796 int partition
= selected_item
/2;
797 struct partinfo
* p
= disk_partinfo(partition
);
800 snprintf(buffer
, buffer_len
, " T:%x %ld MB", p
->type
, p
->size
/ 2048);
804 snprintf(buffer
, buffer_len
, "P%d: S:%lx", partition
, p
->start
);
809 bool dbg_partitions(void)
811 struct simplelist_info info
;
812 simplelist_info_init(&info
, "Partition Info", 4, NULL
);
813 info
.selection_size
= 2;
814 info
.hide_selection
= true;
815 info
.scroll_all
= true;
816 info
.get_name
= dbg_partitions_getname
;
817 return simplelist_show_list(&info
);
821 #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
822 static bool dbg_spdif(void)
826 unsigned int control
;
831 unsigned int interruptstat
;
832 bool valnogood
, symbolerr
, parityerr
;
835 int spdif_source
= spdif_get_output_source(&spdif_src_on
);
836 spdif_set_output_source(AUDIO_SRC_SPDIF
IF_SPDIF_POWER_(, true));
839 lcd_setfont(FONT_SYSFIXED
);
841 #ifdef HAVE_SPDIF_POWER
842 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
849 control
= EBU1RCVCCHANNEL1
;
850 interruptstat
= INTERRUPTSTAT
;
851 INTERRUPTCLEAR
= 0x03c00000;
853 valnogood
= (interruptstat
& 0x01000000)?true:false;
854 symbolerr
= (interruptstat
& 0x00800000)?true:false;
855 parityerr
= (interruptstat
& 0x00400000)?true:false;
857 snprintf(buf
, sizeof(buf
), "Val: %s Sym: %s Par: %s",
860 parityerr
?"--":"OK");
861 lcd_puts(0, line
++, buf
);
863 snprintf(buf
, sizeof(buf
), "Status word: %08x", (int)control
);
864 lcd_puts(0, line
++, buf
);
869 snprintf(buf
, sizeof(buf
), "PRO: %d (%s)",
870 x
, x
?"Professional":"Consumer");
871 lcd_puts(0, line
++, buf
);
873 x
= (control
>> 30) & 1;
874 snprintf(buf
, sizeof(buf
), "Audio: %d (%s)",
875 x
, x
?"Non-PCM":"PCM");
876 lcd_puts(0, line
++, buf
);
878 x
= (control
>> 29) & 1;
879 snprintf(buf
, sizeof(buf
), "Copy: %d (%s)",
880 x
, x
?"Permitted":"Inhibited");
881 lcd_puts(0, line
++, buf
);
883 x
= (control
>> 27) & 7;
896 snprintf(buf
, sizeof(buf
), "Preemphasis: %d (%s)", x
, s
);
897 lcd_puts(0, line
++, buf
);
899 x
= (control
>> 24) & 3;
900 snprintf(buf
, sizeof(buf
), "Mode: %d", x
);
901 lcd_puts(0, line
++, buf
);
903 category
= (control
>> 17) & 127;
915 snprintf(buf
, sizeof(buf
), "Category: 0x%02x (%s)", category
, s
);
916 lcd_puts(0, line
++, buf
);
918 x
= (control
>> 16) & 1;
920 if(((category
& 0x70) == 0x10) ||
921 ((category
& 0x70) == 0x40) ||
922 ((category
& 0x78) == 0x38))
924 generation
= !generation
;
926 snprintf(buf
, sizeof(buf
), "Generation: %d (%s)",
927 x
, generation
?"Original":"No ind.");
928 lcd_puts(0, line
++, buf
);
930 x
= (control
>> 12) & 15;
931 snprintf(buf
, sizeof(buf
), "Source: %d", x
);
932 lcd_puts(0, line
++, buf
);
934 x
= (control
>> 8) & 15;
950 snprintf(buf
, sizeof(buf
), "Channel: %d (%s)", x
, s
);
951 lcd_puts(0, line
++, buf
);
953 x
= (control
>> 4) & 15;
966 snprintf(buf
, sizeof(buf
), "Frequency: %d (%s)", x
, s
);
967 lcd_puts(0, line
++, buf
);
969 x
= (control
>> 2) & 3;
970 snprintf(buf
, sizeof(buf
), "Clock accuracy: %d", x
);
971 lcd_puts(0, line
++, buf
);
975 snprintf(buf
, sizeof(buf
), "Measured freq: %ldHz",
976 spdif_measure_frequency());
977 lcd_puts(0, line
++, buf
);
982 if (action_userabort(HZ
/10))
986 spdif_set_output_source(spdif_source
IF_SPDIF_POWER_(, spdif_src_on
));
988 #ifdef HAVE_SPDIF_POWER
989 spdif_power_enable(global_settings
.spdif_enable
);
992 lcd_setfont(FONT_UI
);
995 #endif /* CPU_COLDFIRE */
998 #ifdef HAVE_LCD_BITMAP
999 /* button definitions */
1000 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
1001 (CONFIG_KEYPAD == IRIVER_H300_PAD)
1002 # define DEBUG_CANCEL BUTTON_OFF
1004 #elif CONFIG_KEYPAD == RECORDER_PAD
1005 # define DEBUG_CANCEL BUTTON_OFF
1007 #elif CONFIG_KEYPAD == ONDIO_PAD
1008 # define DEBUG_CANCEL BUTTON_MENU
1010 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
1011 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
1012 (CONFIG_KEYPAD == IPOD_4G_PAD)
1013 # define DEBUG_CANCEL BUTTON_MENU
1015 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
1016 # define DEBUG_CANCEL BUTTON_PLAY
1018 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
1019 # define DEBUG_CANCEL BUTTON_REC
1021 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
1022 # define DEBUG_CANCEL BUTTON_RC_REC
1024 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
1025 # define DEBUG_CANCEL BUTTON_REW
1027 #elif (CONFIG_KEYPAD == MROBE100_PAD)
1028 # define DEBUG_CANCEL BUTTON_MENU
1030 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
1031 (CONFIG_KEYPAD == SANSA_C200_PAD) || \
1032 (CONFIG_KEYPAD == SANSA_FUZE_PAD)
1033 # define DEBUG_CANCEL BUTTON_LEFT
1035 /* This is temporary until the SA9200 touchpad works */
1036 #elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
1037 (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
1038 # define DEBUG_CANCEL BUTTON_POWER
1040 #elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
1041 # define DEBUG_CANCEL BUTTON_PLAY
1043 #endif /* key definitions */
1046 bool dbg_ports(void)
1048 #if CONFIG_CPU == SH7034
1050 int adc_battery_voltage
, adc_battery_level
;
1052 lcd_setfont(FONT_SYSFIXED
);
1053 lcd_clear_display();
1057 snprintf(buf
, 32, "PADR: %04x", (unsigned short)PADR
);
1058 lcd_puts(0, 0, buf
);
1059 snprintf(buf
, 32, "PBDR: %04x", (unsigned short)PBDR
);
1060 lcd_puts(0, 1, buf
);
1062 snprintf(buf
, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
1063 lcd_puts(0, 2, buf
);
1064 snprintf(buf
, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
1065 lcd_puts(0, 3, buf
);
1066 snprintf(buf
, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
1067 lcd_puts(0, 4, buf
);
1068 snprintf(buf
, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
1069 lcd_puts(0, 5, buf
);
1071 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1072 snprintf(buf
, 32, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1073 adc_battery_voltage
% 1000, adc_battery_level
);
1074 lcd_puts(0, 6, buf
);
1077 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1079 lcd_setfont(FONT_UI
);
1083 #elif defined(CPU_COLDFIRE)
1084 unsigned int gpio_out
;
1085 unsigned int gpio1_out
;
1086 unsigned int gpio_read
;
1087 unsigned int gpio1_read
;
1088 unsigned int gpio_function
;
1089 unsigned int gpio1_function
;
1090 unsigned int gpio_enable
;
1091 unsigned int gpio1_enable
;
1092 int adc_buttons
, adc_remote
;
1093 int adc_battery_voltage
, adc_battery_level
;
1097 lcd_clear_display();
1098 lcd_setfont(FONT_SYSFIXED
);
1103 gpio_read
= GPIO_READ
;
1104 gpio1_read
= GPIO1_READ
;
1105 gpio_out
= GPIO_OUT
;
1106 gpio1_out
= GPIO1_OUT
;
1107 gpio_function
= GPIO_FUNCTION
;
1108 gpio1_function
= GPIO1_FUNCTION
;
1109 gpio_enable
= GPIO_ENABLE
;
1110 gpio1_enable
= GPIO1_ENABLE
;
1112 snprintf(buf
, sizeof(buf
), "GPIO_READ: %08x", gpio_read
);
1113 lcd_puts(0, line
++, buf
);
1114 snprintf(buf
, sizeof(buf
), "GPIO_OUT: %08x", gpio_out
);
1115 lcd_puts(0, line
++, buf
);
1116 snprintf(buf
, sizeof(buf
), "GPIO_FUNC: %08x", gpio_function
);
1117 lcd_puts(0, line
++, buf
);
1118 snprintf(buf
, sizeof(buf
), "GPIO_ENA: %08x", gpio_enable
);
1119 lcd_puts(0, line
++, buf
);
1121 snprintf(buf
, sizeof(buf
), "GPIO1_READ: %08x", gpio1_read
);
1122 lcd_puts(0, line
++, buf
);
1123 snprintf(buf
, sizeof(buf
), "GPIO1_OUT: %08x", gpio1_out
);
1124 lcd_puts(0, line
++, buf
);
1125 snprintf(buf
, sizeof(buf
), "GPIO1_FUNC: %08x", gpio1_function
);
1126 lcd_puts(0, line
++, buf
);
1127 snprintf(buf
, sizeof(buf
), "GPIO1_ENA: %08x", gpio1_enable
);
1128 lcd_puts(0, line
++, buf
);
1130 adc_buttons
= adc_read(ADC_BUTTONS
);
1131 adc_remote
= adc_read(ADC_REMOTE
);
1132 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1133 #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
1134 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS (%c): %02x",
1135 button_scan_enabled() ? '+' : '-', adc_buttons
);
1137 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS: %02x", adc_buttons
);
1139 lcd_puts(0, line
++, buf
);
1140 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
1141 snprintf(buf
, sizeof(buf
), "ADC_REMOTE (%c): %02x",
1142 remote_detect() ? '+' : '-', adc_remote
);
1144 snprintf(buf
, sizeof(buf
), "ADC_REMOTE: %02x", adc_remote
);
1146 lcd_puts(0, line
++, buf
);
1147 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1148 snprintf(buf
, sizeof(buf
), "ADC_REMOTEDETECT: %02x",
1149 adc_read(ADC_REMOTEDETECT
));
1150 lcd_puts(0, line
++, buf
);
1153 snprintf(buf
, 32, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1154 adc_battery_voltage
% 1000, adc_battery_level
);
1155 lcd_puts(0, line
++, buf
);
1157 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1158 snprintf(buf
, sizeof(buf
), "remotetype: %d", remote_type());
1159 lcd_puts(0, line
++, buf
);
1163 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1165 lcd_setfont(FONT_UI
);
1170 #elif defined(CPU_PP502x)
1175 lcd_clear_display();
1176 lcd_setfont(FONT_SYSFIXED
);
1181 lcd_puts(0, line
++, "GPIO STATES:");
1182 snprintf(buf
, sizeof(buf
), "A: %02x E: %02x I: %02x",
1183 (unsigned int)GPIOA_INPUT_VAL
,
1184 (unsigned int)GPIOE_INPUT_VAL
,
1185 (unsigned int)GPIOI_INPUT_VAL
);
1186 lcd_puts(0, line
++, buf
);
1187 snprintf(buf
, sizeof(buf
), "B: %02x F: %02x J: %02x",
1188 (unsigned int)GPIOB_INPUT_VAL
,
1189 (unsigned int)GPIOF_INPUT_VAL
,
1190 (unsigned int)GPIOJ_INPUT_VAL
);
1191 lcd_puts(0, line
++, buf
);
1192 snprintf(buf
, sizeof(buf
), "C: %02x G: %02x K: %02x",
1193 (unsigned int)GPIOC_INPUT_VAL
,
1194 (unsigned int)GPIOG_INPUT_VAL
,
1195 (unsigned int)GPIOK_INPUT_VAL
);
1196 lcd_puts(0, line
++, buf
);
1197 snprintf(buf
, sizeof(buf
), "D: %02x H: %02x L: %02x",
1198 (unsigned int)GPIOD_INPUT_VAL
,
1199 (unsigned int)GPIOH_INPUT_VAL
,
1200 (unsigned int)GPIOL_INPUT_VAL
);
1201 lcd_puts(0, line
++, buf
);
1203 snprintf(buf
, sizeof(buf
), "GPO32_VAL: %08lx", GPO32_VAL
);
1204 lcd_puts(0, line
++, buf
);
1205 snprintf(buf
, sizeof(buf
), "GPO32_EN: %08lx", GPO32_ENABLE
);
1206 lcd_puts(0, line
++, buf
);
1207 snprintf(buf
, sizeof(buf
), "DEV_EN: %08lx", DEV_EN
);
1208 lcd_puts(0, line
++, buf
);
1209 snprintf(buf
, sizeof(buf
), "DEV_EN2: %08lx", DEV_EN2
);
1210 lcd_puts(0, line
++, buf
);
1211 snprintf(buf
, sizeof(buf
), "DEV_EN3: %08lx", inl(0x60006044));
1212 lcd_puts(0, line
++, buf
); /* to be verified */
1213 snprintf(buf
, sizeof(buf
), "DEV_INIT1: %08lx", DEV_INIT1
);
1214 lcd_puts(0, line
++, buf
);
1215 snprintf(buf
, sizeof(buf
), "DEV_INIT2: %08lx", DEV_INIT2
);
1216 lcd_puts(0, line
++, buf
);
1217 #ifdef ADC_ACCESSORY
1218 snprintf(buf
, sizeof(buf
), "ACCESSORY: %d", adc_read(ADC_ACCESSORY
));
1219 lcd_puts(0, line
++, buf
);
1222 #if defined(IPOD_ACCESSORY_PROTOCOL)
1223 extern unsigned char serbuf
[];
1224 snprintf(buf
, sizeof(buf
), "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
1225 serbuf
[0], serbuf
[1], serbuf
[2], serbuf
[3], serbuf
[4], serbuf
[5],
1226 serbuf
[6], serbuf
[7]);
1227 lcd_puts(0, line
++, buf
);
1230 #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1232 snprintf(buf
, sizeof(buf
), "BATT: %03x UNK1: %03x",
1233 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1234 lcd_puts(0, line
++, buf
);
1235 snprintf(buf
, sizeof(buf
), "REM: %03x PAD: %03x",
1236 adc_read(ADC_REMOTE
), adc_read(ADC_SCROLLPAD
));
1237 lcd_puts(0, line
++, buf
);
1238 #elif defined(PHILIPS_HDD1630)
1240 snprintf(buf
, sizeof(buf
), "BATT: %03x UNK1: %03x",
1241 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1242 lcd_puts(0, line
++, buf
);
1243 #elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
1244 snprintf(buf
, sizeof(buf
), "ADC_BVDD: %4d", adc_read(ADC_BVDD
));
1245 lcd_puts(0, line
++, buf
);
1246 snprintf(buf
, sizeof(buf
), "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP
));
1247 lcd_puts(0, line
++, buf
);
1248 snprintf(buf
, sizeof(buf
), "ADC_UVDD: %4d", adc_read(ADC_UVDD
));
1249 lcd_puts(0, line
++, buf
);
1250 snprintf(buf
, sizeof(buf
), "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN
));
1251 lcd_puts(0, line
++, buf
);
1252 snprintf(buf
, sizeof(buf
), "ADC_CVDD: %4d", adc_read(ADC_CVDD
));
1253 lcd_puts(0, line
++, buf
);
1254 snprintf(buf
, sizeof(buf
), "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP
));
1255 lcd_puts(0, line
++, buf
);
1256 snprintf(buf
, sizeof(buf
), "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1
));
1257 lcd_puts(0, line
++, buf
);
1258 snprintf(buf
, sizeof(buf
), "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2
));
1259 lcd_puts(0, line
++, buf
);
1260 snprintf(buf
, sizeof(buf
), "ADC_VBE1: %4d", adc_read(ADC_VBE1
));
1261 lcd_puts(0, line
++, buf
);
1262 snprintf(buf
, sizeof(buf
), "ADC_VBE2: %4d", adc_read(ADC_VBE2
));
1263 lcd_puts(0, line
++, buf
);
1264 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1
));
1265 lcd_puts(0, line
++, buf
);
1266 #if !defined(PHILIPS_SA9200)
1267 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2
));
1268 lcd_puts(0, line
++, buf
);
1269 snprintf(buf
, sizeof(buf
), "ADC_VBAT: %4d", adc_read(ADC_VBAT
));
1270 lcd_puts(0, line
++, buf
);
1274 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1276 lcd_setfont(FONT_UI
);
1281 #elif CONFIG_CPU == PP5002
1285 lcd_clear_display();
1286 lcd_setfont(FONT_SYSFIXED
);
1291 snprintf(buf
, sizeof(buf
), "GPIO_A: %02x GPIO_B: %02x",
1292 (unsigned int)GPIOA_INPUT_VAL
, (unsigned int)GPIOB_INPUT_VAL
);
1293 lcd_puts(0, line
++, buf
);
1294 snprintf(buf
, sizeof(buf
), "GPIO_C: %02x GPIO_D: %02x",
1295 (unsigned int)GPIOC_INPUT_VAL
, (unsigned int)GPIOD_INPUT_VAL
);
1296 lcd_puts(0, line
++, buf
);
1298 snprintf(buf
, sizeof(buf
), "DEV_EN: %08lx", DEV_EN
);
1299 lcd_puts(0, line
++, buf
);
1300 snprintf(buf
, sizeof(buf
), "CLOCK_ENABLE: %08lx", CLOCK_ENABLE
);
1301 lcd_puts(0, line
++, buf
);
1302 snprintf(buf
, sizeof(buf
), "CLOCK_SOURCE: %08lx", CLOCK_SOURCE
);
1303 lcd_puts(0, line
++, buf
);
1304 snprintf(buf
, sizeof(buf
), "PLL_CONTROL: %08lx", PLL_CONTROL
);
1305 lcd_puts(0, line
++, buf
);
1306 snprintf(buf
, sizeof(buf
), "PLL_DIV: %08lx", PLL_DIV
);
1307 lcd_puts(0, line
++, buf
);
1308 snprintf(buf
, sizeof(buf
), "PLL_MULT: %08lx", PLL_MULT
);
1309 lcd_puts(0, line
++, buf
);
1310 snprintf(buf
, sizeof(buf
), "TIMING1_CTL: %08lx", TIMING1_CTL
);
1311 lcd_puts(0, line
++, buf
);
1312 snprintf(buf
, sizeof(buf
), "TIMING2_CTL: %08lx", TIMING2_CTL
);
1313 lcd_puts(0, line
++, buf
);
1316 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1318 lcd_setfont(FONT_UI
);
1322 lcd_setfont(FONT_UI
);
1324 return __dbg_ports();
1328 #else /* !HAVE_LCD_BITMAP */
1329 bool dbg_ports(void)
1333 int adc_battery_voltage
;
1336 lcd_clear_display();
1343 snprintf(buf
, 32, "PADR: %04x", (unsigned short)PADR
);
1346 snprintf(buf
, 32, "PBDR: %04x", (unsigned short)PBDR
);
1349 snprintf(buf
, 32, "AN0: %03x", adc_read(0));
1352 snprintf(buf
, 32, "AN1: %03x", adc_read(1));
1355 snprintf(buf
, 32, "AN2: %03x", adc_read(2));
1358 snprintf(buf
, 32, "AN3: %03x", adc_read(3));
1361 snprintf(buf
, 32, "AN4: %03x", adc_read(4));
1364 snprintf(buf
, 32, "AN5: %03x", adc_read(5));
1367 snprintf(buf
, 32, "AN6: %03x", adc_read(6));
1370 snprintf(buf
, 32, "AN7: %03x", adc_read(7));
1373 lcd_puts(0, 0, buf
);
1375 battery_read_info(&adc_battery_voltage
, NULL
);
1376 snprintf(buf
, 32, "Batt: %d.%03dV", adc_battery_voltage
/ 1000,
1377 adc_battery_voltage
% 1000);
1378 lcd_puts(0, 1, buf
);
1381 button
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1385 case ACTION_STD_CANCEL
:
1388 case ACTION_SETTINGS_DEC
:
1394 case ACTION_SETTINGS_INC
:
1403 #endif /* !HAVE_LCD_BITMAP */
1404 #endif /* !SIMULATOR */
1406 #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
1407 static bool dbg_pcf(void)
1412 #ifdef HAVE_LCD_BITMAP
1413 lcd_setfont(FONT_SYSFIXED
);
1415 lcd_clear_display();
1421 snprintf(buf
, sizeof(buf
), "DCDC1: %02x", pcf50605_read(0x1b));
1422 lcd_puts(0, line
++, buf
);
1423 snprintf(buf
, sizeof(buf
), "DCDC2: %02x", pcf50605_read(0x1c));
1424 lcd_puts(0, line
++, buf
);
1425 snprintf(buf
, sizeof(buf
), "DCDC3: %02x", pcf50605_read(0x1d));
1426 lcd_puts(0, line
++, buf
);
1427 snprintf(buf
, sizeof(buf
), "DCDC4: %02x", pcf50605_read(0x1e));
1428 lcd_puts(0, line
++, buf
);
1429 snprintf(buf
, sizeof(buf
), "DCDEC1: %02x", pcf50605_read(0x1f));
1430 lcd_puts(0, line
++, buf
);
1431 snprintf(buf
, sizeof(buf
), "DCDEC2: %02x", pcf50605_read(0x20));
1432 lcd_puts(0, line
++, buf
);
1433 snprintf(buf
, sizeof(buf
), "DCUDC1: %02x", pcf50605_read(0x21));
1434 lcd_puts(0, line
++, buf
);
1435 snprintf(buf
, sizeof(buf
), "DCUDC2: %02x", pcf50605_read(0x22));
1436 lcd_puts(0, line
++, buf
);
1437 snprintf(buf
, sizeof(buf
), "IOREGC: %02x", pcf50605_read(0x23));
1438 lcd_puts(0, line
++, buf
);
1439 snprintf(buf
, sizeof(buf
), "D1REGC: %02x", pcf50605_read(0x24));
1440 lcd_puts(0, line
++, buf
);
1441 snprintf(buf
, sizeof(buf
), "D2REGC: %02x", pcf50605_read(0x25));
1442 lcd_puts(0, line
++, buf
);
1443 snprintf(buf
, sizeof(buf
), "D3REGC: %02x", pcf50605_read(0x26));
1444 lcd_puts(0, line
++, buf
);
1445 snprintf(buf
, sizeof(buf
), "LPREG1: %02x", pcf50605_read(0x27));
1446 lcd_puts(0, line
++, buf
);
1449 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1451 lcd_setfont(FONT_UI
);
1456 lcd_setfont(FONT_UI
);
1461 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
1462 static bool dbg_cpufreq(void)
1468 #ifdef HAVE_LCD_BITMAP
1469 lcd_setfont(FONT_SYSFIXED
);
1471 lcd_clear_display();
1477 snprintf(buf
, sizeof(buf
), "Frequency: %ld", FREQ
);
1478 lcd_puts(0, line
++, buf
);
1480 snprintf(buf
, sizeof(buf
), "boost_counter: %d", get_cpu_boost_counter());
1481 lcd_puts(0, line
++, buf
);
1484 button
= get_action(CONTEXT_STD
,HZ
/10);
1488 case ACTION_STD_PREV
:
1492 case ACTION_STD_NEXT
:
1497 while (get_cpu_boost_counter() > 0)
1499 set_cpu_frequency(CPUFREQ_DEFAULT
);
1502 case ACTION_STD_CANCEL
:
1503 lcd_setfont(FONT_UI
);
1507 lcd_setfont(FONT_UI
);
1510 #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1512 #if defined(HAVE_TSC2100) && !defined(SIMULATOR)
1513 #include "tsc2100.h"
1514 static char *itob(int n
, int len
)
1516 static char binary
[64];
1518 for (i
=1, j
=0;i
<=len
;i
++)
1520 binary
[j
++] = n
&(1<<(len
-i
))?'1':'0';
1528 static const char* tsc2100_debug_getname(int selected_item
, void * data
,
1529 char *buffer
, size_t buffer_len
)
1531 int *page
= (int*)data
;
1532 bool reserved
= false;
1536 if ((selected_item
> 0x0a) ||
1537 (selected_item
== 0x04) ||
1538 (selected_item
== 0x08))
1542 if ((selected_item
> 0x05) ||
1543 (selected_item
== 0x02))
1547 if (selected_item
> 0x1e)
1552 snprintf(buffer
, buffer_len
, "%02x: RESERVED", selected_item
);
1554 snprintf(buffer
, buffer_len
, "%02x: %s", selected_item
,
1555 itob(tsc2100_readreg(*page
, selected_item
)&0xffff,16));
1558 static int tsc2100debug_action_callback(int action
, struct gui_synclist
*lists
)
1560 int *page
= (int*)lists
->data
;
1561 if (action
== ACTION_STD_OK
)
1563 *page
= (*page
+1)%3;
1564 snprintf(lists
->title
, 32,
1565 "tsc2100 registers - Page %d", *page
);
1566 return ACTION_REDRAW
;
1570 static bool tsc2100_debug(void)
1573 char title
[32] = "tsc2100 registers - Page 0";
1574 struct simplelist_info info
;
1575 simplelist_info_init(&info
, title
, 32, &page
);
1576 info
.timeout
= HZ
/100;
1577 info
.get_name
= tsc2100_debug_getname
;
1578 info
.action_callback
= tsc2100debug_action_callback
;
1579 return simplelist_show_list(&info
);
1583 #ifdef HAVE_LCD_BITMAP
1585 * view_battery() shows a automatically scaled graph of the battery voltage
1586 * over time. Usable for estimating battery life / charging rate.
1587 * The power_history array is updated in power_thread of powermgmt.c.
1590 #define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
1591 #define BAT_YSPACE (LCD_HEIGHT - 20)
1593 static bool view_battery(void)
1597 unsigned short maxv
, minv
;
1600 lcd_setfont(FONT_SYSFIXED
);
1604 lcd_clear_display();
1606 case 0: /* voltage history graph */
1607 /* Find maximum and minimum voltage for scaling */
1608 minv
= power_history
[0];
1610 for (i
= 1; i
< BAT_LAST_VAL
&& power_history
[i
]; i
++) {
1611 if (power_history
[i
] > maxv
)
1612 maxv
= power_history
[i
];
1613 if (power_history
[i
] < minv
)
1614 minv
= power_history
[i
];
1617 snprintf(buf
, 30, "Battery %d.%03d", power_history
[0] / 1000,
1618 power_history
[0] % 1000);
1619 lcd_puts(0, 0, buf
);
1620 snprintf(buf
, 30, "scale %d.%03d-%d.%03dV",
1621 minv
/ 1000, minv
% 1000, maxv
/ 1000, maxv
% 1000);
1622 lcd_puts(0, 1, buf
);
1625 for (i
= BAT_LAST_VAL
- 1; i
>= 0; i
--) {
1626 y
= (power_history
[i
] - minv
) * BAT_YSPACE
/ (maxv
- minv
);
1627 lcd_set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
1628 lcd_vline(x
, LCD_HEIGHT
-1, 20);
1629 lcd_set_drawmode(DRMODE_SOLID
);
1630 lcd_vline(x
, LCD_HEIGHT
-1,
1631 MIN(MAX(LCD_HEIGHT
-1 - y
, 20), LCD_HEIGHT
-1));
1637 case 1: /* status: */
1638 lcd_puts(0, 0, "Power status:");
1640 battery_read_info(&y
, NULL
);
1641 snprintf(buf
, 30, "Battery: %d.%03d V", y
/ 1000, y
% 1000);
1642 lcd_puts(0, 1, buf
);
1643 #ifdef ADC_EXT_POWER
1644 y
= (adc_read(ADC_EXT_POWER
) * EXT_SCALE_FACTOR
) / 1000;
1645 snprintf(buf
, 30, "External: %d.%03d V", y
/ 1000, y
% 1000);
1646 lcd_puts(0, 2, buf
);
1649 #if defined ARCHOS_RECORDER
1650 snprintf(buf
, 30, "Chgr: %s %s",
1651 charger_inserted() ? "present" : "absent",
1652 charger_enabled() ? "on" : "off");
1653 lcd_puts(0, 3, buf
);
1654 snprintf(buf
, 30, "short delta: %d", short_delta
);
1655 lcd_puts(0, 5, buf
);
1656 snprintf(buf
, 30, "long delta: %d", long_delta
);
1657 lcd_puts(0, 6, buf
);
1658 lcd_puts(0, 7, power_message
);
1659 snprintf(buf
, 30, "USB Inserted: %s",
1660 usb_inserted() ? "yes" : "no");
1661 lcd_puts(0, 8, buf
);
1662 #elif defined IRIVER_H300_SERIES
1663 snprintf(buf
, 30, "USB Charging Enabled: %s",
1664 usb_charging_enabled() ? "yes" : "no");
1665 lcd_puts(0, 9, buf
);
1666 #elif defined IPOD_NANO || defined IPOD_VIDEO
1667 int usb_pwr
= (GPIOL_INPUT_VAL
& 0x10)?true:false;
1668 int ext_pwr
= (GPIOL_INPUT_VAL
& 0x08)?false:true;
1669 int dock
= (GPIOA_INPUT_VAL
& 0x10)?true:false;
1670 int charging
= (GPIOB_INPUT_VAL
& 0x01)?false:true;
1671 int headphone
= (GPIOA_INPUT_VAL
& 0x80)?true:false;
1673 snprintf(buf
, 30, "USB pwr: %s",
1674 usb_pwr
? "present" : "absent");
1675 lcd_puts(0, 3, buf
);
1676 snprintf(buf
, 30, "EXT pwr: %s",
1677 ext_pwr
? "present" : "absent");
1678 lcd_puts(0, 4, buf
);
1679 snprintf(buf
, 30, "Battery: %s",
1680 charging
? "charging" : (usb_pwr
||ext_pwr
) ? "charged" : "discharging");
1681 lcd_puts(0, 5, buf
);
1682 snprintf(buf
, 30, "Dock mode: %s",
1683 dock
? "enabled" : "disabled");
1684 lcd_puts(0, 6, buf
);
1685 snprintf(buf
, 30, "Headphone: %s",
1686 headphone
? "connected" : "disconnected");
1687 lcd_puts(0, 7, buf
);
1688 #elif defined TOSHIBA_GIGABEAT_S
1692 static const unsigned char * const chrgstate_strings
[] =
1703 snprintf(buf
, 30, "Charger: %s",
1704 charger_inserted() ? "present" : "absent");
1705 lcd_puts(0, line
++, buf
);
1707 st
= power_input_status() &
1708 (POWER_INPUT_CHARGER
| POWER_INPUT_BATTERY
);
1709 snprintf(buf
, 30, "%s%s",
1710 (st
& POWER_INPUT_MAIN_CHARGER
) ? " Main" : "",
1711 (st
& POWER_INPUT_USB_CHARGER
) ? " USB" : "");
1712 lcd_puts(0, line
++, buf
);
1714 snprintf(buf
, 30, "IUSB Max: %d", usb_allowed_current());
1715 lcd_puts(0, line
++, buf
);
1717 y
= ARRAYLEN(chrgstate_strings
) - 1;
1719 switch (charge_state
)
1721 case CHARGE_STATE_DISABLED
: y
--;
1722 case CHARGE_STATE_ERROR
: y
--;
1723 case DISCHARGING
: y
--;
1730 snprintf(buf
, 30, "State: %s", chrgstate_strings
[y
]);
1731 lcd_puts(0, line
++, buf
);
1733 snprintf(buf
, 30, "Battery Switch: %s",
1734 (st
& POWER_INPUT_BATTERY
) ? "On" : "Off");
1735 lcd_puts(0, line
++, buf
);
1737 y
= chrgraw_adc_voltage();
1738 snprintf(buf
, 30, "CHRGRAW: %d.%03d V",
1739 y
/ 1000, y
% 1000);
1740 lcd_puts(0, line
++, buf
);
1742 y
= application_supply_adc_voltage();
1743 snprintf(buf
, 30, "BP : %d.%03d V",
1744 y
/ 1000, y
% 1000);
1745 lcd_puts(0, line
++, buf
);
1747 y
= battery_adc_charge_current();
1748 if (y
< 0) x
= '-', y
= -y
;
1750 snprintf(buf
, 30, "CHRGISN:%c%d mA", x
, y
);
1751 lcd_puts(0, line
++, buf
);
1753 y
= cccv_regulator_dissipation();
1754 snprintf(buf
, 30, "P CCCV : %d mW", y
);
1755 lcd_puts(0, line
++, buf
);
1757 y
= battery_charge_current();
1758 if (y
< 0) x
= '-', y
= -y
;
1760 snprintf(buf
, 30, "I Charge:%c%d mA", x
, y
);
1761 lcd_puts(0, line
++, buf
);
1763 y
= battery_adc_temp();
1766 snprintf(buf
, 30, "T Battery: %dC (%dF)", y
,
1769 /* Conversion disabled */
1770 snprintf(buf
, 30, "T Battery: ?");
1773 lcd_puts(0, line
++, buf
);
1774 #elif defined(SANSA_E200) || defined(SANSA_C200) || defined(SANSA_CLIP) || defined(SANSA_FUZE)
1775 const int first
= CHARGE_STATE_DISABLED
;
1776 static const char * const chrgstate_strings
[] =
1778 [CHARGE_STATE_DISABLED
-first
] = "Disabled",
1779 [CHARGE_STATE_ERROR
-first
] = "Error",
1780 [DISCHARGING
-first
] = "Discharging",
1781 [CHARGING
-first
] = "Charging",
1783 const char *str
= NULL
;
1785 snprintf(buf
, 30, "Charger: %s",
1786 charger_inserted() ? "present" : "absent");
1787 lcd_puts(0, 3, buf
);
1789 y
= charge_state
- first
;
1790 if ((unsigned)y
< ARRAYLEN(chrgstate_strings
))
1791 str
= chrgstate_strings
[y
];
1793 snprintf(buf
, sizeof(buf
), "State: %s",
1794 str
? str
: "<unknown>");
1795 lcd_puts(0, 4, buf
);
1797 snprintf(buf
, sizeof(buf
), "CHARGER: %02X",
1798 ascodec_read(AS3514_CHARGER
));
1799 lcd_puts(0, 5, buf
);
1800 #elif defined(IPOD_NANO2G)
1801 y
= pmu_read_battery_current();
1802 snprintf(buf
, 30, "Battery current: %d mA", y
);
1803 lcd_puts(0, 2, buf
);
1805 snprintf(buf
, 30, "Charger: %s",
1806 charger_inserted() ? "present" : "absent");
1807 lcd_puts(0, 3, buf
);
1808 #endif /* target type */
1809 #endif /* CONFIG_CHARGING */
1812 case 2: /* voltage deltas: */
1813 lcd_puts(0, 0, "Voltage deltas:");
1815 for (i
= 0; i
<= 6; i
++) {
1816 y
= power_history
[i
] - power_history
[i
+1];
1817 snprintf(buf
, 30, "-%d min: %s%d.%03d V", i
,
1818 (y
< 0) ? "-" : "", ((y
< 0) ? y
* -1 : y
) / 1000,
1819 ((y
< 0) ? y
* -1 : y
) % 1000);
1820 lcd_puts(0, i
+1, buf
);
1824 case 3: /* remaining time estimation: */
1826 #ifdef ARCHOS_RECORDER
1827 snprintf(buf
, 30, "charge_state: %d", charge_state
);
1828 lcd_puts(0, 0, buf
);
1830 snprintf(buf
, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min
);
1831 lcd_puts(0, 1, buf
);
1833 snprintf(buf
, 30, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level
);
1834 lcd_puts(0, 2, buf
);
1836 snprintf(buf
, 30, "P=%2d I=%2d", pid_p
, pid_i
);
1837 lcd_puts(0, 3, buf
);
1839 snprintf(buf
, 30, "Trickle sec: %d/60", trickle_sec
);
1840 lcd_puts(0, 4, buf
);
1841 #endif /* ARCHOS_RECORDER */
1843 snprintf(buf
, 30, "Last PwrHist: %d.%03dV",
1844 power_history
[0] / 1000,
1845 power_history
[0] % 1000);
1846 lcd_puts(0, 5, buf
);
1848 snprintf(buf
, 30, "battery level: %d%%", battery_level());
1849 lcd_puts(0, 6, buf
);
1851 snprintf(buf
, 30, "Est. remain: %d m", battery_time());
1852 lcd_puts(0, 7, buf
);
1858 switch(get_action(CONTEXT_STD
,HZ
/2))
1860 case ACTION_STD_PREV
:
1865 case ACTION_STD_NEXT
:
1870 case ACTION_STD_CANCEL
:
1871 lcd_setfont(FONT_UI
);
1875 lcd_setfont(FONT_UI
);
1879 #endif /* HAVE_LCD_BITMAP */
1883 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
1885 #if (CONFIG_STORAGE & STORAGE_MMC)
1886 #define CARDTYPE "MMC"
1887 #elif (CONFIG_STORAGE & STORAGE_SD)
1888 #define CARDTYPE "microSD"
1891 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1894 int *cardnum
= (int*)lists
->data
;
1895 unsigned char card_name
[7];
1896 unsigned char pbuf
[32];
1897 char *title
= lists
->title
;
1898 static const unsigned char i_vmin
[] = { 0, 1, 5, 10, 25, 35, 60, 100 };
1899 static const unsigned char i_vmax
[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
1900 static const unsigned char *kbit_units
[] = { "kBit/s", "MBit/s", "GBit/s" };
1901 static const unsigned char *nsec_units
[] = { "ns", "µs", "ms" };
1902 #if (CONFIG_STORAGE & STORAGE_MMC)
1903 static const char *mmc_spec_vers
[] = { "1.0-1.2", "1.4", "2.0-2.2",
1904 "3.1-3.31", "4.0" };
1907 if ((btn
== ACTION_STD_OK
) || (btn
== SYS_FS_CHANGED
) || (btn
== ACTION_REDRAW
))
1910 if (btn
== ACTION_STD_OK
)
1912 *cardnum
^= 0x1; /* change cards */
1916 simplelist_set_line_count(0);
1918 card
= card_get_info(*cardnum
);
1920 if (card
->initialized
> 0)
1922 strlcpy(card_name
, ((unsigned char*)card
->cid
) + 3, sizeof(card_name
));
1923 simplelist_addline(SIMPLELIST_ADD_LINE
,
1924 "%s Rev %d.%d", card_name
,
1925 (int) card_extract_bits(card
->cid
, 55, 4),
1926 (int) card_extract_bits(card
->cid
, 51, 4));
1927 simplelist_addline(SIMPLELIST_ADD_LINE
,
1929 #if (CONFIG_STORAGE & STORAGE_SD)
1930 (int) card_extract_bits(card
->cid
, 11, 3),
1931 (int) card_extract_bits(card
->cid
, 19, 8) + 2000
1932 #elif (CONFIG_STORAGE & STORAGE_MMC)
1933 (int) card_extract_bits(card
->cid
, 15, 4),
1934 (int) card_extract_bits(card
->cid
, 11, 4) + 1997
1937 simplelist_addline(SIMPLELIST_ADD_LINE
,
1938 #if (CONFIG_STORAGE & STORAGE_SD)
1940 card_extract_bits(card
->cid
, 55, 32)
1941 #elif (CONFIG_STORAGE & STORAGE_MMC)
1943 card_extract_bits(card
->cid
, 47, 16)
1947 simplelist_addline(SIMPLELIST_ADD_LINE
, "M=%02x, "
1948 #if (CONFIG_STORAGE & STORAGE_SD)
1950 (int) card_extract_bits(card
->cid
, 127, 8),
1951 card_extract_bits(card
->cid
, 119, 8),
1952 card_extract_bits(card
->cid
, 111, 8)
1953 #elif (CONFIG_STORAGE & STORAGE_MMC)
1955 (int) card_extract_bits(card
->cid
, 127, 8),
1956 (int) card_extract_bits(card
->cid
, 119, 16)
1960 #if (CONFIG_STORAGE & STORAGE_MMC)
1961 int temp
= card_extract_bits(card
->csd
, 125, 4);
1962 simplelist_addline(SIMPLELIST_ADD_LINE
,
1963 "MMC v%s", temp
< 5 ?
1964 mmc_spec_vers
[temp
] : "?.?");
1966 simplelist_addline(SIMPLELIST_ADD_LINE
,
1967 "Blocks: 0x%08lx", card
->numblocks
);
1968 output_dyn_value(pbuf
, sizeof pbuf
, card
->speed
/ 1000,
1970 simplelist_addline(SIMPLELIST_ADD_LINE
,
1972 output_dyn_value(pbuf
, sizeof pbuf
, card
->taac
,
1974 simplelist_addline(SIMPLELIST_ADD_LINE
,
1976 simplelist_addline(SIMPLELIST_ADD_LINE
,
1977 "Nsac: %d clk", card
->nsac
);
1978 simplelist_addline(SIMPLELIST_ADD_LINE
,
1979 "R2W: *%d", card
->r2w_factor
);
1980 simplelist_addline(SIMPLELIST_ADD_LINE
,
1982 i_vmin
[card_extract_bits(card
->csd
, 61, 3)],
1983 i_vmax
[card_extract_bits(card
->csd
, 58, 3)]);
1984 simplelist_addline(SIMPLELIST_ADD_LINE
,
1986 i_vmin
[card_extract_bits(card
->csd
, 55, 3)],
1987 i_vmax
[card_extract_bits(card
->csd
, 52, 3)]);
1989 else if (card
->initialized
== 0)
1991 simplelist_addline(SIMPLELIST_ADD_LINE
, "Not Found!");
1993 #if (CONFIG_STORAGE & STORAGE_SD)
1994 else /* card->initialized < 0 */
1996 simplelist_addline(SIMPLELIST_ADD_LINE
, "Init Error! (%d)", card
->initialized
);
1999 snprintf(title
, 16, "[" CARDTYPE
" %d]", *cardnum
);
2000 gui_synclist_set_title(lists
, title
, Icon_NOICON
);
2001 gui_synclist_set_nb_items(lists
, simplelist_get_line_count());
2002 gui_synclist_select_item(lists
, 0);
2003 btn
= ACTION_REDRAW
;
2007 #elif (CONFIG_STORAGE & STORAGE_ATA)
2008 static int disk_callback(int btn
, struct gui_synclist
*lists
)
2013 unsigned short* identify_info
= ata_get_identify();
2014 bool timing_info_present
= false;
2017 simplelist_set_line_count(0);
2019 for (i
=0; i
< 20; i
++)
2020 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+27]);
2022 /* kill trailing space */
2023 for (i
=39; i
&& buf
[i
]==' '; i
--)
2025 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", buf
);
2026 for (i
=0; i
< 4; i
++)
2027 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+23]);
2029 simplelist_addline(SIMPLELIST_ADD_LINE
,
2030 "Firmware: %s", buf
);
2031 snprintf(buf
, sizeof buf
, "%ld MB",
2032 ((unsigned long)identify_info
[61] << 16 |
2033 (unsigned long)identify_info
[60]) / 2048 );
2034 simplelist_addline(SIMPLELIST_ADD_LINE
,
2037 fat_size( IF_MV2(0,) NULL
, &free
);
2038 simplelist_addline(SIMPLELIST_ADD_LINE
,
2039 "Free: %ld MB", free
/ 1024);
2040 simplelist_addline(SIMPLELIST_ADD_LINE
,
2041 "Spinup time: %d ms", storage_spinup_time() * (1000/HZ
));
2042 i
= identify_info
[83] & (1<<3);
2043 simplelist_addline(SIMPLELIST_ADD_LINE
,
2044 "Power mgmt: %s", i
? "enabled" : "unsupported");
2045 i
= identify_info
[83] & (1<<9);
2046 simplelist_addline(SIMPLELIST_ADD_LINE
,
2047 "Noise mgmt: %s", i
? "enabled" : "unsupported");
2048 i
= identify_info
[82] & (1<<6);
2049 simplelist_addline(SIMPLELIST_ADD_LINE
,
2050 "Read-ahead: %s", i
? "enabled" : "unsupported");
2051 timing_info_present
= identify_info
[53] & (1<<1);
2052 if(timing_info_present
) {
2053 char pio3
[2], pio4
[2];pio3
[1] = 0;
2055 pio3
[0] = (identify_info
[64] & (1<<0)) ? '3' : 0;
2056 pio4
[0] = (identify_info
[64] & (1<<1)) ? '4' : 0;
2057 simplelist_addline(SIMPLELIST_ADD_LINE
,
2058 "PIO modes: 0 1 2 %s %s", pio3
, pio4
);
2061 simplelist_addline(SIMPLELIST_ADD_LINE
,
2062 "No PIO mode info");
2064 timing_info_present
= identify_info
[53] & (1<<1);
2065 if(timing_info_present
) {
2066 simplelist_addline(SIMPLELIST_ADD_LINE
,
2067 "Cycle times %dns/%dns",
2069 identify_info
[68] );
2071 simplelist_addline(SIMPLELIST_ADD_LINE
,
2075 if (identify_info
[63] & (1<<0)) {
2076 char mdma0
[2], mdma1
[2], mdma2
[2];
2077 mdma0
[1] = mdma1
[1] = mdma2
[1] = 0;
2078 mdma0
[0] = (identify_info
[63] & (1<<0)) ? '0' : 0;
2079 mdma1
[0] = (identify_info
[63] & (1<<1)) ? '1' : 0;
2080 mdma2
[0] = (identify_info
[63] & (1<<2)) ? '2' : 0;
2081 simplelist_addline(SIMPLELIST_ADD_LINE
,
2082 "MDMA modes: %s %s %s", mdma0
, mdma1
, mdma2
);
2083 simplelist_addline(SIMPLELIST_ADD_LINE
,
2084 "MDMA Cycle times %dns/%dns",
2086 identify_info
[66] );
2089 simplelist_addline(SIMPLELIST_ADD_LINE
,
2090 "No MDMA mode info");
2092 if (identify_info
[53] & (1<<2)) {
2093 char udma0
[2], udma1
[2], udma2
[2], udma3
[2], udma4
[2], udma5
[2], udma6
[2];
2094 udma0
[1] = udma1
[1] = udma2
[1] = udma3
[1] = udma4
[1] = udma5
[1] = udma6
[1] = 0;
2095 udma0
[0] = (identify_info
[88] & (1<<0)) ? '0' : 0;
2096 udma1
[0] = (identify_info
[88] & (1<<1)) ? '1' : 0;
2097 udma2
[0] = (identify_info
[88] & (1<<2)) ? '2' : 0;
2098 udma3
[0] = (identify_info
[88] & (1<<3)) ? '3' : 0;
2099 udma4
[0] = (identify_info
[88] & (1<<4)) ? '4' : 0;
2100 udma5
[0] = (identify_info
[88] & (1<<5)) ? '5' : 0;
2101 udma6
[0] = (identify_info
[88] & (1<<6)) ? '6' : 0;
2102 simplelist_addline(SIMPLELIST_ADD_LINE
,
2103 "UDMA modes: %s %s %s %s %s %s %s", udma0
, udma1
, udma2
,
2104 udma3
, udma4
, udma5
, udma6
);
2107 simplelist_addline(SIMPLELIST_ADD_LINE
,
2108 "No UDMA mode info");
2110 #endif /* HAVE_ATA_DMA */
2111 timing_info_present
= identify_info
[53] & (1<<1);
2112 if(timing_info_present
) {
2113 i
= identify_info
[49] & (1<<11);
2114 simplelist_addline(SIMPLELIST_ADD_LINE
,
2115 "IORDY support: %s", i
? "yes" : "no");
2116 i
= identify_info
[49] & (1<<10);
2117 simplelist_addline(SIMPLELIST_ADD_LINE
,
2118 "IORDY disable: %s", i
? "yes" : "no");
2120 simplelist_addline(SIMPLELIST_ADD_LINE
,
2123 simplelist_addline(SIMPLELIST_ADD_LINE
,
2124 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2126 i
= ata_get_dma_mode();
2128 simplelist_addline(SIMPLELIST_ADD_LINE
,
2131 simplelist_addline(SIMPLELIST_ADD_LINE
,
2133 (i
& 0x40) ? "UDMA" : "MDMA",
2136 #endif /* HAVE_ATA_DMA */
2139 #else /* No SD, MMC or ATA */
2140 static int disk_callback(int btn
, struct gui_synclist
*lists
)
2144 struct storage_info info
;
2145 storage_get_info(0,&info
);
2146 simplelist_addline(SIMPLELIST_ADD_LINE
, "Vendor: %s", info
.vendor
);
2147 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", info
.product
);
2148 simplelist_addline(SIMPLELIST_ADD_LINE
, "Firmware: %s", info
.revision
);
2149 simplelist_addline(SIMPLELIST_ADD_LINE
,
2150 "Size: %ld MB", info
.num_sectors
*(info
.sector_size
/512)/2024);
2152 fat_size( IF_MV2(0,) NULL
, &free
);
2153 simplelist_addline(SIMPLELIST_ADD_LINE
,
2154 "Free: %ld MB", free
/ 1024);
2155 simplelist_addline(SIMPLELIST_ADD_LINE
,
2156 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2161 #if (CONFIG_STORAGE & STORAGE_ATA)
2162 static bool dbg_identify_info(void)
2164 int fd
= creat("/identify_info.bin");
2167 #ifdef ROCKBOX_LITTLE_ENDIAN
2168 ecwrite(fd
, ata_get_identify(), SECTOR_SIZE
/2, "s", true);
2170 write(fd
, ata_get_identify(), SECTOR_SIZE
);
2178 static bool dbg_disk_info(void)
2180 struct simplelist_info info
;
2181 simplelist_info_init(&info
, "Disk Info", 1, NULL
);
2182 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
2185 info
.callback_data
= (void*)&card
;
2188 info
.action_callback
= disk_callback
;
2189 info
.hide_selection
= true;
2190 info
.scroll_all
= true;
2191 return simplelist_show_list(&info
);
2193 #endif /* !SIMULATOR */
2195 #ifdef HAVE_DIRCACHE
2196 static int dircache_callback(int btn
, struct gui_synclist
*lists
)
2198 (void)btn
; (void)lists
;
2199 simplelist_set_line_count(0);
2200 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache initialized: %s",
2201 dircache_is_enabled() ? "Yes" : "No");
2202 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache size: %d B",
2203 dircache_get_cache_size());
2204 simplelist_addline(SIMPLELIST_ADD_LINE
, "Last size: %d B",
2205 global_status
.dircache_size
);
2206 simplelist_addline(SIMPLELIST_ADD_LINE
, "Limit: %d B",
2208 simplelist_addline(SIMPLELIST_ADD_LINE
, "Reserve: %d/%d B",
2209 dircache_get_reserve_used(), DIRCACHE_RESERVE
);
2210 simplelist_addline(SIMPLELIST_ADD_LINE
, "Scanning took: %d s",
2211 dircache_get_build_ticks() / HZ
);
2212 simplelist_addline(SIMPLELIST_ADD_LINE
, "Entry count: %d",
2213 dircache_get_entry_count());
2217 static bool dbg_dircache_info(void)
2219 struct simplelist_info info
;
2220 simplelist_info_init(&info
, "Dircache Info", 7, NULL
);
2221 info
.action_callback
= dircache_callback
;
2222 info
.hide_selection
= true;
2223 info
.scroll_all
= true;
2224 return simplelist_show_list(&info
);
2227 #endif /* HAVE_DIRCACHE */
2229 #ifdef HAVE_TAGCACHE
2230 static int database_callback(int btn
, struct gui_synclist
*lists
)
2233 struct tagcache_stat
*stat
= tagcache_get_stat();
2234 static bool synced
= false;
2236 simplelist_set_line_count(0);
2238 simplelist_addline(SIMPLELIST_ADD_LINE
, "Initialized: %s",
2239 stat
->initialized
? "Yes" : "No");
2240 simplelist_addline(SIMPLELIST_ADD_LINE
, "DB Ready: %s",
2241 stat
->ready
? "Yes" : "No");
2242 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM Cache: %s",
2243 stat
->ramcache
? "Yes" : "No");
2244 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM: %d/%d B",
2245 stat
->ramcache_used
, stat
->ramcache_allocated
);
2246 simplelist_addline(SIMPLELIST_ADD_LINE
, "Progress: %d%% (%d entries)",
2247 stat
->progress
, stat
->processed_entries
);
2248 simplelist_addline(SIMPLELIST_ADD_LINE
, "Curfile: %s",
2249 stat
->curentry
? stat
->curentry
: "---");
2250 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit step: %d",
2252 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit delayed: %s",
2253 stat
->commit_delayed
? "Yes" : "No");
2255 simplelist_addline(SIMPLELIST_ADD_LINE
, "Queue length: %d",
2256 stat
->queue_length
);
2261 tagcache_screensync_event();
2264 if (!btn
&& stat
->curentry
)
2267 return ACTION_REDRAW
;
2270 if (btn
== ACTION_STD_CANCEL
)
2271 tagcache_screensync_enable(false);
2275 static bool dbg_tagcache_info(void)
2277 struct simplelist_info info
;
2278 simplelist_info_init(&info
, "Database Info", 8, NULL
);
2279 info
.action_callback
= database_callback
;
2280 info
.hide_selection
= true;
2281 info
.scroll_all
= true;
2283 /* Don't do nonblock here, must give enough processing time
2284 for tagcache thread. */
2285 /* info.timeout = TIMEOUT_NOBLOCK; */
2287 tagcache_screensync_enable(true);
2288 return simplelist_show_list(&info
);
2292 #if CONFIG_CPU == SH7034
2293 static bool dbg_save_roms(void)
2296 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2298 fd
= creat("/internal_rom_0000-FFFF.bin");
2301 write(fd
, (void *)0, 0x10000);
2305 fd
= creat("/internal_rom_2000000-203FFFF.bin");
2308 write(fd
, (void *)0x2000000, 0x40000);
2312 system_memory_guard(oldmode
);
2315 #elif defined CPU_COLDFIRE
2316 static bool dbg_save_roms(void)
2319 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2321 #if defined(IRIVER_H100_SERIES)
2322 fd
= creat("/internal_rom_000000-1FFFFF.bin");
2323 #elif defined(IRIVER_H300_SERIES)
2324 fd
= creat("/internal_rom_000000-3FFFFF.bin");
2325 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3)
2326 fd
= creat("/internal_rom_000000-3FFFFF.bin");
2330 write(fd
, (void *)0, FLASH_SIZE
);
2333 system_memory_guard(oldmode
);
2336 fd
= creat("/internal_eeprom.bin");
2340 char buf
[EEPROM_SIZE
];
2343 old_irq_level
= disable_irq_save();
2345 err
= eeprom_24cxx_read(0, buf
, sizeof buf
);
2347 restore_irq(old_irq_level
);
2350 splashf(HZ
*3, "Eeprom read failure (%d)", err
);
2353 write(fd
, buf
, sizeof buf
);
2362 #elif defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)
2363 static bool dbg_save_roms(void)
2367 fd
= creat("/internal_rom_000000-0FFFFF.bin");
2370 write(fd
, (void *)0x20000000, FLASH_SIZE
);
2380 static int radio_callback(int btn
, struct gui_synclist
*lists
)
2383 if (btn
== ACTION_STD_CANCEL
)
2385 simplelist_set_line_count(1);
2387 #if (CONFIG_TUNER & LV24020LP)
2388 simplelist_addline(SIMPLELIST_ADD_LINE
,
2389 "CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT
) );
2390 simplelist_addline(SIMPLELIST_ADD_LINE
,
2391 "RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT
) );
2392 simplelist_addline(SIMPLELIST_ADD_LINE
,
2393 "MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM
) );
2394 simplelist_addline(SIMPLELIST_ADD_LINE
,
2395 "MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF
) );
2396 simplelist_addline(SIMPLELIST_ADD_LINE
,
2397 "MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD
) );
2398 simplelist_addline(SIMPLELIST_ADD_LINE
,
2399 "if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET
) );
2400 simplelist_addline(SIMPLELIST_ADD_LINE
,
2401 "sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET
) );
2402 #endif /* LV24020LP */
2403 #if (CONFIG_TUNER & S1A0903X01)
2404 simplelist_addline(SIMPLELIST_ADD_LINE
,
2405 "Samsung regs: %08X", s1a0903x01_get(RADIO_ALL
));
2406 /* This one doesn't return dynamic data atm */
2407 #endif /* S1A0903X01 */
2408 #if (CONFIG_TUNER & TEA5767)
2409 struct tea5767_dbg_info nfo
;
2410 tea5767_dbg_info(&nfo
);
2411 simplelist_addline(SIMPLELIST_ADD_LINE
, "Philips regs:");
2412 simplelist_addline(SIMPLELIST_ADD_LINE
,
2413 " Read: %02X %02X %02X %02X %02X",
2414 (unsigned)nfo
.read_regs
[0], (unsigned)nfo
.read_regs
[1],
2415 (unsigned)nfo
.read_regs
[2], (unsigned)nfo
.read_regs
[3],
2416 (unsigned)nfo
.read_regs
[4]);
2417 simplelist_addline(SIMPLELIST_ADD_LINE
,
2418 " Write: %02X %02X %02X %02X %02X",
2419 (unsigned)nfo
.write_regs
[0], (unsigned)nfo
.write_regs
[1],
2420 (unsigned)nfo
.write_regs
[2], (unsigned)nfo
.write_regs
[3],
2421 (unsigned)nfo
.write_regs
[4]);
2422 #endif /* TEA5767 */
2423 #if (CONFIG_TUNER & SI4700)
2424 struct si4700_dbg_info nfo
;
2425 si4700_dbg_info(&nfo
);
2426 simplelist_addline(SIMPLELIST_ADD_LINE
, "SI4700 regs:");
2428 simplelist_addline(SIMPLELIST_ADD_LINE
,
2429 "%04X %04X %04X %04X",
2430 (unsigned)nfo
.regs
[0], (unsigned)nfo
.regs
[1],
2431 (unsigned)nfo
.regs
[2], (unsigned)nfo
.regs
[3]);
2432 simplelist_addline(SIMPLELIST_ADD_LINE
,
2433 "%04X %04X %04X %04X",
2434 (unsigned)nfo
.regs
[4], (unsigned)nfo
.regs
[5],
2435 (unsigned)nfo
.regs
[6], (unsigned)nfo
.regs
[7]);
2436 simplelist_addline(SIMPLELIST_ADD_LINE
,
2437 "%04X %04X %04X %04X",
2438 (unsigned)nfo
.regs
[8], (unsigned)nfo
.regs
[9],
2439 (unsigned)nfo
.regs
[10], (unsigned)nfo
.regs
[11]);
2440 simplelist_addline(SIMPLELIST_ADD_LINE
,
2441 "%04X %04X %04X %04X",
2442 (unsigned)nfo
.regs
[12], (unsigned)nfo
.regs
[13],
2443 (unsigned)nfo
.regs
[14], (unsigned)nfo
.regs
[15]);
2445 return ACTION_REDRAW
;
2447 static bool dbg_fm_radio(void)
2449 struct simplelist_info info
;
2450 info
.scroll_all
= true;
2451 simplelist_info_init(&info
, "FM Radio", 1, NULL
);
2452 simplelist_set_line_count(0);
2453 simplelist_addline(SIMPLELIST_ADD_LINE
, "HW detected: %s",
2454 radio_hardware_present() ? "yes" : "no");
2456 info
.action_callback
= radio_hardware_present()?radio_callback
: NULL
;
2457 info
.hide_selection
= true;
2458 return simplelist_show_list(&info
);
2460 #endif /* CONFIG_TUNER */
2461 #endif /* !SIMULATOR */
2463 #ifdef HAVE_LCD_BITMAP
2464 extern bool do_screendump_instead_of_usb
;
2466 static bool dbg_screendump(void)
2468 do_screendump_instead_of_usb
= !do_screendump_instead_of_usb
;
2469 splashf(HZ
, "Screendump %s",
2470 do_screendump_instead_of_usb
?"enabled":"disabled");
2473 #endif /* HAVE_LCD_BITMAP */
2475 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2476 static bool dbg_set_memory_guard(void)
2478 static const struct opt_items names
[MAXMEMGUARD
] = {
2480 { "Flash ROM writes", -1 },
2481 { "Zero area (all)", -1 }
2483 int mode
= system_memory_guard(MEMGUARD_KEEP
);
2485 set_option( "Catch mem accesses", &mode
, INT
, names
, MAXMEMGUARD
, NULL
);
2486 system_memory_guard(mode
);
2490 #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
2492 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2493 static bool dbg_write_eeprom(void)
2498 char buf
[EEPROM_SIZE
];
2501 fd
= open("/internal_eeprom.bin", O_RDONLY
);
2505 rc
= read(fd
, buf
, EEPROM_SIZE
);
2507 if(rc
== EEPROM_SIZE
)
2509 old_irq_level
= disable_irq_save();
2511 err
= eeprom_24cxx_write(0, buf
, sizeof buf
);
2513 splashf(HZ
*3, "Eeprom write failure (%d)", err
);
2515 splash(HZ
*3, "Eeprom written successfully");
2517 restore_irq(old_irq_level
);
2521 splashf(HZ
*3, "File read error (%d)",rc
);
2527 splash(HZ
*3, "Failed to open 'internal_eeprom.bin'");
2532 #endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
2533 #ifdef CPU_BOOST_LOGGING
2534 static bool cpu_boost_log(void)
2537 int count
= cpu_boost_log_getcount();
2538 int lines
= LCD_HEIGHT
/SYSFONT_HEIGHT
;
2541 lcd_setfont(FONT_SYSFIXED
);
2542 str
= cpu_boost_log_getlog_first();
2545 lcd_clear_display();
2546 for(j
=0; j
<lines
; j
++,i
++)
2549 str
= cpu_boost_log_getlog_next();
2552 if(strlen(str
) > LCD_WIDTH
/SYSFONT_WIDTH
)
2553 lcd_puts_scroll(0, j
, str
);
2563 switch(get_action(CONTEXT_STD
,TIMEOUT_BLOCK
))
2566 case ACTION_STD_PREV
:
2567 case ACTION_STD_NEXT
:
2570 case ACTION_STD_CANCEL
:
2577 get_action(CONTEXT_STD
,TIMEOUT_BLOCK
);
2578 lcd_setfont(FONT_UI
);
2583 #if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR))
2584 extern bool wheel_is_touched
;
2585 extern int old_wheel_value
;
2586 extern int new_wheel_value
;
2587 extern int wheel_delta
;
2588 extern unsigned int accumulated_wheel_delta
;
2589 extern unsigned int wheel_velocity
;
2591 static bool dbg_scrollwheel(void)
2596 lcd_setfont(FONT_SYSFIXED
);
2600 if (action_userabort(HZ
/10))
2603 lcd_clear_display();
2605 /* show internal variables of scrollwheel driver */
2606 snprintf(buf
, sizeof(buf
), "wheel touched: %s", (wheel_is_touched
) ? "true" : "false");
2607 lcd_puts(0, 0, buf
);
2608 snprintf(buf
, sizeof(buf
), "new position: %2d", new_wheel_value
);
2609 lcd_puts(0, 1, buf
);
2610 snprintf(buf
, sizeof(buf
), "old position: %2d", old_wheel_value
);
2611 lcd_puts(0, 2, buf
);
2612 snprintf(buf
, sizeof(buf
), "wheel delta: %2d", wheel_delta
);
2613 lcd_puts(0, 3, buf
);
2614 snprintf(buf
, sizeof(buf
), "accumulated delta: %2d", accumulated_wheel_delta
);
2615 lcd_puts(0, 4, buf
);
2616 snprintf(buf
, sizeof(buf
), "velo [deg/s]: %4d", (int)wheel_velocity
);
2617 lcd_puts(0, 5, buf
);
2619 /* show effective accelerated scrollspeed */
2620 speed
= button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity
);
2621 snprintf(buf
, sizeof(buf
), "accel. speed: %4d", speed
);
2622 lcd_puts(0, 6, buf
);
2626 lcd_setfont(FONT_UI
);
2631 #if defined (HAVE_USBSTACK)
2633 #if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
2634 static bool toggle_usb_core_driver(int driver
, char *msg
)
2636 bool enabled
= !usb_core_driver_enabled(driver
);
2638 usb_core_enable_driver(driver
,enabled
);
2639 splashf(HZ
, "%s %s", msg
, enabled
?"enabled":"disabled");
2644 static bool toggle_usb_serial(void)
2646 return toggle_usb_core_driver(USB_DRIVER_SERIAL
,"USB Serial");
2652 #if CONFIG_USBOTG == USBOTG_ISP1583
2653 extern int dbg_usb_num_items(void);
2654 extern const char* dbg_usb_item(int selected_item
, void *data
,
2655 char *buffer
, size_t buffer_len
);
2657 static int isp1583_action_callback(int action
, struct gui_synclist
*lists
)
2660 if (action
== ACTION_NONE
)
2661 action
= ACTION_REDRAW
;
2665 static bool dbg_isp1583(void)
2667 struct simplelist_info isp1583
;
2668 isp1583
.scroll_all
= true;
2669 simplelist_info_init(&isp1583
, "ISP1583", dbg_usb_num_items(), NULL
);
2670 isp1583
.timeout
= HZ
/100;
2671 isp1583
.hide_selection
= true;
2672 isp1583
.get_name
= dbg_usb_item
;
2673 isp1583
.action_callback
= isp1583_action_callback
;
2674 return simplelist_show_list(&isp1583
);
2678 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2679 extern int pic_dbg_num_items(void);
2680 extern const char* pic_dbg_item(int selected_item
, void *data
,
2681 char *buffer
, size_t buffer_len
);
2683 static int pic_action_callback(int action
, struct gui_synclist
*lists
)
2686 if (action
== ACTION_NONE
)
2687 action
= ACTION_REDRAW
;
2691 static bool dbg_pic(void)
2693 struct simplelist_info pic
;
2694 pic
.scroll_all
= true;
2695 simplelist_info_init(&pic
, "PIC", pic_dbg_num_items(), NULL
);
2696 pic
.timeout
= HZ
/100;
2697 pic
.hide_selection
= true;
2698 pic
.get_name
= pic_dbg_item
;
2699 pic
.action_callback
= pic_action_callback
;
2700 return simplelist_show_list(&pic
);
2705 /****** The menu *********/
2706 struct the_menu_item
{
2707 unsigned char *desc
; /* string or ID */
2708 bool (*function
) (void); /* return true if USB was connected */
2710 static const struct the_menu_item menuitems
[] = {
2711 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2712 (defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD))
2713 { "Dump ROM contents", dbg_save_roms
},
2715 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \
2716 || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 \
2717 || CONFIG_CPU == DM320 || defined(CPU_S5L870X)
2718 { "View I/O ports", dbg_ports
},
2720 #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
2721 { "View PCF registers", dbg_pcf
},
2723 #if defined(HAVE_TSC2100) && !defined(SIMULATOR)
2724 { "TSC2100 debug", tsc2100_debug
},
2726 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
2727 { "CPU frequency", dbg_cpufreq
},
2729 #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
2730 { "S/PDIF analyzer", dbg_spdif
},
2732 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2733 { "Catch mem accesses", dbg_set_memory_guard
},
2735 { "View OS stacks", dbg_os
},
2736 #ifdef HAVE_LCD_BITMAP
2738 { "View battery", view_battery
},
2740 { "Screendump", dbg_screendump
},
2743 { "View HW info", dbg_hw_info
},
2746 { "View partitions", dbg_partitions
},
2749 { "View disk info", dbg_disk_info
},
2750 #if (CONFIG_STORAGE & STORAGE_ATA)
2751 { "Dump ATA identify info", dbg_identify_info
},
2754 #ifdef HAVE_DIRCACHE
2755 { "View dircache info", dbg_dircache_info
},
2757 #ifdef HAVE_TAGCACHE
2758 { "View database info", dbg_tagcache_info
},
2760 #ifdef HAVE_LCD_BITMAP
2761 #if CONFIG_CODEC == SWCODEC
2762 { "View buffering thread", dbg_buffering_thread
},
2763 #elif !defined(SIMULATOR)
2764 { "View audio thread", dbg_audio_thread
},
2767 { "pm histogram", peak_meter_histogram
},
2768 #endif /* PM_DEBUG */
2769 #endif /* HAVE_LCD_BITMAP */
2772 { "FM Radio", dbg_fm_radio
},
2775 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2776 { "Write back EEPROM", dbg_write_eeprom
},
2778 #if CONFIG_USBOTG == USBOTG_ISP1583
2779 { "View ISP1583 info", dbg_isp1583
},
2781 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2782 { "View PIC info", dbg_pic
},
2784 #ifdef ROCKBOX_HAS_LOGF
2785 {"logf", logfdisplay
},
2786 {"logfdump", logfdump
},
2788 #if defined(HAVE_USBSTACK)
2789 #if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
2790 {"USB Serial driver (logf)", toggle_usb_serial
},
2792 #endif /* HAVE_USBSTACK */
2793 #ifdef CPU_BOOST_LOGGING
2794 {"cpu_boost log",cpu_boost_log
},
2796 #if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR))
2797 {"Debug scrollwheel", dbg_scrollwheel
},
2800 static int menu_action_callback(int btn
, struct gui_synclist
*lists
)
2802 if (btn
== ACTION_STD_OK
)
2804 int oldbars
= viewportmanager_set_statusbar(VP_SB_HIDE_ALL
);
2805 menuitems
[gui_synclist_get_sel_pos(lists
)].function();
2806 btn
= ACTION_REDRAW
;
2807 send_event(GUI_EVENT_REFRESH
, NULL
);
2808 viewportmanager_set_statusbar(oldbars
);
2813 static const char* dbg_menu_getname(int item
, void * data
,
2814 char *buffer
, size_t buffer_len
)
2816 (void)data
; (void)buffer
; (void)buffer_len
;
2817 return menuitems
[item
].desc
;
2820 bool debug_menu(void)
2822 struct simplelist_info info
;
2824 simplelist_info_init(&info
, "Debug Menu", ARRAYLEN(menuitems
), NULL
);
2825 info
.action_callback
= menu_action_callback
;
2826 info
.get_name
= dbg_menu_getname
;
2827 return simplelist_show_list(&info
);