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)
65 #include "eeprom_24cxx.h"
66 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
69 #if (CONFIG_STORAGE & STORAGE_ATA)
78 #ifdef HAVE_LCD_BITMAP
79 #include "scrollbar.h"
80 #include "peakmeter.h"
83 #if CONFIG_CODEC == SWCODEC
85 #include "buffering.h"
87 #if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
91 #ifdef IRIVER_H300_SERIES
92 #include "pcf50606.h" /* for pcf50606_read */
99 #if CONFIG_RTC == RTC_PCF50605
100 #include "pcf50605.h"
102 #include "appevents.h"
104 #if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 \
105 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 || CONFIG_CPU == JZ4732 \
106 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2
107 #include "debug-target.h"
110 #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \
111 || (CONFIG_CPU == AS3525 && defined(CONFIG_CHARGING)) \
112 || CONFIG_CPU == AS3525v2
118 #include "pmu-target.h"
122 #include "usb_core.h"
125 #if defined(IPOD_ACCESSORY_PROTOCOL)
129 /*---------------------------------------------------*/
130 /* SPECIAL DEBUG STUFF */
131 /*---------------------------------------------------*/
132 extern struct thread_entry threads
[MAXTHREADS
];
134 static char thread_status_char(unsigned status
)
136 static const char thread_status_chars
[THREAD_NUM_STATES
+1] =
138 [0 ... THREAD_NUM_STATES
] = '?',
139 [STATE_RUNNING
] = 'R',
140 [STATE_BLOCKED
] = 'B',
141 [STATE_SLEEPING
] = 'S',
142 [STATE_BLOCKED_W_TMO
] = 'T',
143 [STATE_FROZEN
] = 'F',
144 [STATE_KILLED
] = 'K',
147 if (status
> THREAD_NUM_STATES
)
148 status
= THREAD_NUM_STATES
;
150 return thread_status_chars
[status
];
153 static const char* threads_getname(int selected_item
, void *data
,
154 char *buffer
, size_t buffer_len
)
157 struct thread_entry
*thread
;
161 if (selected_item
< (int)NUM_CORES
)
163 snprintf(buffer
, buffer_len
, "Idle (%d): %2d%%", selected_item
,
164 idle_stack_usage(selected_item
));
168 selected_item
-= NUM_CORES
;
171 thread
= &threads
[selected_item
];
173 if (thread
->state
== STATE_KILLED
)
175 snprintf(buffer
, buffer_len
, "%2d: ---", selected_item
);
179 thread_get_name(name
, 32, thread
);
181 snprintf(buffer
, buffer_len
,
182 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s",
184 IF_COP(thread
->core
,)
185 #ifdef HAVE_SCHEDULER_BOOSTCTRL
186 (thread
->cpu_boost
) ? '+' :
188 ((thread
->state
== STATE_RUNNING
) ? '*' : ' '),
189 thread_status_char(thread
->state
),
190 IF_PRIO(thread
->base_priority
, thread
->priority
, )
191 thread_stack_usage(thread
), name
);
196 static int dbg_threads_action_callback(int action
, struct gui_synclist
*lists
)
199 #ifdef ROCKBOX_HAS_LOGF
200 if (action
== ACTION_STD_OK
)
202 int selpos
= gui_synclist_get_sel_pos(lists
);
204 if (selpos
>= NUM_CORES
)
205 remove_thread(threads
[selpos
- NUM_CORES
].id
);
207 remove_thread(threads
[selpos
].id
);
209 return ACTION_REDRAW
;
211 #endif /* ROCKBOX_HAS_LOGF */
212 if (action
== ACTION_NONE
)
213 action
= ACTION_REDRAW
;
217 static bool dbg_os(void)
219 struct simplelist_info info
;
220 simplelist_info_init(&info
, IF_COP("Core and ") "Stack usage:",
224 MAXTHREADS
+NUM_CORES
,
227 #ifndef ROCKBOX_HAS_LOGF
228 info
.hide_selection
= true;
229 info
.scroll_all
= true;
231 info
.action_callback
= dbg_threads_action_callback
;
232 info
.get_name
= threads_getname
;
233 return simplelist_show_list(&info
);
236 #ifdef HAVE_LCD_BITMAP
237 #if CONFIG_CODEC != SWCODEC
239 static bool dbg_audio_thread(void)
241 struct audio_debug d
;
243 lcd_setfont(FONT_SYSFIXED
);
247 if (action_userabort(HZ
/5))
250 audio_get_debugdata(&d
);
254 lcd_putsf(0, 0, "read: %x", d
.audiobuf_read
);
255 lcd_putsf(0, 1, "write: %x", d
.audiobuf_write
);
256 lcd_putsf(0, 2, "swap: %x", d
.audiobuf_swapwrite
);
257 lcd_putsf(0, 3, "playing: %d", d
.playing
);
258 lcd_putsf(0, 4, "playable: %x", d
.playable_space
);
259 lcd_putsf(0, 5, "unswapped: %x", d
.unswapped_space
);
261 /* Playable space left */
262 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8, 112, 4, d
.audiobuflen
, 0,
263 d
.playable_space
, HORIZONTAL
);
265 /* Show the watermark limit */
266 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8+4, 112, 4, d
.audiobuflen
, 0,
267 d
.low_watermark_level
, HORIZONTAL
);
269 lcd_putsf(0, 7, "wm: %x - %x",
270 d
.low_watermark_level
, d
.lowest_watermark_level
);
274 lcd_setfont(FONT_UI
);
277 #endif /* !SIMULATOR */
278 #else /* CONFIG_CODEC == SWCODEC */
279 static unsigned int ticks
, boost_ticks
, freq_sum
;
281 static void dbg_audio_task(void)
283 #ifdef CPUFREQ_NORMAL
284 if(FREQ
> CPUFREQ_NORMAL
)
286 freq_sum
+= FREQ
/1000000; /* in MHz */
291 static bool dbg_buffering_thread(void)
297 size_t bufsize
= pcmbuf_get_bufsize();
298 int pcmbufdescs
= pcmbuf_descs();
299 struct buffering_debug d
;
300 size_t filebuflen
= audio_get_filebuflen();
301 /* This is a size_t, but call it a long so it puts a - when it's bad. */
303 ticks
= boost_ticks
= freq_sum
= 0;
305 tick_add_task(dbg_audio_task
);
308 screens
[i
].setfont(FONT_SYSFIXED
);
312 button
= get_action(CONTEXT_STD
,HZ
/5);
315 case ACTION_STD_NEXT
:
318 case ACTION_STD_PREV
:
321 case ACTION_STD_CANCEL
:
326 buffering_get_debugdata(&d
);
327 bufused
= bufsize
- pcmbuf_free();
332 screens
[i
].clear_display();
335 screens
[i
].putsf(0, line
++, "pcm: %6ld/%ld", (long) bufused
, (long) bufsize
);
337 gui_scrollbar_draw(&screens
[i
],0, line
*8, screens
[i
].lcdwidth
, 6,
338 bufsize
, 0, bufused
, HORIZONTAL
);
341 screens
[i
].putsf(0, line
++, "alloc: %6ld/%ld", audio_filebufused(),
344 #if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80)
345 if (screens
[i
].lcdheight
> 80)
347 gui_scrollbar_draw(&screens
[i
],0, line
*8, screens
[i
].lcdwidth
, 6,
348 filebuflen
, 0, audio_filebufused(), HORIZONTAL
);
351 screens
[i
].putsf(0, line
++, "real: %6ld/%ld", (long)d
.buffered_data
,
354 gui_scrollbar_draw(&screens
[i
],0, line
*8, screens
[i
].lcdwidth
, 6,
355 filebuflen
, 0, (long)d
.buffered_data
, HORIZONTAL
);
360 screens
[i
].putsf(0, line
++, "usefl: %6ld/%ld", (long)(d
.useful_data
),
363 #if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80)
364 if (screens
[i
].lcdheight
> 80)
366 gui_scrollbar_draw(&screens
[i
],0, line
*8, screens
[i
].lcdwidth
, 6,
367 filebuflen
, 0, d
.useful_data
, HORIZONTAL
);
372 screens
[i
].putsf(0, line
++, "data_rem: %ld", (long)d
.data_rem
);
374 screens
[i
].putsf(0, line
++, "track count: %2d", audio_track_count());
376 screens
[i
].putsf(0, line
++, "handle count: %d", (int)d
.num_handles
);
378 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
379 screens
[i
].putsf(0, line
++, "cpu freq: %3dMHz",
380 (int)((FREQ
+ 500000) / 1000000));
385 int boostquota
= boost_ticks
* 1000 / ticks
; /* in 0.1 % */
386 int avgclock
= freq_sum
* 10 / ticks
; /* in 100 kHz */
387 screens
[i
].putsf(0, line
++, "boost:%3d.%d%% (%d.%dMHz)",
388 boostquota
/10, boostquota
%10, avgclock
/10, avgclock
%10);
391 screens
[i
].putsf(0, line
++, "pcmbufdesc: %2d/%2d",
392 pcmbuf_used_descs(), pcmbufdescs
);
393 screens
[i
].putsf(0, line
++, "watermark: %6d",
400 tick_remove_task(dbg_audio_task
);
403 screens
[i
].setfont(FONT_UI
);
407 #endif /* CONFIG_CODEC */
408 #endif /* HAVE_LCD_BITMAP */
411 #if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE))
412 /* Tool function to read the flash manufacturer and type, if available.
413 Only chips which could be reprogrammed in system will return values.
414 (The mode switch addresses vary between flash manufacturers, hence addr1/2) */
415 /* In IRAM to avoid problems when running directly from Flash */
416 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
417 unsigned addr1
, unsigned addr2
)
418 ICODE_ATTR
__attribute__((noinline
));
419 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
420 unsigned addr1
, unsigned addr2
)
423 unsigned not_manu
, not_id
; /* read values before switching to ID mode */
424 unsigned manu
, id
; /* read values when in ID mode */
426 #if CONFIG_CPU == SH7034
427 volatile unsigned char* flash
= (unsigned char*)0x2000000; /* flash mapping */
428 #elif defined(CPU_COLDFIRE)
429 volatile unsigned short* flash
= (unsigned short*)0; /* flash mapping */
431 int old_level
; /* saved interrupt level */
433 not_manu
= flash
[0]; /* read the normal content */
434 not_id
= flash
[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */
436 /* disable interrupts, prevent any stray flash access */
437 old_level
= disable_irq_save();
439 flash
[addr1
] = 0xAA; /* enter command mode */
441 flash
[addr1
] = 0x90; /* ID command */
442 /* Atmel wants 20ms pause here */
443 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
445 manu
= flash
[0]; /* read the IDs */
448 flash
[0] = 0xF0; /* reset flash (back to normal read mode) */
449 /* Atmel wants 20ms pause here */
450 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
452 restore_irq(old_level
); /* enable interrupts again */
454 /* I assume success if the obtained values are different from
455 the normal flash content. This is not perfectly bulletproof, they
456 could theoretically be the same by chance, causing us to fail. */
457 if (not_manu
!= manu
|| not_id
!= id
) /* a value has changed */
459 *p_manufacturer
= manu
; /* return the results */
461 return true; /* success */
463 return false; /* fail */
465 #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
467 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
469 static int perfcheck(void)
475 "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */
478 "ldr r0, [%[timr]] \n"
479 "add r0, r0, %[tmo] \n"
481 "add %[res], %[res], #1 \n"
482 "ldr r1, [%[timr]] \n"
485 "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */
489 [timr
]"r"(&USEC_TIMER
),
491 #if CONFIG_CPU == PP5002
493 #else /* PP5020/5022/5024 */
504 #ifdef HAVE_LCD_BITMAP
505 static bool dbg_hw_info(void)
507 #if CONFIG_CPU == SH7034
508 int bitmask
= HW_MASK
;
509 int rom_version
= ROM_VERSION
;
510 unsigned manu
, id
; /* flash IDs */
511 bool got_id
; /* flag if we managed to get the flash IDs */
512 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
513 bool has_bootrom
; /* flag for boot ROM present */
514 int oldmode
; /* saved memory guard mode */
516 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
518 /* get flash ROM type */
519 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
521 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
523 /* check if the boot ROM area is a flash mirror */
524 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
525 if (has_bootrom
) /* if ROM and Flash different */
527 /* calculate CRC16 checksum of boot ROM */
528 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
531 system_memory_guard(oldmode
); /* re-enable memory guard */
533 lcd_setfont(FONT_SYSFIXED
);
536 lcd_puts(0, 0, "[Hardware info]");
538 lcd_putsf(0, 1, "ROM: %d.%02d", rom_version
/100, rom_version
%100);
540 lcd_putsf(0, 2, "Mask: 0x%04x", bitmask
);
543 lcd_putsf(0, 3, "Flash: M=%02x D=%02x", manu
, id
);
545 lcd_puts(0, 3, "Flash: M=?? D=??"); /* unknown, sorry */
549 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
550 lcd_puts(0, 4, "Boot ROM: V1");
552 lcd_putsf(0, 4, "ROMcrc: 0x%08x", rom_crc
);
556 lcd_puts(0, 4, "Boot ROM: none");
561 while (!(action_userabort(TIMEOUT_BLOCK
)));
563 #elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
564 unsigned manu
, id
; /* flash IDs */
565 int got_id
; /* flag if we managed to get the flash IDs */
566 int oldmode
; /* saved memory guard mode */
569 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
571 /* get flash ROM type */
572 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
574 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
576 system_memory_guard(oldmode
); /* re-enable memory guard */
578 lcd_setfont(FONT_SYSFIXED
);
581 lcd_puts(0, line
++, "[Hardware info]");
584 lcd_putsf(0, line
++, "Flash: M=%04x D=%04x", manu
, id
);
586 lcd_puts(0, line
++, "Flash: M=???? D=????"); /* unknown, sorry */
592 lcd_puts(0, ++line
, "Serial Number:");
594 got_id
= ds2411_read_id(&id
);
596 if (got_id
== DS2411_OK
)
598 lcd_putsf(0, ++line
, " FC=%02x", (unsigned)id
.family_code
);
599 lcd_putsf(0, ++line
, " ID=%02X %02X %02X %02X %02X %02X",
600 (unsigned)id
.uid
[0], (unsigned)id
.uid
[1], (unsigned)id
.uid
[2],
601 (unsigned)id
.uid
[3], (unsigned)id
.uid
[4], (unsigned)id
.uid
[5]);
602 lcd_putsf(0, ++line
, " CRC=%02X", (unsigned)id
.crc
);
606 lcd_putsf(0, ++line
, "READ ERR=%d", got_id
);
613 while (!(action_userabort(TIMEOUT_BLOCK
)));
615 #elif defined(CPU_PP502x)
617 char pp_version
[] = { (PP_VER2
>> 24) & 0xff, (PP_VER2
>> 16) & 0xff,
618 (PP_VER2
>> 8) & 0xff, (PP_VER2
) & 0xff,
619 (PP_VER1
>> 24) & 0xff, (PP_VER1
>> 16) & 0xff,
620 (PP_VER1
>> 8) & 0xff, (PP_VER1
) & 0xff, '\0' };
622 lcd_setfont(FONT_SYSFIXED
);
625 lcd_puts(0, line
++, "[Hardware info]");
628 lcd_putsf(0, line
++, "HW rev: 0x%08lx", IPOD_HW_REVISION
);
632 extern int lcd_type
; /* Defined in lcd-colornano.c */
634 lcd_putsf(0, line
++, "LCD type: %d", lcd_type
);
637 lcd_putsf(0, line
++, "PP version: %s", pp_version
);
639 lcd_putsf(0, line
++, "Est. clock (kHz): %d", perfcheck());
643 while (!(action_userabort(TIMEOUT_BLOCK
)));
645 #elif CONFIG_CPU == PP5002
647 char pp_version
[] = { (PP_VER4
>> 8) & 0xff, PP_VER4
& 0xff,
648 (PP_VER3
>> 8) & 0xff, PP_VER3
& 0xff,
649 (PP_VER2
>> 8) & 0xff, PP_VER2
& 0xff,
650 (PP_VER1
>> 8) & 0xff, PP_VER1
& 0xff, '\0' };
653 lcd_setfont(FONT_SYSFIXED
);
656 lcd_puts(0, line
++, "[Hardware info]");
659 lcd_putsf(0, line
++, "HW rev: 0x%08lx", IPOD_HW_REVISION
);
662 lcd_putsf(0, line
++, "PP version: %s", pp_version
);
664 lcd_putsf(0, line
++, "Est. clock (kHz): %d", perfcheck());
668 while (!(action_userabort(TIMEOUT_BLOCK
)));
671 /* Define this function in your target tree */
672 return __dbg_hw_info();
673 #endif /* CONFIG_CPU */
674 lcd_setfont(FONT_UI
);
677 #else /* !HAVE_LCD_BITMAP */
678 static bool dbg_hw_info(void)
682 int rom_version
= ROM_VERSION
;
683 unsigned manu
, id
; /* flash IDs */
684 bool got_id
; /* flag if we managed to get the flash IDs */
685 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
686 bool has_bootrom
; /* flag for boot ROM present */
687 int oldmode
; /* saved memory guard mode */
689 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
691 /* get flash ROM type */
692 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
694 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
696 /* check if the boot ROM area is a flash mirror */
697 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
698 if (has_bootrom
) /* if ROM and Flash different */
700 /* calculate CRC16 checksum of boot ROM */
701 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
704 system_memory_guard(oldmode
); /* re-enable memory guard */
708 lcd_puts(0, 0, "[HW Info]");
714 lcd_putsf(0, 1, "ROM: %d.%02d",
715 rom_version
/100, rom_version
%100);
719 lcd_putsf(0, 1, "Flash:%02x,%02x", manu
, id
);
721 lcd_puts(0, 1, "Flash:??,??"); /* unknown, sorry */
726 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
727 lcd_puts(0, 1, "BootROM: V1");
728 else if (rom_crc
== 0x358099E8)
729 lcd_puts(0, 1, "BootROM: V2");
730 /* alternative boot ROM found in one single player so far */
732 lcd_putsf(0, 1, "R: %08x", rom_crc
);
735 lcd_puts(0, 1, "BootROM: no");
740 button
= get_action(CONTEXT_SETTINGS
,TIMEOUT_BLOCK
);
744 case ACTION_STD_CANCEL
:
747 case ACTION_SETTINGS_DEC
:
753 case ACTION_SETTINGS_INC
:
762 #endif /* !HAVE_LCD_BITMAP */
763 #endif /* PLATFORM_NATIVE */
765 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
766 static const char* dbg_partitions_getname(int selected_item
, void *data
,
767 char *buffer
, size_t buffer_len
)
770 int partition
= selected_item
/2;
771 struct partinfo
* p
= disk_partinfo(partition
);
774 snprintf(buffer
, buffer_len
, " T:%x %ld MB", p
->type
, p
->size
/ ( 2048 / ( SECTOR_SIZE
/ 512 )));
778 snprintf(buffer
, buffer_len
, "P%d: S:%lx", partition
, p
->start
);
783 bool dbg_partitions(void)
785 struct simplelist_info info
;
786 simplelist_info_init(&info
, "Partition Info", 4, NULL
);
787 info
.selection_size
= 2;
788 info
.hide_selection
= true;
789 info
.scroll_all
= true;
790 info
.get_name
= dbg_partitions_getname
;
791 return simplelist_show_list(&info
);
793 #endif /* PLATFORM_NATIVE */
795 #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
796 static bool dbg_spdif(void)
799 unsigned int control
;
804 unsigned int interruptstat
;
805 bool valnogood
, symbolerr
, parityerr
;
808 int spdif_source
= spdif_get_output_source(&spdif_src_on
);
809 spdif_set_output_source(AUDIO_SRC_SPDIF
IF_SPDIF_POWER_(, true));
812 lcd_setfont(FONT_SYSFIXED
);
814 #ifdef HAVE_SPDIF_POWER
815 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
822 control
= EBU1RCVCCHANNEL1
;
823 interruptstat
= INTERRUPTSTAT
;
824 INTERRUPTCLEAR
= 0x03c00000;
826 valnogood
= (interruptstat
& 0x01000000)?true:false;
827 symbolerr
= (interruptstat
& 0x00800000)?true:false;
828 parityerr
= (interruptstat
& 0x00400000)?true:false;
830 lcd_putsf(0, line
++, "Val: %s Sym: %s Par: %s",
833 parityerr
?"--":"OK");
835 lcd_putsf(0, line
++, "Status word: %08x", (int)control
);
840 lcd_putsf(0, line
++, "PRO: %d (%s)",
841 x
, x
?"Professional":"Consumer");
843 x
= (control
>> 30) & 1;
844 lcd_putsf(0, line
++, "Audio: %d (%s)",
845 x
, x
?"Non-PCM":"PCM");
847 x
= (control
>> 29) & 1;
848 lcd_putsf(0, line
++, "Copy: %d (%s)",
849 x
, x
?"Permitted":"Inhibited");
851 x
= (control
>> 27) & 7;
864 lcd_putsf(0, line
++, "Preemphasis: %d (%s)", x
, s
);
866 x
= (control
>> 24) & 3;
867 lcd_putsf(0, line
++, "Mode: %d", x
);
869 category
= (control
>> 17) & 127;
881 lcd_putsf(0, line
++, "Category: 0x%02x (%s)", category
, s
);
883 x
= (control
>> 16) & 1;
885 if(((category
& 0x70) == 0x10) ||
886 ((category
& 0x70) == 0x40) ||
887 ((category
& 0x78) == 0x38))
889 generation
= !generation
;
891 lcd_putsf(0, line
++, "Generation: %d (%s)",
892 x
, generation
?"Original":"No ind.");
894 x
= (control
>> 12) & 15;
895 lcd_putsf(0, line
++, "Source: %d", x
);
898 x
= (control
>> 8) & 15;
914 lcd_putsf(0, line
++, "Channel: %d (%s)", x
, s
);
916 x
= (control
>> 4) & 15;
929 lcd_putsf(0, line
++, "Frequency: %d (%s)", x
, s
);
931 x
= (control
>> 2) & 3;
932 lcd_putsf(0, line
++, "Clock accuracy: %d", x
);
935 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
936 lcd_putsf(0, line
++, "Measured freq: %ldHz",
937 spdif_measure_frequency());
942 if (action_userabort(HZ
/10))
946 spdif_set_output_source(spdif_source
IF_SPDIF_POWER_(, spdif_src_on
));
948 #ifdef HAVE_SPDIF_POWER
949 spdif_power_enable(global_settings
.spdif_enable
);
952 lcd_setfont(FONT_UI
);
955 #endif /* CPU_COLDFIRE */
957 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
958 #ifdef HAVE_LCD_BITMAP
959 /* button definitions */
960 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
961 (CONFIG_KEYPAD == IRIVER_H300_PAD)
962 # define DEBUG_CANCEL BUTTON_OFF
964 #elif CONFIG_KEYPAD == RECORDER_PAD
965 # define DEBUG_CANCEL BUTTON_OFF
967 #elif CONFIG_KEYPAD == ONDIO_PAD
968 # define DEBUG_CANCEL BUTTON_MENU
970 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
971 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
972 (CONFIG_KEYPAD == IPOD_4G_PAD)
973 # define DEBUG_CANCEL BUTTON_MENU
975 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
976 # define DEBUG_CANCEL BUTTON_PLAY
978 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
979 # define DEBUG_CANCEL BUTTON_REC
981 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
982 # define DEBUG_CANCEL BUTTON_RC_REC
984 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
985 # define DEBUG_CANCEL BUTTON_REW
987 #elif (CONFIG_KEYPAD == MROBE100_PAD)
988 # define DEBUG_CANCEL BUTTON_MENU
990 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
991 (CONFIG_KEYPAD == SANSA_C200_PAD) || \
992 (CONFIG_KEYPAD == SANSA_FUZE_PAD)
993 # define DEBUG_CANCEL BUTTON_LEFT
995 /* This is temporary until the SA9200 touchpad works */
996 #elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
997 (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
998 # define DEBUG_CANCEL BUTTON_POWER
1000 #elif (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD)
1001 # define DEBUG_CANCEL BUTTON_PREV
1003 #elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
1004 # define DEBUG_CANCEL BUTTON_PLAY
1006 #elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
1007 # define DEBUG_CANCEL BUTTON_CANCEL
1009 #elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
1010 # define DEBUG_CANCEL BUTTON_REC
1012 #endif /* key definitions */
1015 bool dbg_ports(void)
1017 #if CONFIG_CPU == SH7034
1018 int adc_battery_voltage
, adc_battery_level
;
1020 lcd_setfont(FONT_SYSFIXED
);
1021 lcd_clear_display();
1025 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR
);
1026 lcd_putsf(0, 1, "PBDR: %04x", (unsigned short)PBDR
);
1028 lcd_putsf(0, 2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
1029 lcd_putsf(0, 3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
1030 lcd_putsf(0, 4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
1031 lcd_putsf(0, 5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
1033 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1034 lcd_putsf(0, 6, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1035 adc_battery_voltage
% 1000, adc_battery_level
);
1038 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1040 lcd_setfont(FONT_UI
);
1044 #elif defined(CPU_COLDFIRE)
1045 unsigned int gpio_out
;
1046 unsigned int gpio1_out
;
1047 unsigned int gpio_read
;
1048 unsigned int gpio1_read
;
1049 unsigned int gpio_function
;
1050 unsigned int gpio1_function
;
1051 unsigned int gpio_enable
;
1052 unsigned int gpio1_enable
;
1053 int adc_buttons
, adc_remote
;
1054 int adc_battery_voltage
, adc_battery_level
;
1057 lcd_clear_display();
1058 lcd_setfont(FONT_SYSFIXED
);
1063 gpio_read
= GPIO_READ
;
1064 gpio1_read
= GPIO1_READ
;
1065 gpio_out
= GPIO_OUT
;
1066 gpio1_out
= GPIO1_OUT
;
1067 gpio_function
= GPIO_FUNCTION
;
1068 gpio1_function
= GPIO1_FUNCTION
;
1069 gpio_enable
= GPIO_ENABLE
;
1070 gpio1_enable
= GPIO1_ENABLE
;
1072 lcd_putsf(0, line
++, "GPIO_READ: %08x", gpio_read
);
1073 lcd_putsf(0, line
++, "GPIO_OUT: %08x", gpio_out
);
1074 lcd_putsf(0, line
++, "GPIO_FUNC: %08x", gpio_function
);
1075 lcd_putsf(0, line
++, "GPIO_ENA: %08x", gpio_enable
);
1077 lcd_putsf(0, line
++, "GPIO1_READ: %08x", gpio1_read
);
1078 lcd_putsf(0, line
++, "GPIO1_OUT: %08x", gpio1_out
);
1079 lcd_putsf(0, line
++, "GPIO1_FUNC: %08x", gpio1_function
);
1080 lcd_putsf(0, line
++, "GPIO1_ENA: %08x", gpio1_enable
);
1082 adc_buttons
= adc_read(ADC_BUTTONS
);
1083 adc_remote
= adc_read(ADC_REMOTE
);
1084 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1085 #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
1086 lcd_putsf(0, line
++, "ADC_BUTTONS (%c): %02x",
1087 button_scan_enabled() ? '+' : '-', adc_buttons
);
1089 lcd_putsf(0, line
++, "ADC_BUTTONS: %02x", adc_buttons
);
1091 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
1092 lcd_putsf(0, line
++, "ADC_REMOTE (%c): %02x",
1093 remote_detect() ? '+' : '-', adc_remote
);
1095 lcd_putsf(0, line
++, "ADC_REMOTE: %02x", adc_remote
);
1097 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1098 lcd_putsf(0, line
++, "ADC_REMOTEDETECT: %02x",
1099 adc_read(ADC_REMOTEDETECT
));
1102 lcd_putsf(0, line
++, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1103 adc_battery_voltage
% 1000, adc_battery_level
);
1105 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1106 lcd_putsf(0, line
++, "remotetype: %d", remote_type());
1110 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1112 lcd_setfont(FONT_UI
);
1117 #elif defined(CPU_PP502x)
1120 lcd_clear_display();
1121 lcd_setfont(FONT_SYSFIXED
);
1126 #if (LCD_HEIGHT >= 176) /* Only for displays with appropriate height. */
1127 lcd_puts(0, line
++, "GPIO ENABLE: GPIO OUTPUT ENABLE:");
1128 lcd_putsf(0, line
++, "A: %02x E: %02x I: %02x A: %02x E: %02x I: %02x",
1129 (unsigned int)GPIOA_ENABLE
,
1130 (unsigned int)GPIOE_ENABLE
,
1131 (unsigned int)GPIOI_ENABLE
,
1132 (unsigned int)GPIOA_OUTPUT_EN
,
1133 (unsigned int)GPIOE_OUTPUT_EN
,
1134 (unsigned int)GPIOI_OUTPUT_EN
);
1135 lcd_putsf(0, line
++, "B: %02x F: %02x J: %02x B: %02x F: %02x J: %02x",
1136 (unsigned int)GPIOB_ENABLE
,
1137 (unsigned int)GPIOF_ENABLE
,
1138 (unsigned int)GPIOJ_ENABLE
,
1139 (unsigned int)GPIOB_OUTPUT_EN
,
1140 (unsigned int)GPIOF_OUTPUT_EN
,
1141 (unsigned int)GPIOJ_OUTPUT_EN
);
1142 lcd_putsf(0, line
++, "C: %02x G: %02x K: %02x C: %02x G: %02x K: %02x",
1143 (unsigned int)GPIOC_ENABLE
,
1144 (unsigned int)GPIOG_ENABLE
,
1145 (unsigned int)GPIOK_ENABLE
,
1146 (unsigned int)GPIOC_OUTPUT_EN
,
1147 (unsigned int)GPIOG_OUTPUT_EN
,
1148 (unsigned int)GPIOK_OUTPUT_EN
);
1149 lcd_putsf(0, line
++, "D: %02x H: %02x L: %02x D: %02x H: %02x L: %02x",
1150 (unsigned int)GPIOD_ENABLE
,
1151 (unsigned int)GPIOH_ENABLE
,
1152 (unsigned int)GPIOL_ENABLE
,
1153 (unsigned int)GPIOD_OUTPUT_EN
,
1154 (unsigned int)GPIOH_OUTPUT_EN
,
1155 (unsigned int)GPIOL_OUTPUT_EN
);
1158 lcd_puts(0, line
++, "GPIO INPUT VAL:");
1159 lcd_putsf(0, line
++, "A: %02x E: %02x I: %02x",
1160 (unsigned int)GPIOA_INPUT_VAL
,
1161 (unsigned int)GPIOE_INPUT_VAL
,
1162 (unsigned int)GPIOI_INPUT_VAL
);
1163 lcd_putsf(0, line
++, "B: %02x F: %02x J: %02x",
1164 (unsigned int)GPIOB_INPUT_VAL
,
1165 (unsigned int)GPIOF_INPUT_VAL
,
1166 (unsigned int)GPIOJ_INPUT_VAL
);
1167 lcd_putsf(0, line
++, "C: %02x G: %02x K: %02x",
1168 (unsigned int)GPIOC_INPUT_VAL
,
1169 (unsigned int)GPIOG_INPUT_VAL
,
1170 (unsigned int)GPIOK_INPUT_VAL
);
1171 lcd_putsf(0, line
++, "D: %02x H: %02x L: %02x",
1172 (unsigned int)GPIOD_INPUT_VAL
,
1173 (unsigned int)GPIOH_INPUT_VAL
,
1174 (unsigned int)GPIOL_INPUT_VAL
);
1176 lcd_putsf(0, line
++, "GPO32_VAL: %08lx", GPO32_VAL
);
1177 lcd_putsf(0, line
++, "GPO32_EN: %08lx", GPO32_ENABLE
);
1178 lcd_putsf(0, line
++, "DEV_EN: %08lx", DEV_EN
);
1179 lcd_putsf(0, line
++, "DEV_EN2: %08lx", DEV_EN2
);
1180 lcd_putsf(0, line
++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */
1181 lcd_putsf(0, line
++, "DEV_INIT1: %08lx", DEV_INIT1
);
1182 lcd_putsf(0, line
++, "DEV_INIT2: %08lx", DEV_INIT2
);
1183 #ifdef ADC_ACCESSORY
1184 lcd_putsf(0, line
++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY
));
1187 lcd_putsf(0, line
++, "4066_ISTAT: %d", adc_read(ADC_4066_ISTAT
));
1190 #if defined(IPOD_ACCESSORY_PROTOCOL)
1191 const unsigned char *serbuf
= iap_get_serbuf();
1192 lcd_putsf(0, line
++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
1193 serbuf
[0], serbuf
[1], serbuf
[2], serbuf
[3], serbuf
[4], serbuf
[5],
1194 serbuf
[6], serbuf
[7]);
1197 #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1199 lcd_putsf(0, line
++, "BATT: %03x UNK1: %03x",
1200 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1201 lcd_putsf(0, line
++, "REM: %03x PAD: %03x",
1202 adc_read(ADC_REMOTE
), adc_read(ADC_SCROLLPAD
));
1203 #elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
1205 lcd_putsf(0, line
++, "BATT: %03x UNK1: %03x",
1206 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1207 #elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
1208 lcd_putsf(0, line
++, "ADC_BVDD: %4d", adc_read(ADC_BVDD
));
1209 lcd_putsf(0, line
++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP
));
1210 lcd_putsf(0, line
++, "ADC_UVDD: %4d", adc_read(ADC_UVDD
));
1211 lcd_putsf(0, line
++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN
));
1212 lcd_putsf(0, line
++, "ADC_CVDD: %4d", adc_read(ADC_CVDD
));
1213 lcd_putsf(0, line
++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP
));
1214 lcd_putsf(0, line
++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1
));
1215 lcd_putsf(0, line
++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2
));
1216 lcd_putsf(0, line
++, "ADC_VBE1: %4d", adc_read(ADC_VBE1
));
1217 lcd_putsf(0, line
++, "ADC_VBE2: %4d", adc_read(ADC_VBE2
));
1218 lcd_putsf(0, line
++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1
));
1219 #if !defined(PHILIPS_SA9200)
1220 lcd_putsf(0, line
++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2
));
1221 lcd_putsf(0, line
++, "ADC_VBAT: %4d", adc_read(ADC_VBAT
));
1225 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1227 lcd_setfont(FONT_UI
);
1232 #elif CONFIG_CPU == PP5002
1235 lcd_clear_display();
1236 lcd_setfont(FONT_SYSFIXED
);
1241 lcd_putsf(0, line
++, "GPIO_A: %02x GPIO_B: %02x",
1242 (unsigned int)GPIOA_INPUT_VAL
, (unsigned int)GPIOB_INPUT_VAL
);
1243 lcd_putsf(0, line
++, "GPIO_C: %02x GPIO_D: %02x",
1244 (unsigned int)GPIOC_INPUT_VAL
, (unsigned int)GPIOD_INPUT_VAL
);
1246 lcd_putsf(0, line
++, "DEV_EN: %08lx", DEV_EN
);
1247 lcd_putsf(0, line
++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE
);
1248 lcd_putsf(0, line
++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE
);
1249 lcd_putsf(0, line
++, "PLL_CONTROL: %08lx", PLL_CONTROL
);
1250 lcd_putsf(0, line
++, "PLL_DIV: %08lx", PLL_DIV
);
1251 lcd_putsf(0, line
++, "PLL_MULT: %08lx", PLL_MULT
);
1252 lcd_putsf(0, line
++, "TIMING1_CTL: %08lx", TIMING1_CTL
);
1253 lcd_putsf(0, line
++, "TIMING2_CTL: %08lx", TIMING2_CTL
);
1256 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1258 lcd_setfont(FONT_UI
);
1262 lcd_setfont(FONT_UI
);
1264 return __dbg_ports();
1268 #else /* !HAVE_LCD_BITMAP */
1269 bool dbg_ports(void)
1272 int adc_battery_voltage
;
1275 lcd_clear_display();
1280 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR
);
1281 } else if (currval
== 1) {
1282 lcd_putsf(0, 0, "PBDR: %04x", (unsigned short)PBDR
);
1284 int idx
= currval
- 2; /* idx < 7 */
1285 lcd_putsf(0, 0, "AN%d: %03x", idx
, adc_read(idx
));
1288 battery_read_info(&adc_battery_voltage
, NULL
);
1289 lcd_putsf(0, 1, "Batt: %d.%03dV", adc_battery_voltage
/ 1000,
1290 adc_battery_voltage
% 1000);
1293 button
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1297 case ACTION_STD_CANCEL
:
1300 case ACTION_SETTINGS_DEC
:
1306 case ACTION_SETTINGS_INC
:
1315 #endif /* !HAVE_LCD_BITMAP */
1316 #endif /* PLATFORM_NATIVE */
1318 #if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
1319 static bool dbg_pcf(void)
1323 #ifdef HAVE_LCD_BITMAP
1324 lcd_setfont(FONT_SYSFIXED
);
1326 lcd_clear_display();
1332 lcd_putsf(0, line
++, "DCDC1: %02x", pcf50605_read(0x1b));
1333 lcd_putsf(0, line
++, "DCDC2: %02x", pcf50605_read(0x1c));
1334 lcd_putsf(0, line
++, "DCDC3: %02x", pcf50605_read(0x1d));
1335 lcd_putsf(0, line
++, "DCDC4: %02x", pcf50605_read(0x1e));
1336 lcd_putsf(0, line
++, "DCDEC1: %02x", pcf50605_read(0x1f));
1337 lcd_putsf(0, line
++, "DCDEC2: %02x", pcf50605_read(0x20));
1338 lcd_putsf(0, line
++, "DCUDC1: %02x", pcf50605_read(0x21));
1339 lcd_putsf(0, line
++, "DCUDC2: %02x", pcf50605_read(0x22));
1340 lcd_putsf(0, line
++, "IOREGC: %02x", pcf50605_read(0x23));
1341 lcd_putsf(0, line
++, "D1REGC: %02x", pcf50605_read(0x24));
1342 lcd_putsf(0, line
++, "D2REGC: %02x", pcf50605_read(0x25));
1343 lcd_putsf(0, line
++, "D3REGC: %02x", pcf50605_read(0x26));
1344 lcd_putsf(0, line
++, "LPREG1: %02x", pcf50605_read(0x27));
1346 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1348 lcd_setfont(FONT_UI
);
1353 lcd_setfont(FONT_UI
);
1358 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
1359 static bool dbg_cpufreq(void)
1364 #ifdef HAVE_LCD_BITMAP
1365 lcd_setfont(FONT_SYSFIXED
);
1367 lcd_clear_display();
1373 lcd_putsf(0, line
++, "Frequency: %ld", FREQ
);
1374 lcd_putsf(0, line
++, "boost_counter: %d", get_cpu_boost_counter());
1377 button
= get_action(CONTEXT_STD
,HZ
/10);
1381 case ACTION_STD_PREV
:
1385 case ACTION_STD_NEXT
:
1390 while (get_cpu_boost_counter() > 0)
1392 set_cpu_frequency(CPUFREQ_DEFAULT
);
1395 case ACTION_STD_CANCEL
:
1396 lcd_setfont(FONT_UI
);
1400 lcd_setfont(FONT_UI
);
1403 #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1405 #if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
1406 #include "tsc2100.h"
1407 static char *itob(int n
, int len
)
1409 static char binary
[64];
1411 for (i
=1, j
=0;i
<=len
;i
++)
1413 binary
[j
++] = n
&(1<<(len
-i
))?'1':'0';
1421 static const char* tsc2100_debug_getname(int selected_item
, void * data
,
1422 char *buffer
, size_t buffer_len
)
1424 int *page
= (int*)data
;
1425 bool reserved
= false;
1429 if ((selected_item
> 0x0a) ||
1430 (selected_item
== 0x04) ||
1431 (selected_item
== 0x08))
1435 if ((selected_item
> 0x05) ||
1436 (selected_item
== 0x02))
1440 if (selected_item
> 0x1e)
1445 snprintf(buffer
, buffer_len
, "%02x: RESERVED", selected_item
);
1447 snprintf(buffer
, buffer_len
, "%02x: %s", selected_item
,
1448 itob(tsc2100_readreg(*page
, selected_item
)&0xffff,16));
1451 static int tsc2100debug_action_callback(int action
, struct gui_synclist
*lists
)
1453 int *page
= (int*)lists
->data
;
1454 if (action
== ACTION_STD_OK
)
1456 *page
= (*page
+1)%3;
1457 snprintf(lists
->title
, 32,
1458 "tsc2100 registers - Page %d", *page
);
1459 return ACTION_REDRAW
;
1463 static bool tsc2100_debug(void)
1466 char title
[32] = "tsc2100 registers - Page 0";
1467 struct simplelist_info info
;
1468 simplelist_info_init(&info
, title
, 32, &page
);
1469 info
.timeout
= HZ
/100;
1470 info
.get_name
= tsc2100_debug_getname
;
1471 info
.action_callback
= tsc2100debug_action_callback
;
1472 return simplelist_show_list(&info
);
1475 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1476 #ifdef HAVE_LCD_BITMAP
1478 * view_battery() shows a automatically scaled graph of the battery voltage
1479 * over time. Usable for estimating battery life / charging rate.
1480 * The power_history array is updated in power_thread of powermgmt.c.
1483 #define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
1484 #define BAT_YSPACE (LCD_HEIGHT - 20)
1487 static bool view_battery(void)
1490 int i
, x
, y
, y1
, y2
, grid
, graph
;
1491 unsigned short maxv
, minv
;
1493 lcd_setfont(FONT_SYSFIXED
);
1497 lcd_clear_display();
1499 case 0: /* voltage history graph */
1500 /* Find maximum and minimum voltage for scaling */
1501 minv
= power_history
[0];
1503 for (i
= 1; i
< BAT_LAST_VAL
&& power_history
[i
]; i
++) {
1504 if (power_history
[i
] > maxv
)
1505 maxv
= power_history
[i
];
1506 if (power_history
[i
] < minv
)
1507 minv
= power_history
[i
];
1510 /* adjust grid scale */
1511 if ((maxv
- minv
) > 50)
1517 lcd_putsf(0, 0, "battery %d.%03dV", power_history
[0] / 1000,
1518 power_history
[0] % 1000);
1519 lcd_putsf(0, 1, "%d.%03d-%d.%03dV (%2dmV)",
1520 minv
/ 1000, minv
% 1000, maxv
/ 1000, maxv
% 1000,
1524 while ((y
= (minv
- (minv
% grid
)+i
*grid
)) < maxv
)
1526 graph
= ((y
-minv
)*BAT_YSPACE
)/(maxv
-minv
);
1527 graph
= LCD_HEIGHT
-1 - graph
;
1529 /* draw dotted horizontal grid line */
1530 for (x
=0; x
<LCD_WIDTH
;x
=x
+2)
1531 lcd_drawpixel(x
,graph
);
1537 /* draw plot of power history
1538 * skip empty entries
1540 for (i
= BAT_LAST_VAL
- 1; i
> 0; i
--)
1542 if (power_history
[i
] && power_history
[i
-1])
1544 y1
= (power_history
[i
] - minv
) * BAT_YSPACE
/
1546 y1
= MIN(MAX(LCD_HEIGHT
-1 - y1
, 20),
1548 y2
= (power_history
[i
-1] - minv
) * BAT_YSPACE
/
1550 y2
= MIN(MAX(LCD_HEIGHT
-1 - y2
, 20),
1553 lcd_set_drawmode(DRMODE_SOLID
);
1555 /* make line thicker */
1556 lcd_drawline(((x
*LCD_WIDTH
)/(BAT_LAST_VAL
)),
1558 (((x
+1)*LCD_WIDTH
)/(BAT_LAST_VAL
)),
1560 lcd_drawline(((x
*LCD_WIDTH
)/(BAT_LAST_VAL
))+1,
1562 (((x
+1)*LCD_WIDTH
)/(BAT_LAST_VAL
))+1,
1569 case 1: /* status: */
1570 #if CONFIG_CHARGING >= CHARGING_MONITOR
1571 lcd_putsf(0, 0, "Pwr status: %s",
1572 charging_state() ? "charging" : "discharging");
1574 lcd_puts(0, 0, "Power status:");
1576 battery_read_info(&y
, NULL
);
1577 lcd_putsf(0, 1, "Battery: %d.%03d V", y
/ 1000, y
% 1000);
1578 #ifdef ADC_EXT_POWER
1579 y
= (adc_read(ADC_EXT_POWER
) * EXT_SCALE_FACTOR
) / 1000;
1580 lcd_putsf(0, 2, "External: %d.%03d V", y
/ 1000, y
% 1000);
1583 #if defined ARCHOS_RECORDER
1584 lcd_putsf(0, 3, "Chgr: %s %s",
1585 charger_inserted() ? "present" : "absent",
1586 charger_enabled() ? "on" : "off");
1587 lcd_putsf(0, 5, "short delta: %d", short_delta
);
1588 lcd_putsf(0, 6, "long delta: %d", long_delta
);
1589 lcd_puts(0, 7, power_message
);
1590 lcd_putsf(0, 8, "USB Inserted: %s",
1591 usb_inserted() ? "yes" : "no");
1592 #elif defined IPOD_NANO || defined IPOD_VIDEO
1593 int usb_pwr
= (GPIOL_INPUT_VAL
& 0x10)?true:false;
1594 int ext_pwr
= (GPIOL_INPUT_VAL
& 0x08)?false:true;
1595 int dock
= (GPIOA_INPUT_VAL
& 0x10)?true:false;
1596 int charging
= (GPIOB_INPUT_VAL
& 0x01)?false:true;
1597 int headphone
= (GPIOA_INPUT_VAL
& 0x80)?true:false;
1599 lcd_putsf(0, 3, "USB pwr: %s",
1600 usb_pwr
? "present" : "absent");
1601 lcd_putsf(0, 4, "EXT pwr: %s",
1602 ext_pwr
? "present" : "absent");
1603 lcd_putsf(0, 5, "Battery: %s",
1604 charging
? "charging" : (usb_pwr
||ext_pwr
) ? "charged" : "discharging");
1605 lcd_putsf(0, 6, "Dock mode: %s",
1606 dock
? "enabled" : "disabled");
1607 lcd_putsf(0, 7, "Headphone: %s",
1608 headphone
? "connected" : "disconnected");
1610 if(probed_ramsize
== 64)
1611 x
= (adc_read(ADC_4066_ISTAT
) * 2400) / (1024 * 2);
1613 x
= (adc_read(ADC_4066_ISTAT
) * 2400) / (1024 * 3);
1614 lcd_putsf(0, 8, "Ibat: %d mA", x
);
1615 lcd_putsf(0, 9, "Vbat * Ibat: %d mW", x
* y
/ 1000);
1617 #elif defined TOSHIBA_GIGABEAT_S
1621 static const unsigned char * const chrgstate_strings
[] =
1632 lcd_putsf(0, line
++, "Charger: %s",
1633 charger_inserted() ? "present" : "absent");
1635 st
= power_input_status() &
1636 (POWER_INPUT_CHARGER
| POWER_INPUT_BATTERY
);
1637 lcd_putsf(0, line
++, "%s%s",
1638 (st
& POWER_INPUT_MAIN_CHARGER
) ? " Main" : "",
1639 (st
& POWER_INPUT_USB_CHARGER
) ? " USB" : "");
1641 y
= ARRAYLEN(chrgstate_strings
) - 1;
1643 switch (charge_state
)
1645 case CHARGE_STATE_DISABLED
: y
--;
1646 case CHARGE_STATE_ERROR
: y
--;
1647 case DISCHARGING
: y
--;
1654 lcd_putsf(0, line
++, "State: %s", chrgstate_strings
[y
]);
1656 lcd_putsf(0, line
++, "Battery Switch: %s",
1657 (st
& POWER_INPUT_BATTERY
) ? "On" : "Off");
1659 y
= chrgraw_adc_voltage();
1660 lcd_putsf(0, line
++, "CHRGRAW: %d.%03d V",
1661 y
/ 1000, y
% 1000);
1663 y
= application_supply_adc_voltage();
1664 lcd_putsf(0, line
++, "BP : %d.%03d V",
1665 y
/ 1000, y
% 1000);
1667 y
= battery_adc_charge_current();
1668 if (y
< 0) x
= '-', y
= -y
;
1670 lcd_putsf(0, line
++, "CHRGISN:%c%d mA", x
, y
);
1672 y
= cccv_regulator_dissipation();
1673 lcd_putsf(0, line
++, "P CCCV : %d mW", y
);
1675 y
= battery_charge_current();
1676 if (y
< 0) x
= '-', y
= -y
;
1678 lcd_putsf(0, line
++, "I Charge:%c%d mA", x
, y
);
1680 y
= battery_adc_temp();
1683 lcd_putsf(0, line
++, "T Battery: %dC (%dF)", y
,
1686 /* Conversion disabled */
1687 lcd_puts(0, line
++, "T Battery: ?");
1690 #elif defined(SANSA_E200) || defined(SANSA_C200) || CONFIG_CPU == AS3525 || \
1691 CONFIG_CPU == AS3525v2
1692 static const char * const chrgstate_strings
[] =
1694 [CHARGE_STATE_DISABLED
- CHARGE_STATE_DISABLED
]= "Disabled",
1695 [CHARGE_STATE_ERROR
- CHARGE_STATE_DISABLED
] = "Error",
1696 [DISCHARGING
- CHARGE_STATE_DISABLED
] = "Discharging",
1697 [CHARGING
- CHARGE_STATE_DISABLED
] = "Charging",
1699 const char *str
= NULL
;
1701 lcd_putsf(0, 3, "Charger: %s",
1702 charger_inserted() ? "present" : "absent");
1704 y
= charge_state
- CHARGE_STATE_DISABLED
;
1705 if ((unsigned)y
< ARRAYLEN(chrgstate_strings
))
1706 str
= chrgstate_strings
[y
];
1708 lcd_putsf(0, 4, "State: %s",
1709 str
? str
: "<unknown>");
1711 lcd_putsf(0, 5, "CHARGER: %02X", ascodec_read_charger());
1712 #elif defined(IPOD_NANO2G)
1713 y
= pmu_read_battery_voltage();
1714 lcd_putsf(17, 1, "RAW: %d.%03d V", y
/ 1000, y
% 1000);
1715 y
= pmu_read_battery_current();
1716 lcd_putsf(0, 2, "Battery current: %d mA", y
);
1717 lcd_putsf(0, 3, "PWRCON: %8x", PWRCON
);
1718 lcd_putsf(0, 4, "PWRCONEXT: %8x", PWRCONEXT
);
1719 x
= pmu_read(0x1b) & 0xf;
1720 y
= pmu_read(0x1a) * 25 + 625;
1721 lcd_putsf(0, 5, "AUTO: %x / %d mV", x
, y
);
1722 x
= pmu_read(0x1f) & 0xf;
1723 y
= pmu_read(0x1e) * 25 + 625;
1724 lcd_putsf(0, 6, "DOWN1: %x / %d mV", x
, y
);
1725 x
= pmu_read(0x23) & 0xf;
1726 y
= pmu_read(0x22) * 25 + 625;
1727 lcd_putsf(0, 7, "DOWN2: %x / %d mV", x
, y
);
1728 x
= pmu_read(0x27) & 0xf;
1729 y
= pmu_read(0x26) * 100 + 900;
1730 lcd_putsf(0, 8, "MEMLDO: %x / %d mV", x
, y
);
1731 for (i
= 0; i
< 6; i
++)
1733 x
= pmu_read(0x2e + (i
<< 1)) & 0xf;
1734 y
= pmu_read(0x2d + (i
<< 1)) * 100 + 900;
1735 lcd_putsf(0, 9 + i
, "LDO%d: %x / %d mV", i
+ 1, x
, y
);
1737 lcd_putsf(0, 15, "CLKCON: %8x", CLKCON
);
1738 lcd_putsf(17, 15, "PLL0: %6x", PLL0PMS
);
1740 lcd_putsf(0, 3, "Charger: %s",
1741 charger_inserted() ? "present" : "absent");
1742 #endif /* target type */
1743 #endif /* CONFIG_CHARGING */
1746 case 2: /* voltage deltas: */
1747 lcd_puts(0, 0, "Voltage deltas:");
1749 for (i
= 0; i
<= 6; i
++) {
1750 y
= power_history
[i
] - power_history
[i
+1];
1751 lcd_putsf(0, i
+1, "-%d min: %s%d.%03d V", i
,
1752 (y
< 0) ? "-" : "", ((y
< 0) ? y
* -1 : y
) / 1000,
1753 ((y
< 0) ? y
* -1 : y
) % 1000);
1757 case 3: /* remaining time estimation: */
1759 #ifdef ARCHOS_RECORDER
1760 lcd_putsf(0, 0, "charge_state: %d", charge_state
);
1762 lcd_putsf(0, 1, "Cycle time: %d m", powermgmt_last_cycle_startstop_min
);
1764 lcd_putsf(0, 2, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level
);
1766 lcd_putsf(0, 3, "P=%2d I=%2d", pid_p
, pid_i
);
1768 lcd_putsf(0, 4, "Trickle sec: %d/60", trickle_sec
);
1769 #endif /* ARCHOS_RECORDER */
1771 lcd_putsf(0, 5, "Last PwrHist: %d.%03dV",
1772 power_history
[0] / 1000,
1773 power_history
[0] % 1000);
1775 lcd_putsf(0, 6, "battery level: %d%%", battery_level());
1777 lcd_putsf(0, 7, "Est. remain: %d m", battery_time());
1783 switch(get_action(CONTEXT_STD
,HZ
/2))
1785 case ACTION_STD_PREV
:
1790 case ACTION_STD_NEXT
:
1795 case ACTION_STD_CANCEL
:
1796 lcd_setfont(FONT_UI
);
1800 lcd_setfont(FONT_UI
);
1804 #endif /* HAVE_LCD_BITMAP */
1807 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
1808 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
1810 #if (CONFIG_STORAGE & STORAGE_MMC)
1811 #define CARDTYPE "MMC"
1812 #elif (CONFIG_STORAGE & STORAGE_SD)
1813 #define CARDTYPE "microSD"
1816 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1819 int *cardnum
= (int*)lists
->data
;
1820 unsigned char card_name
[6];
1821 unsigned char pbuf
[32];
1822 char *title
= lists
->title
;
1823 static const unsigned char i_vmin
[] = { 0, 1, 5, 10, 25, 35, 60, 100 };
1824 static const unsigned char i_vmax
[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
1825 static const unsigned char * const kbit_units
[] = { "kBit/s", "MBit/s", "GBit/s" };
1826 static const unsigned char * const nsec_units
[] = { "ns", "µs", "ms" };
1827 #if (CONFIG_STORAGE & STORAGE_MMC)
1828 static const char * const mmc_spec_vers
[] = { "1.0-1.2", "1.4", "2.0-2.2",
1829 "3.1-3.31", "4.0" };
1832 if ((btn
== ACTION_STD_OK
) || (btn
== SYS_FS_CHANGED
) || (btn
== ACTION_REDRAW
))
1835 if (btn
== ACTION_STD_OK
)
1837 *cardnum
^= 0x1; /* change cards */
1841 simplelist_set_line_count(0);
1843 card
= card_get_info(*cardnum
);
1845 if (card
->initialized
> 0)
1848 for (i
=0; i
<sizeof(card_name
); i
++)
1850 card_name
[i
] = card_extract_bits(card
->cid
, (103-8*i
), 8);
1852 strlcpy(card_name
, card_name
, sizeof(card_name
));
1853 simplelist_addline(SIMPLELIST_ADD_LINE
,
1854 "%s Rev %d.%d", card_name
,
1855 (int) card_extract_bits(card
->cid
, 63, 4),
1856 (int) card_extract_bits(card
->cid
, 59, 4));
1857 simplelist_addline(SIMPLELIST_ADD_LINE
,
1859 #if (CONFIG_STORAGE & STORAGE_SD)
1860 (int) card_extract_bits(card
->cid
, 11, 4),
1861 (int) card_extract_bits(card
->cid
, 19, 8) + 2000
1862 #elif (CONFIG_STORAGE & STORAGE_MMC)
1863 (int) card_extract_bits(card
->cid
, 15, 4),
1864 (int) card_extract_bits(card
->cid
, 11, 4) + 1997
1867 simplelist_addline(SIMPLELIST_ADD_LINE
,
1868 #if (CONFIG_STORAGE & STORAGE_SD)
1870 card_extract_bits(card
->cid
, 55, 32)
1871 #elif (CONFIG_STORAGE & STORAGE_MMC)
1873 card_extract_bits(card
->cid
, 47, 16)
1877 simplelist_addline(SIMPLELIST_ADD_LINE
, "M=%02x, "
1878 #if (CONFIG_STORAGE & STORAGE_SD)
1880 (int) card_extract_bits(card
->cid
, 127, 8),
1881 card_extract_bits(card
->cid
, 119, 8),
1882 card_extract_bits(card
->cid
, 111, 8)
1883 #elif (CONFIG_STORAGE & STORAGE_MMC)
1885 (int) card_extract_bits(card
->cid
, 127, 8),
1886 (int) card_extract_bits(card
->cid
, 119, 16)
1890 #if (CONFIG_STORAGE & STORAGE_MMC)
1891 int temp
= card_extract_bits(card
->csd
, 125, 4);
1892 simplelist_addline(SIMPLELIST_ADD_LINE
,
1893 "MMC v%s", temp
< 5 ?
1894 mmc_spec_vers
[temp
] : "?.?");
1896 simplelist_addline(SIMPLELIST_ADD_LINE
,
1897 "Blocks: 0x%08lx", card
->numblocks
);
1898 output_dyn_value(pbuf
, sizeof pbuf
, card
->speed
/ 1000,
1900 simplelist_addline(SIMPLELIST_ADD_LINE
,
1902 output_dyn_value(pbuf
, sizeof pbuf
, card
->taac
,
1904 simplelist_addline(SIMPLELIST_ADD_LINE
,
1906 simplelist_addline(SIMPLELIST_ADD_LINE
,
1907 "Nsac: %d clk", card
->nsac
);
1908 simplelist_addline(SIMPLELIST_ADD_LINE
,
1909 "R2W: *%d", card
->r2w_factor
);
1910 simplelist_addline(SIMPLELIST_ADD_LINE
,
1912 i_vmin
[card_extract_bits(card
->csd
, 61, 3)],
1913 i_vmax
[card_extract_bits(card
->csd
, 58, 3)]);
1914 simplelist_addline(SIMPLELIST_ADD_LINE
,
1916 i_vmin
[card_extract_bits(card
->csd
, 55, 3)],
1917 i_vmax
[card_extract_bits(card
->csd
, 52, 3)]);
1919 else if (card
->initialized
== 0)
1921 simplelist_addline(SIMPLELIST_ADD_LINE
, "Not Found!");
1923 #if (CONFIG_STORAGE & STORAGE_SD)
1924 else /* card->initialized < 0 */
1926 simplelist_addline(SIMPLELIST_ADD_LINE
, "Init Error! (%d)", card
->initialized
);
1929 snprintf(title
, 16, "[" CARDTYPE
" %d]", *cardnum
);
1930 gui_synclist_set_title(lists
, title
, Icon_NOICON
);
1931 gui_synclist_set_nb_items(lists
, simplelist_get_line_count());
1932 gui_synclist_select_item(lists
, 0);
1933 btn
= ACTION_REDRAW
;
1937 #elif (CONFIG_STORAGE & STORAGE_ATA)
1938 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1943 unsigned short* identify_info
= ata_get_identify();
1944 bool timing_info_present
= false;
1947 simplelist_set_line_count(0);
1949 for (i
=0; i
< 20; i
++)
1950 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+27]);
1952 /* kill trailing space */
1953 for (i
=39; i
&& buf
[i
]==' '; i
--)
1955 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", buf
);
1956 for (i
=0; i
< 4; i
++)
1957 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+23]);
1959 simplelist_addline(SIMPLELIST_ADD_LINE
,
1960 "Firmware: %s", buf
);
1961 snprintf(buf
, sizeof buf
, "%ld MB",
1962 ((unsigned long)identify_info
[61] << 16 |
1963 (unsigned long)identify_info
[60]) / 2048 );
1964 simplelist_addline(SIMPLELIST_ADD_LINE
,
1967 fat_size( IF_MV2(0,) NULL
, &free
);
1968 simplelist_addline(SIMPLELIST_ADD_LINE
,
1969 "Free: %ld MB", free
/ 1024);
1970 simplelist_addline(SIMPLELIST_ADD_LINE
,
1971 "Spinup time: %d ms", storage_spinup_time() * (1000/HZ
));
1972 i
= identify_info
[83] & (1<<3);
1973 simplelist_addline(SIMPLELIST_ADD_LINE
,
1974 "Power mgmt: %s", i
? "enabled" : "unsupported");
1975 i
= identify_info
[83] & (1<<9);
1976 simplelist_addline(SIMPLELIST_ADD_LINE
,
1977 "Noise mgmt: %s", i
? "enabled" : "unsupported");
1978 i
= identify_info
[82] & (1<<6);
1979 simplelist_addline(SIMPLELIST_ADD_LINE
,
1980 "Read-ahead: %s", i
? "enabled" : "unsupported");
1981 timing_info_present
= identify_info
[53] & (1<<1);
1982 if(timing_info_present
) {
1983 char pio3
[2], pio4
[2];pio3
[1] = 0;
1985 pio3
[0] = (identify_info
[64] & (1<<0)) ? '3' : 0;
1986 pio4
[0] = (identify_info
[64] & (1<<1)) ? '4' : 0;
1987 simplelist_addline(SIMPLELIST_ADD_LINE
,
1988 "PIO modes: 0 1 2 %s %s", pio3
, pio4
);
1991 simplelist_addline(SIMPLELIST_ADD_LINE
,
1992 "No PIO mode info");
1994 timing_info_present
= identify_info
[53] & (1<<1);
1995 if(timing_info_present
) {
1996 simplelist_addline(SIMPLELIST_ADD_LINE
,
1997 "Cycle times %dns/%dns",
1999 identify_info
[68] );
2001 simplelist_addline(SIMPLELIST_ADD_LINE
,
2004 int sector_size
= 512;
2005 if((identify_info
[106] & 0xe000) == 0x6000)
2006 sector_size
*= BIT_N(identify_info
[106] & 0x000f);
2007 simplelist_addline(SIMPLELIST_ADD_LINE
,
2008 "Physical sector size: %d", sector_size
);
2010 if (identify_info
[63] & (1<<0)) {
2011 char mdma0
[2], mdma1
[2], mdma2
[2];
2012 mdma0
[1] = mdma1
[1] = mdma2
[1] = 0;
2013 mdma0
[0] = (identify_info
[63] & (1<<0)) ? '0' : 0;
2014 mdma1
[0] = (identify_info
[63] & (1<<1)) ? '1' : 0;
2015 mdma2
[0] = (identify_info
[63] & (1<<2)) ? '2' : 0;
2016 simplelist_addline(SIMPLELIST_ADD_LINE
,
2017 "MDMA modes: %s %s %s", mdma0
, mdma1
, mdma2
);
2018 simplelist_addline(SIMPLELIST_ADD_LINE
,
2019 "MDMA Cycle times %dns/%dns",
2021 identify_info
[66] );
2024 simplelist_addline(SIMPLELIST_ADD_LINE
,
2025 "No MDMA mode info");
2027 if (identify_info
[53] & (1<<2)) {
2028 char udma0
[2], udma1
[2], udma2
[2], udma3
[2], udma4
[2], udma5
[2], udma6
[2];
2029 udma0
[1] = udma1
[1] = udma2
[1] = udma3
[1] = udma4
[1] = udma5
[1] = udma6
[1] = 0;
2030 udma0
[0] = (identify_info
[88] & (1<<0)) ? '0' : 0;
2031 udma1
[0] = (identify_info
[88] & (1<<1)) ? '1' : 0;
2032 udma2
[0] = (identify_info
[88] & (1<<2)) ? '2' : 0;
2033 udma3
[0] = (identify_info
[88] & (1<<3)) ? '3' : 0;
2034 udma4
[0] = (identify_info
[88] & (1<<4)) ? '4' : 0;
2035 udma5
[0] = (identify_info
[88] & (1<<5)) ? '5' : 0;
2036 udma6
[0] = (identify_info
[88] & (1<<6)) ? '6' : 0;
2037 simplelist_addline(SIMPLELIST_ADD_LINE
,
2038 "UDMA modes: %s %s %s %s %s %s %s", udma0
, udma1
, udma2
,
2039 udma3
, udma4
, udma5
, udma6
);
2042 simplelist_addline(SIMPLELIST_ADD_LINE
,
2043 "No UDMA mode info");
2045 #endif /* HAVE_ATA_DMA */
2046 timing_info_present
= identify_info
[53] & (1<<1);
2047 if(timing_info_present
) {
2048 i
= identify_info
[49] & (1<<11);
2049 simplelist_addline(SIMPLELIST_ADD_LINE
,
2050 "IORDY support: %s", i
? "yes" : "no");
2051 i
= identify_info
[49] & (1<<10);
2052 simplelist_addline(SIMPLELIST_ADD_LINE
,
2053 "IORDY disable: %s", i
? "yes" : "no");
2055 simplelist_addline(SIMPLELIST_ADD_LINE
,
2058 simplelist_addline(SIMPLELIST_ADD_LINE
,
2059 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2061 i
= ata_get_dma_mode();
2063 simplelist_addline(SIMPLELIST_ADD_LINE
,
2066 simplelist_addline(SIMPLELIST_ADD_LINE
,
2068 (i
& 0x40) ? "UDMA" : "MDMA",
2071 #endif /* HAVE_ATA_DMA */
2074 #else /* No SD, MMC or ATA */
2075 static int disk_callback(int btn
, struct gui_synclist
*lists
)
2079 struct storage_info info
;
2080 storage_get_info(0,&info
);
2081 simplelist_addline(SIMPLELIST_ADD_LINE
, "Vendor: %s", info
.vendor
);
2082 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", info
.product
);
2083 simplelist_addline(SIMPLELIST_ADD_LINE
, "Firmware: %s", info
.revision
);
2084 simplelist_addline(SIMPLELIST_ADD_LINE
,
2085 "Size: %ld MB", info
.num_sectors
*(info
.sector_size
/512)/2024);
2087 fat_size( IF_MV2(0,) NULL
, &free
);
2088 simplelist_addline(SIMPLELIST_ADD_LINE
,
2089 "Free: %ld MB", free
/ 1024);
2090 simplelist_addline(SIMPLELIST_ADD_LINE
,
2091 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2096 #if (CONFIG_STORAGE & STORAGE_ATA)
2097 static bool dbg_identify_info(void)
2099 int fd
= creat("/identify_info.bin", 0666);
2102 #ifdef ROCKBOX_LITTLE_ENDIAN
2103 ecwrite(fd
, ata_get_identify(), SECTOR_SIZE
/2, "s", true);
2105 write(fd
, ata_get_identify(), SECTOR_SIZE
);
2113 static bool dbg_disk_info(void)
2115 struct simplelist_info info
;
2116 simplelist_info_init(&info
, "Disk Info", 1, NULL
);
2117 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
2120 info
.callback_data
= (void*)&card
;
2123 info
.action_callback
= disk_callback
;
2124 info
.hide_selection
= true;
2125 info
.scroll_all
= true;
2126 return simplelist_show_list(&info
);
2128 #endif /* PLATFORM_NATIVE */
2130 #ifdef HAVE_DIRCACHE
2131 static int dircache_callback(int btn
, struct gui_synclist
*lists
)
2133 (void)btn
; (void)lists
;
2134 simplelist_set_line_count(0);
2135 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache initialized: %s",
2136 dircache_is_enabled() ? "Yes" : "No");
2137 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache size: %d B",
2138 dircache_get_cache_size());
2139 simplelist_addline(SIMPLELIST_ADD_LINE
, "Last size: %d B",
2140 global_status
.dircache_size
);
2141 simplelist_addline(SIMPLELIST_ADD_LINE
, "Limit: %d B",
2143 simplelist_addline(SIMPLELIST_ADD_LINE
, "Reserve: %d/%d B",
2144 dircache_get_reserve_used(), DIRCACHE_RESERVE
);
2145 simplelist_addline(SIMPLELIST_ADD_LINE
, "Scanning took: %d s",
2146 dircache_get_build_ticks() / HZ
);
2147 simplelist_addline(SIMPLELIST_ADD_LINE
, "Entry count: %d",
2148 dircache_get_entry_count());
2152 static bool dbg_dircache_info(void)
2154 struct simplelist_info info
;
2155 simplelist_info_init(&info
, "Dircache Info", 7, NULL
);
2156 info
.action_callback
= dircache_callback
;
2157 info
.hide_selection
= true;
2158 info
.scroll_all
= true;
2159 return simplelist_show_list(&info
);
2162 #endif /* HAVE_DIRCACHE */
2164 #ifdef HAVE_TAGCACHE
2165 static int database_callback(int btn
, struct gui_synclist
*lists
)
2168 struct tagcache_stat
*stat
= tagcache_get_stat();
2169 static bool synced
= false;
2171 simplelist_set_line_count(0);
2173 simplelist_addline(SIMPLELIST_ADD_LINE
, "Initialized: %s",
2174 stat
->initialized
? "Yes" : "No");
2175 simplelist_addline(SIMPLELIST_ADD_LINE
, "DB Ready: %s",
2176 stat
->ready
? "Yes" : "No");
2177 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM Cache: %s",
2178 stat
->ramcache
? "Yes" : "No");
2179 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM: %d/%d B",
2180 stat
->ramcache_used
, stat
->ramcache_allocated
);
2181 simplelist_addline(SIMPLELIST_ADD_LINE
, "Progress: %d%% (%d entries)",
2182 stat
->progress
, stat
->processed_entries
);
2183 simplelist_addline(SIMPLELIST_ADD_LINE
, "Curfile: %s",
2184 stat
->curentry
? stat
->curentry
: "---");
2185 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit step: %d",
2187 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit delayed: %s",
2188 stat
->commit_delayed
? "Yes" : "No");
2190 simplelist_addline(SIMPLELIST_ADD_LINE
, "Queue length: %d",
2191 stat
->queue_length
);
2196 tagcache_screensync_event();
2199 if (!btn
&& stat
->curentry
)
2202 return ACTION_REDRAW
;
2205 if (btn
== ACTION_STD_CANCEL
)
2206 tagcache_screensync_enable(false);
2210 static bool dbg_tagcache_info(void)
2212 struct simplelist_info info
;
2213 simplelist_info_init(&info
, "Database Info", 8, NULL
);
2214 info
.action_callback
= database_callback
;
2215 info
.hide_selection
= true;
2216 info
.scroll_all
= true;
2218 /* Don't do nonblock here, must give enough processing time
2219 for tagcache thread. */
2220 /* info.timeout = TIMEOUT_NOBLOCK; */
2222 tagcache_screensync_enable(true);
2223 return simplelist_show_list(&info
);
2227 #if CONFIG_CPU == SH7034
2228 static bool dbg_save_roms(void)
2231 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2233 fd
= creat("/internal_rom_0000-FFFF.bin", 0666);
2236 write(fd
, (void *)0, 0x10000);
2240 fd
= creat("/internal_rom_2000000-203FFFF.bin", 0666);
2243 write(fd
, (void *)0x2000000, 0x40000);
2247 system_memory_guard(oldmode
);
2250 #elif defined CPU_COLDFIRE
2251 static bool dbg_save_roms(void)
2254 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2256 #if defined(IRIVER_H100_SERIES)
2257 fd
= creat("/internal_rom_000000-1FFFFF.bin", 0666);
2258 #elif defined(IRIVER_H300_SERIES)
2259 fd
= creat("/internal_rom_000000-3FFFFF.bin", 0666);
2260 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3)
2261 fd
= creat("/internal_rom_000000-3FFFFF.bin", 0666);
2262 #elif defined(MPIO_HD200)
2263 fd
= creat("/internal_rom_000000-1FFFFF.bin", 0666);
2267 write(fd
, (void *)0, FLASH_SIZE
);
2270 system_memory_guard(oldmode
);
2273 fd
= creat("/internal_eeprom.bin", 0666);
2277 char buf
[EEPROM_SIZE
];
2280 old_irq_level
= disable_irq_save();
2282 err
= eeprom_24cxx_read(0, buf
, sizeof buf
);
2284 restore_irq(old_irq_level
);
2287 splashf(HZ
*3, "Eeprom read failure (%d)", err
);
2290 write(fd
, buf
, sizeof buf
);
2299 #elif defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)
2300 static bool dbg_save_roms(void)
2304 fd
= creat("/internal_rom_000000-0FFFFF.bin", 0666);
2307 write(fd
, (void *)0x20000000, FLASH_SIZE
);
2313 #elif CONFIG_CPU == IMX31L
2314 static bool dbg_save_roms(void)
2318 fd
= creat("/flash_rom_A0000000-A01FFFFF.bin", 0666);
2321 write(fd
, (void*)0xa0000000, FLASH_SIZE
);
2327 #elif defined(CPU_TCC780X)
2328 static bool dbg_save_roms(void)
2332 fd
= creat("/eeprom_E0000000-E0001FFF.bin", 0666);
2335 write(fd
, (void*)0xe0000000, 0x2000);
2346 #ifdef CONFIG_TUNER_MULTI
2347 static int tuner_type
= 0;
2348 #define IF_TUNER_TYPE(type) if(tuner_type==type)
2350 #define IF_TUNER_TYPE(type)
2353 static int radio_callback(int btn
, struct gui_synclist
*lists
)
2356 if (btn
== ACTION_STD_CANCEL
)
2358 simplelist_set_line_count(1);
2360 #if (CONFIG_TUNER & LV24020LP)
2361 simplelist_addline(SIMPLELIST_ADD_LINE
,
2362 "CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT
) );
2363 simplelist_addline(SIMPLELIST_ADD_LINE
,
2364 "RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT
) );
2365 simplelist_addline(SIMPLELIST_ADD_LINE
,
2366 "MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM
) );
2367 simplelist_addline(SIMPLELIST_ADD_LINE
,
2368 "MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF
) );
2369 simplelist_addline(SIMPLELIST_ADD_LINE
,
2370 "MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD
) );
2371 simplelist_addline(SIMPLELIST_ADD_LINE
,
2372 "if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET
) );
2373 simplelist_addline(SIMPLELIST_ADD_LINE
,
2374 "sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET
) );
2375 #endif /* LV24020LP */
2376 #if (CONFIG_TUNER & S1A0903X01)
2377 simplelist_addline(SIMPLELIST_ADD_LINE
,
2378 "Samsung regs: %08X", s1a0903x01_get(RADIO_ALL
));
2379 /* This one doesn't return dynamic data atm */
2380 #endif /* S1A0903X01 */
2381 #if (CONFIG_TUNER & TEA5767)
2382 struct tea5767_dbg_info nfo
;
2383 tea5767_dbg_info(&nfo
);
2384 simplelist_addline(SIMPLELIST_ADD_LINE
, "Philips regs:");
2385 simplelist_addline(SIMPLELIST_ADD_LINE
,
2386 " Read: %02X %02X %02X %02X %02X",
2387 (unsigned)nfo
.read_regs
[0], (unsigned)nfo
.read_regs
[1],
2388 (unsigned)nfo
.read_regs
[2], (unsigned)nfo
.read_regs
[3],
2389 (unsigned)nfo
.read_regs
[4]);
2390 simplelist_addline(SIMPLELIST_ADD_LINE
,
2391 " Write: %02X %02X %02X %02X %02X",
2392 (unsigned)nfo
.write_regs
[0], (unsigned)nfo
.write_regs
[1],
2393 (unsigned)nfo
.write_regs
[2], (unsigned)nfo
.write_regs
[3],
2394 (unsigned)nfo
.write_regs
[4]);
2395 #endif /* TEA5767 */
2396 #if (CONFIG_TUNER & SI4700)
2397 IF_TUNER_TYPE(SI4700
)
2399 struct si4700_dbg_info nfo
;
2401 si4700_dbg_info(&nfo
);
2402 simplelist_addline(SIMPLELIST_ADD_LINE
, "SI4700 regs:");
2403 for (i
= 0; i
< 16; i
+= 4) {
2404 simplelist_addline(SIMPLELIST_ADD_LINE
,"%02X: %04X %04X %04X %04X",
2405 i
, nfo
.regs
[i
], nfo
.regs
[i
+1], nfo
.regs
[i
+2], nfo
.regs
[i
+3]);
2409 #if (CONFIG_TUNER & RDA5802)
2410 IF_TUNER_TYPE(RDA5802
)
2412 struct rda5802_dbg_info nfo
;
2414 rda5802_dbg_info(&nfo
);
2415 simplelist_addline(SIMPLELIST_ADD_LINE
, "RDA5802 regs:");
2416 for (i
= 0; i
< 16; i
+= 4) {
2417 simplelist_addline(SIMPLELIST_ADD_LINE
,"%02X: %04X %04X %04X %04X",
2418 i
, nfo
.regs
[i
], nfo
.regs
[i
+1], nfo
.regs
[i
+2], nfo
.regs
[i
+3]);
2421 #endif /* RDA55802 */
2422 return ACTION_REDRAW
;
2424 static bool dbg_fm_radio(void)
2426 struct simplelist_info info
;
2427 #ifdef CONFIG_TUNER_MULTI
2428 tuner_type
= tuner_detect_type();
2430 info
.scroll_all
= true;
2431 simplelist_info_init(&info
, "FM Radio", 1, NULL
);
2432 simplelist_set_line_count(0);
2433 simplelist_addline(SIMPLELIST_ADD_LINE
, "HW detected: %s",
2434 radio_hardware_present() ? "yes" : "no");
2436 info
.action_callback
= radio_hardware_present()?radio_callback
: NULL
;
2437 info
.hide_selection
= true;
2438 return simplelist_show_list(&info
);
2440 #endif /* CONFIG_TUNER */
2441 #endif /* !SIMULATOR */
2443 #ifdef HAVE_LCD_BITMAP
2444 extern bool do_screendump_instead_of_usb
;
2446 static bool dbg_screendump(void)
2448 do_screendump_instead_of_usb
= !do_screendump_instead_of_usb
;
2449 splashf(HZ
, "Screendump %s",
2450 do_screendump_instead_of_usb
?"enabled":"disabled");
2453 #endif /* HAVE_LCD_BITMAP */
2455 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2456 static bool dbg_set_memory_guard(void)
2458 static const struct opt_items names
[MAXMEMGUARD
] = {
2460 { "Flash ROM writes", -1 },
2461 { "Zero area (all)", -1 }
2463 int mode
= system_memory_guard(MEMGUARD_KEEP
);
2465 set_option( "Catch mem accesses", &mode
, INT
, names
, MAXMEMGUARD
, NULL
);
2466 system_memory_guard(mode
);
2470 #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
2472 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2473 static bool dbg_write_eeprom(void)
2478 char buf
[EEPROM_SIZE
];
2481 fd
= open("/internal_eeprom.bin", O_RDONLY
);
2485 rc
= read(fd
, buf
, EEPROM_SIZE
);
2487 if(rc
== EEPROM_SIZE
)
2489 old_irq_level
= disable_irq_save();
2491 err
= eeprom_24cxx_write(0, buf
, sizeof buf
);
2493 splashf(HZ
*3, "Eeprom write failure (%d)", err
);
2495 splash(HZ
*3, "Eeprom written successfully");
2497 restore_irq(old_irq_level
);
2501 splashf(HZ
*3, "File read error (%d)",rc
);
2507 splash(HZ
*3, "Failed to open 'internal_eeprom.bin'");
2512 #endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
2513 #ifdef CPU_BOOST_LOGGING
2514 static bool cpu_boost_log(void)
2517 int count
= cpu_boost_log_getcount();
2518 int lines
= LCD_HEIGHT
/SYSFONT_HEIGHT
;
2521 lcd_setfont(FONT_SYSFIXED
);
2522 str
= cpu_boost_log_getlog_first();
2525 lcd_clear_display();
2526 for(j
=0; j
<lines
; j
++,i
++)
2529 str
= cpu_boost_log_getlog_next();
2532 if(strlen(str
) > LCD_WIDTH
/SYSFONT_WIDTH
)
2533 lcd_puts_scroll(0, j
, str
);
2543 switch(get_action(CONTEXT_STD
,TIMEOUT_BLOCK
))
2546 case ACTION_STD_PREV
:
2547 case ACTION_STD_NEXT
:
2550 case ACTION_STD_CANCEL
:
2558 get_action(CONTEXT_STD
,TIMEOUT_BLOCK
);
2559 lcd_setfont(FONT_UI
);
2564 #if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
2565 && !defined(IPOD_MINI) && !defined(SIMULATOR))
2566 extern bool wheel_is_touched
;
2567 extern int old_wheel_value
;
2568 extern int new_wheel_value
;
2569 extern int wheel_delta
;
2570 extern unsigned int accumulated_wheel_delta
;
2571 extern unsigned int wheel_velocity
;
2573 static bool dbg_scrollwheel(void)
2577 lcd_setfont(FONT_SYSFIXED
);
2581 if (action_userabort(HZ
/10))
2584 lcd_clear_display();
2586 /* show internal variables of scrollwheel driver */
2587 lcd_putsf(0, 0, "wheel touched: %s", (wheel_is_touched
) ? "true" : "false");
2588 lcd_putsf(0, 1, "new position: %2d", new_wheel_value
);
2589 lcd_putsf(0, 2, "old position: %2d", old_wheel_value
);
2590 lcd_putsf(0, 3, "wheel delta: %2d", wheel_delta
);
2591 lcd_putsf(0, 4, "accumulated delta: %2d", accumulated_wheel_delta
);
2592 lcd_putsf(0, 5, "velo [deg/s]: %4d", (int)wheel_velocity
);
2594 /* show effective accelerated scrollspeed */
2595 speed
= button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity
);
2596 lcd_putsf(0, 6, "accel. speed: %4d", speed
);
2600 lcd_setfont(FONT_UI
);
2605 #if defined (HAVE_USBSTACK)
2607 #if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
2608 static bool toggle_usb_core_driver(int driver
, char *msg
)
2610 bool enabled
= !usb_core_driver_enabled(driver
);
2612 usb_core_enable_driver(driver
,enabled
);
2613 splashf(HZ
, "%s %s", msg
, enabled
?"enabled":"disabled");
2618 static bool toggle_usb_serial(void)
2620 return toggle_usb_core_driver(USB_DRIVER_SERIAL
,"USB Serial");
2626 #if CONFIG_USBOTG == USBOTG_ISP1583
2627 extern int dbg_usb_num_items(void);
2628 extern const char* dbg_usb_item(int selected_item
, void *data
,
2629 char *buffer
, size_t buffer_len
);
2631 static int isp1583_action_callback(int action
, struct gui_synclist
*lists
)
2634 if (action
== ACTION_NONE
)
2635 action
= ACTION_REDRAW
;
2639 static bool dbg_isp1583(void)
2641 struct simplelist_info isp1583
;
2642 isp1583
.scroll_all
= true;
2643 simplelist_info_init(&isp1583
, "ISP1583", dbg_usb_num_items(), NULL
);
2644 isp1583
.timeout
= HZ
/100;
2645 isp1583
.hide_selection
= true;
2646 isp1583
.get_name
= dbg_usb_item
;
2647 isp1583
.action_callback
= isp1583_action_callback
;
2648 return simplelist_show_list(&isp1583
);
2652 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2653 extern int pic_dbg_num_items(void);
2654 extern const char* pic_dbg_item(int selected_item
, void *data
,
2655 char *buffer
, size_t buffer_len
);
2657 static int pic_action_callback(int action
, struct gui_synclist
*lists
)
2660 if (action
== ACTION_NONE
)
2661 action
= ACTION_REDRAW
;
2665 static bool dbg_pic(void)
2667 struct simplelist_info pic
;
2668 pic
.scroll_all
= true;
2669 simplelist_info_init(&pic
, "PIC", pic_dbg_num_items(), NULL
);
2670 pic
.timeout
= HZ
/100;
2671 pic
.hide_selection
= true;
2672 pic
.get_name
= pic_dbg_item
;
2673 pic
.action_callback
= pic_action_callback
;
2674 return simplelist_show_list(&pic
);
2679 /****** The menu *********/
2680 struct the_menu_item
{
2681 unsigned char *desc
; /* string or ID */
2682 bool (*function
) (void); /* return true if USB was connected */
2684 static const struct the_menu_item menuitems
[] = {
2685 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2686 (defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)) || \
2687 CONFIG_CPU == IMX31L || defined(CPU_TCC780X)
2688 { "Dump ROM contents", dbg_save_roms
},
2690 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \
2691 || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 \
2692 || CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2
2693 { "View I/O ports", dbg_ports
},
2695 #if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
2696 { "View PCF registers", dbg_pcf
},
2698 #if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
2699 { "TSC2100 debug", tsc2100_debug
},
2701 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
2702 { "CPU frequency", dbg_cpufreq
},
2704 #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
2705 { "S/PDIF analyzer", dbg_spdif
},
2707 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2708 { "Catch mem accesses", dbg_set_memory_guard
},
2710 { "View OS stacks", dbg_os
},
2711 #ifdef HAVE_LCD_BITMAP
2712 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2713 { "View battery", view_battery
},
2715 { "Screendump", dbg_screendump
},
2717 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2718 { "View HW info", dbg_hw_info
},
2720 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2721 { "View partitions", dbg_partitions
},
2723 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
2724 { "View disk info", dbg_disk_info
},
2725 #if (CONFIG_STORAGE & STORAGE_ATA)
2726 { "Dump ATA identify info", dbg_identify_info
},
2729 #ifdef HAVE_DIRCACHE
2730 { "View dircache info", dbg_dircache_info
},
2732 #ifdef HAVE_TAGCACHE
2733 { "View database info", dbg_tagcache_info
},
2735 #ifdef HAVE_LCD_BITMAP
2736 #if CONFIG_CODEC == SWCODEC
2737 { "View buffering thread", dbg_buffering_thread
},
2738 #elif !defined(SIMULATOR)
2739 { "View audio thread", dbg_audio_thread
},
2742 { "pm histogram", peak_meter_histogram
},
2743 #endif /* PM_DEBUG */
2744 #endif /* HAVE_LCD_BITMAP */
2747 { "FM Radio", dbg_fm_radio
},
2750 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2751 { "Write back EEPROM", dbg_write_eeprom
},
2753 #if CONFIG_USBOTG == USBOTG_ISP1583
2754 { "View ISP1583 info", dbg_isp1583
},
2756 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2757 { "View PIC info", dbg_pic
},
2759 #ifdef ROCKBOX_HAS_LOGF
2760 {"Show Log File", logfdisplay
},
2761 {"Dump Log File", logfdump
},
2763 #if defined(HAVE_USBSTACK)
2764 #if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
2765 {"USB Serial driver (logf)", toggle_usb_serial
},
2767 #endif /* HAVE_USBSTACK */
2768 #ifdef CPU_BOOST_LOGGING
2769 {"cpu_boost log",cpu_boost_log
},
2771 #if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
2772 && !defined(IPOD_MINI) && !defined(SIMULATOR))
2773 {"Debug scrollwheel", dbg_scrollwheel
},
2776 static int menu_action_callback(int btn
, struct gui_synclist
*lists
)
2779 if (btn
== ACTION_STD_OK
)
2782 viewportmanager_theme_enable(i
, false, NULL
);
2783 menuitems
[gui_synclist_get_sel_pos(lists
)].function();
2784 btn
= ACTION_REDRAW
;
2786 viewportmanager_theme_undo(i
, false);
2791 static const char* dbg_menu_getname(int item
, void * data
,
2792 char *buffer
, size_t buffer_len
)
2794 (void)data
; (void)buffer
; (void)buffer_len
;
2795 return menuitems
[item
].desc
;
2798 bool debug_menu(void)
2800 struct simplelist_info info
;
2802 simplelist_info_init(&info
, "Debug Menu", ARRAYLEN(menuitems
), NULL
);
2803 info
.action_callback
= menu_action_callback
;
2804 info
.get_name
= dbg_menu_getname
;
2805 return simplelist_show_list(&info
);