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"
104 #if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 \
105 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525
106 #include "debug-target.h"
109 #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
114 #if defined(HAVE_USBSTACK)
115 #include "usb_core.h"
118 #include "usbstack/usb_storage.h"
121 /*---------------------------------------------------*/
122 /* SPECIAL DEBUG STUFF */
123 /*---------------------------------------------------*/
124 extern struct thread_entry threads
[MAXTHREADS
];
126 static char thread_status_char(unsigned status
)
128 static const char thread_status_chars
[THREAD_NUM_STATES
+1] =
130 [0 ... THREAD_NUM_STATES
] = '?',
131 [STATE_RUNNING
] = 'R',
132 [STATE_BLOCKED
] = 'B',
133 [STATE_SLEEPING
] = 'S',
134 [STATE_BLOCKED_W_TMO
] = 'T',
135 [STATE_FROZEN
] = 'F',
136 [STATE_KILLED
] = 'K',
139 if (status
> THREAD_NUM_STATES
)
140 status
= THREAD_NUM_STATES
;
142 return thread_status_chars
[status
];
145 static char* threads_getname(int selected_item
, void *data
,
146 char *buffer
, size_t buffer_len
)
149 struct thread_entry
*thread
;
153 if (selected_item
< (int)NUM_CORES
)
155 snprintf(buffer
, buffer_len
, "Idle (%d): %2d%%", selected_item
,
156 idle_stack_usage(selected_item
));
160 selected_item
-= NUM_CORES
;
163 thread
= &threads
[selected_item
];
165 if (thread
->state
== STATE_KILLED
)
167 snprintf(buffer
, buffer_len
, "%2d: ---", selected_item
);
171 thread_get_name(name
, 32, thread
);
173 snprintf(buffer
, buffer_len
,
174 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s",
176 IF_COP(thread
->core
,)
177 #ifdef HAVE_SCHEDULER_BOOSTCTRL
178 (thread
->cpu_boost
) ? '+' :
180 ((thread
->state
== STATE_RUNNING
) ? '*' : ' '),
181 thread_status_char(thread
->state
),
182 IF_PRIO(thread
->base_priority
, thread
->priority
, )
183 thread_stack_usage(thread
), name
);
187 static int dbg_threads_action_callback(int action
, struct gui_synclist
*lists
)
190 #ifdef ROCKBOX_HAS_LOGF
191 if (action
== ACTION_STD_OK
)
193 int selpos
= gui_synclist_get_sel_pos(lists
);
195 if (selpos
>= NUM_CORES
)
196 remove_thread(&threads
[selpos
- NUM_CORES
]);
198 remove_thread(&threads
[selpos
]);
200 return ACTION_REDRAW
;
202 #endif /* ROCKBOX_HAS_LOGF */
203 if (action
== ACTION_NONE
)
204 action
= ACTION_REDRAW
;
208 static bool dbg_os(void)
210 struct simplelist_info info
;
211 simplelist_info_init(&info
, IF_COP("Core and ") "Stack usage:",
215 MAXTHREADS
+NUM_CORES
,
218 #ifndef ROCKBOX_HAS_LOGF
219 info
.hide_selection
= true;
220 info
.scroll_all
= true;
222 info
.action_callback
= dbg_threads_action_callback
;
223 info
.get_name
= threads_getname
;
224 return simplelist_show_list(&info
);
227 #ifdef HAVE_LCD_BITMAP
228 #if CONFIG_CODEC != SWCODEC
230 static bool dbg_audio_thread(void)
233 struct audio_debug d
;
235 lcd_setfont(FONT_SYSFIXED
);
239 if (action_userabort(HZ
/5))
242 audio_get_debugdata(&d
);
246 snprintf(buf
, sizeof(buf
), "read: %x", d
.audiobuf_read
);
248 snprintf(buf
, sizeof(buf
), "write: %x", d
.audiobuf_write
);
250 snprintf(buf
, sizeof(buf
), "swap: %x", d
.audiobuf_swapwrite
);
252 snprintf(buf
, sizeof(buf
), "playing: %d", d
.playing
);
254 snprintf(buf
, sizeof(buf
), "playable: %x", d
.playable_space
);
256 snprintf(buf
, sizeof(buf
), "unswapped: %x", d
.unswapped_space
);
259 /* Playable space left */
260 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8, 112, 4, d
.audiobuflen
, 0,
261 d
.playable_space
, HORIZONTAL
);
263 /* Show the watermark limit */
264 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8+4, 112, 4, d
.audiobuflen
, 0,
265 d
.low_watermark_level
, HORIZONTAL
);
267 snprintf(buf
, sizeof(buf
), "wm: %x - %x",
268 d
.low_watermark_level
, d
.lowest_watermark_level
);
273 lcd_setfont(FONT_UI
);
276 #endif /* !SIMULATOR */
277 #else /* CONFIG_CODEC == SWCODEC */
278 extern size_t filebuflen
;
279 /* This is a size_t, but call it a long so it puts a - when it's bad. */
281 static unsigned int ticks
, boost_ticks
, freq_sum
;
283 static void dbg_audio_task(void)
286 if(FREQ
> CPUFREQ_NORMAL
)
288 freq_sum
+= FREQ
/1000000; /* in MHz */
293 static bool dbg_buffering_thread(void)
300 size_t bufsize
= pcmbuf_get_bufsize();
301 int pcmbufdescs
= pcmbuf_descs();
302 struct buffering_debug d
;
304 ticks
= boost_ticks
= freq_sum
= 0;
306 tick_add_task(dbg_audio_task
);
308 lcd_setfont(FONT_SYSFIXED
);
311 button
= get_action(CONTEXT_STD
,HZ
/5);
314 case ACTION_STD_NEXT
:
317 case ACTION_STD_PREV
:
320 case ACTION_STD_CANCEL
:
325 buffering_get_debugdata(&d
);
330 bufused
= bufsize
- pcmbuf_free();
332 snprintf(buf
, sizeof(buf
), "pcm: %6ld/%ld", (long) bufused
, (long) bufsize
);
333 lcd_puts(0, line
++, buf
);
335 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
336 bufsize
, 0, bufused
, HORIZONTAL
);
339 snprintf(buf
, sizeof(buf
), "alloc: %6ld/%ld", audio_filebufused(),
341 lcd_puts(0, line
++, buf
);
344 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
345 filebuflen
, 0, audio_filebufused(), HORIZONTAL
);
348 snprintf(buf
, sizeof(buf
), "real: %6ld/%ld", (long)d
.buffered_data
,
350 lcd_puts(0, line
++, buf
);
352 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
353 filebuflen
, 0, (long)d
.buffered_data
, HORIZONTAL
);
357 snprintf(buf
, sizeof(buf
), "usefl: %6ld/%ld", (long)(d
.useful_data
),
359 lcd_puts(0, line
++, buf
);
362 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
363 filebuflen
, 0, d
.useful_data
, HORIZONTAL
);
367 snprintf(buf
, sizeof(buf
), "data_rem: %ld", (long)d
.data_rem
);
368 lcd_puts(0, line
++, buf
);
370 snprintf(buf
, sizeof(buf
), "track count: %2d", audio_track_count());
371 lcd_puts(0, line
++, buf
);
373 snprintf(buf
, sizeof(buf
), "handle count: %d", (int)d
.num_handles
);
374 lcd_puts(0, line
++, buf
);
377 snprintf(buf
, sizeof(buf
), "cpu freq: %3dMHz",
378 (int)((FREQ
+ 500000) / 1000000));
379 lcd_puts(0, line
++, buf
);
384 int boostquota
= boost_ticks
* 1000 / ticks
; /* in 0.1 % */
385 int avgclock
= freq_sum
* 10 / ticks
; /* in 100 kHz */
386 snprintf(buf
, sizeof(buf
), "boost:%3d.%d%% (%d.%dMHz)",
387 boostquota
/10, boostquota
%10, avgclock
/10, avgclock
%10);
388 lcd_puts(0, line
++, buf
);
391 snprintf(buf
, sizeof(buf
), "pcmbufdesc: %2d/%2d",
392 pcmbuf_used_descs(), pcmbufdescs
);
393 lcd_puts(0, line
++, buf
);
398 tick_remove_task(dbg_audio_task
);
399 lcd_setfont(FONT_UI
);
403 #endif /* CONFIG_CODEC */
404 #endif /* HAVE_LCD_BITMAP */
407 #if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE))
408 /* Tool function to read the flash manufacturer and type, if available.
409 Only chips which could be reprogrammed in system will return values.
410 (The mode switch addresses vary between flash manufacturers, hence addr1/2) */
411 /* In IRAM to avoid problems when running directly from Flash */
412 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
413 unsigned addr1
, unsigned addr2
)
414 ICODE_ATTR
__attribute__((noinline
));
415 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
416 unsigned addr1
, unsigned addr2
)
419 unsigned not_manu
, not_id
; /* read values before switching to ID mode */
420 unsigned manu
, id
; /* read values when in ID mode */
422 #if CONFIG_CPU == SH7034
423 volatile unsigned char* flash
= (unsigned char*)0x2000000; /* flash mapping */
424 #elif defined(CPU_COLDFIRE)
425 volatile unsigned short* flash
= (unsigned short*)0; /* flash mapping */
427 int old_level
; /* saved interrupt level */
429 not_manu
= flash
[0]; /* read the normal content */
430 not_id
= flash
[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */
432 /* disable interrupts, prevent any stray flash access */
433 old_level
= disable_irq_save();
435 flash
[addr1
] = 0xAA; /* enter command mode */
437 flash
[addr1
] = 0x90; /* ID command */
438 /* Atmel wants 20ms pause here */
439 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
441 manu
= flash
[0]; /* read the IDs */
444 flash
[0] = 0xF0; /* reset flash (back to normal read mode) */
445 /* Atmel wants 20ms pause here */
446 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
448 restore_irq(old_level
); /* enable interrupts again */
450 /* I assume success if the obtained values are different from
451 the normal flash content. This is not perfectly bulletproof, they
452 could theoretically be the same by chance, causing us to fail. */
453 if (not_manu
!= manu
|| not_id
!= id
) /* a value has changed */
455 *p_manufacturer
= manu
; /* return the results */
457 return true; /* success */
459 return false; /* fail */
461 #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
465 static int perfcheck(void)
471 "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */
474 "ldr r0, [%[timr]] \n"
475 "add r0, r0, %[tmo] \n"
477 "add %[res], %[res], #1 \n"
478 "ldr r1, [%[timr]] \n"
481 "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */
485 [timr
]"r"(&USEC_TIMER
),
487 #if CONFIG_CPU == PP5002
489 #else /* PP5020/5022/5024 */
500 #ifdef HAVE_LCD_BITMAP
501 static bool dbg_hw_info(void)
503 #if CONFIG_CPU == SH7034
505 int bitmask
= HW_MASK
;
506 int rom_version
= ROM_VERSION
;
507 unsigned manu
, id
; /* flash IDs */
508 bool got_id
; /* flag if we managed to get the flash IDs */
509 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
510 bool has_bootrom
; /* flag for boot ROM present */
511 int oldmode
; /* saved memory guard mode */
513 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
515 /* get flash ROM type */
516 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
518 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
520 /* check if the boot ROM area is a flash mirror */
521 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
522 if (has_bootrom
) /* if ROM and Flash different */
524 /* calculate CRC16 checksum of boot ROM */
525 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
528 system_memory_guard(oldmode
); /* re-enable memory guard */
530 lcd_setfont(FONT_SYSFIXED
);
533 lcd_puts(0, 0, "[Hardware info]");
535 snprintf(buf
, 32, "ROM: %d.%02d", rom_version
/100, rom_version
%100);
538 snprintf(buf
, 32, "Mask: 0x%04x", bitmask
);
542 snprintf(buf
, 32, "Flash: M=%02x D=%02x", manu
, id
);
544 snprintf(buf
, 32, "Flash: M=?? D=??"); /* unknown, sorry */
549 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
550 snprintf(buf
, 32, "Boot ROM: V1");
552 snprintf(buf
, 32, "ROMcrc: 0x%08x", rom_crc
);
556 snprintf(buf
, 32, "Boot ROM: none");
562 while (!(action_userabort(TIMEOUT_BLOCK
)));
564 #elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
566 unsigned manu
, id
; /* flash IDs */
567 int got_id
; /* flag if we managed to get the flash IDs */
568 int oldmode
; /* saved memory guard mode */
571 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
573 /* get flash ROM type */
574 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
576 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
578 system_memory_guard(oldmode
); /* re-enable memory guard */
580 lcd_setfont(FONT_SYSFIXED
);
583 lcd_puts(0, line
++, "[Hardware info]");
586 snprintf(buf
, 32, "Flash: M=%04x D=%04x", manu
, id
);
588 snprintf(buf
, 32, "Flash: M=???? D=????"); /* unknown, sorry */
589 lcd_puts(0, line
++, buf
);
595 lcd_puts(0, ++line
, "Serial Number:");
597 got_id
= ds2411_read_id(&id
);
599 if (got_id
== DS2411_OK
)
601 snprintf(buf
, 32, " FC=%02x", (unsigned)id
.family_code
);
602 lcd_puts(0, ++line
, buf
);
603 snprintf(buf
, 32, " ID=%02X %02X %02X %02X %02X %02X",
604 (unsigned)id
.uid
[0], (unsigned)id
.uid
[1], (unsigned)id
.uid
[2],
605 (unsigned)id
.uid
[3], (unsigned)id
.uid
[4], (unsigned)id
.uid
[5]);
606 lcd_puts(0, ++line
, buf
);
607 snprintf(buf
, 32, " CRC=%02X", (unsigned)id
.crc
);
611 snprintf(buf
, 32, "READ ERR=%d", got_id
);
614 lcd_puts(0, ++line
, buf
);
620 while (!(action_userabort(TIMEOUT_BLOCK
)));
622 #elif defined(CPU_PP502x)
625 char pp_version
[] = { (PP_VER2
>> 24) & 0xff, (PP_VER2
>> 16) & 0xff,
626 (PP_VER2
>> 8) & 0xff, (PP_VER2
) & 0xff,
627 (PP_VER1
>> 24) & 0xff, (PP_VER1
>> 16) & 0xff,
628 (PP_VER1
>> 8) & 0xff, (PP_VER1
) & 0xff, '\0' };
630 lcd_setfont(FONT_SYSFIXED
);
633 lcd_puts(0, line
++, "[Hardware info]");
636 snprintf(buf
, sizeof(buf
), "HW rev: 0x%08lx", IPOD_HW_REVISION
);
637 lcd_puts(0, line
++, buf
);
641 extern int lcd_type
; /* Defined in lcd-colornano.c */
643 snprintf(buf
, sizeof(buf
), "LCD type: %d", lcd_type
);
644 lcd_puts(0, line
++, buf
);
647 snprintf(buf
, sizeof(buf
), "PP version: %s", pp_version
);
648 lcd_puts(0, line
++, buf
);
650 snprintf(buf
, sizeof(buf
), "Est. clock (kHz): %d", perfcheck());
651 lcd_puts(0, line
++, buf
);
655 while (!(action_userabort(TIMEOUT_BLOCK
)));
657 #elif CONFIG_CPU == PP5002
660 char pp_version
[] = { (PP_VER4
>> 8) & 0xff, PP_VER4
& 0xff,
661 (PP_VER3
>> 8) & 0xff, PP_VER3
& 0xff,
662 (PP_VER2
>> 8) & 0xff, PP_VER2
& 0xff,
663 (PP_VER1
>> 8) & 0xff, PP_VER1
& 0xff, '\0' };
666 lcd_setfont(FONT_SYSFIXED
);
669 lcd_puts(0, line
++, "[Hardware info]");
672 snprintf(buf
, sizeof(buf
), "HW rev: 0x%08lx", IPOD_HW_REVISION
);
673 lcd_puts(0, line
++, buf
);
676 snprintf(buf
, sizeof(buf
), "PP version: %s", pp_version
);
677 lcd_puts(0, line
++, buf
);
679 snprintf(buf
, sizeof(buf
), "Est. clock (kHz): %d", perfcheck());
680 lcd_puts(0, line
++, buf
);
684 while (!(action_userabort(TIMEOUT_BLOCK
)));
687 /* Define this function in your target tree */
688 return __dbg_hw_info();
689 #endif /* CONFIG_CPU */
690 lcd_setfont(FONT_UI
);
693 #else /* !HAVE_LCD_BITMAP */
694 static bool dbg_hw_info(void)
699 int rom_version
= ROM_VERSION
;
700 unsigned manu
, id
; /* flash IDs */
701 bool got_id
; /* flag if we managed to get the flash IDs */
702 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
703 bool has_bootrom
; /* flag for boot ROM present */
704 int oldmode
; /* saved memory guard mode */
706 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
708 /* get flash ROM type */
709 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
711 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
713 /* check if the boot ROM area is a flash mirror */
714 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
715 if (has_bootrom
) /* if ROM and Flash different */
717 /* calculate CRC16 checksum of boot ROM */
718 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
721 system_memory_guard(oldmode
); /* re-enable memory guard */
725 lcd_puts(0, 0, "[HW Info]");
731 snprintf(buf
, 32, "ROM: %d.%02d",
732 rom_version
/100, rom_version
%100);
736 snprintf(buf
, 32, "Flash:%02x,%02x", manu
, id
);
738 snprintf(buf
, 32, "Flash:??,??"); /* unknown, sorry */
743 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
744 snprintf(buf
, 32, "BootROM: V1");
745 else if (rom_crc
== 0x358099E8)
746 snprintf(buf
, 32, "BootROM: V2");
747 /* alternative boot ROM found in one single player so far */
749 snprintf(buf
, 32, "R: %08x", rom_crc
);
752 snprintf(buf
, 32, "BootROM: no");
758 button
= get_action(CONTEXT_SETTINGS
,TIMEOUT_BLOCK
);
762 case ACTION_STD_CANCEL
:
765 case ACTION_SETTINGS_DEC
:
771 case ACTION_SETTINGS_INC
:
780 #endif /* !HAVE_LCD_BITMAP */
781 #endif /* !SIMULATOR */
784 static char* dbg_partitions_getname(int selected_item
, void *data
,
785 char *buffer
, size_t buffer_len
)
788 int partition
= selected_item
/2;
789 struct partinfo
* p
= disk_partinfo(partition
);
792 snprintf(buffer
, buffer_len
, " T:%x %ld MB", p
->type
, p
->size
/ 2048);
796 snprintf(buffer
, buffer_len
, "P%d: S:%lx", partition
, p
->start
);
801 bool dbg_partitions(void)
803 struct simplelist_info info
;
804 simplelist_info_init(&info
, "Partition Info", 4, NULL
);
805 info
.selection_size
= 2;
806 info
.hide_selection
= true;
807 info
.scroll_all
= true;
808 info
.get_name
= dbg_partitions_getname
;
809 return simplelist_show_list(&info
);
813 #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
814 static bool dbg_spdif(void)
818 unsigned int control
;
823 unsigned int interruptstat
;
824 bool valnogood
, symbolerr
, parityerr
;
827 int spdif_source
= spdif_get_output_source(&spdif_src_on
);
828 spdif_set_output_source(AUDIO_SRC_SPDIF
IF_SPDIF_POWER_(, true));
831 lcd_setfont(FONT_SYSFIXED
);
833 #ifdef HAVE_SPDIF_POWER
834 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
841 control
= EBU1RCVCCHANNEL1
;
842 interruptstat
= INTERRUPTSTAT
;
843 INTERRUPTCLEAR
= 0x03c00000;
845 valnogood
= (interruptstat
& 0x01000000)?true:false;
846 symbolerr
= (interruptstat
& 0x00800000)?true:false;
847 parityerr
= (interruptstat
& 0x00400000)?true:false;
849 snprintf(buf
, sizeof(buf
), "Val: %s Sym: %s Par: %s",
852 parityerr
?"--":"OK");
853 lcd_puts(0, line
++, buf
);
855 snprintf(buf
, sizeof(buf
), "Status word: %08x", (int)control
);
856 lcd_puts(0, line
++, buf
);
861 snprintf(buf
, sizeof(buf
), "PRO: %d (%s)",
862 x
, x
?"Professional":"Consumer");
863 lcd_puts(0, line
++, buf
);
865 x
= (control
>> 30) & 1;
866 snprintf(buf
, sizeof(buf
), "Audio: %d (%s)",
867 x
, x
?"Non-PCM":"PCM");
868 lcd_puts(0, line
++, buf
);
870 x
= (control
>> 29) & 1;
871 snprintf(buf
, sizeof(buf
), "Copy: %d (%s)",
872 x
, x
?"Permitted":"Inhibited");
873 lcd_puts(0, line
++, buf
);
875 x
= (control
>> 27) & 7;
888 snprintf(buf
, sizeof(buf
), "Preemphasis: %d (%s)", x
, s
);
889 lcd_puts(0, line
++, buf
);
891 x
= (control
>> 24) & 3;
892 snprintf(buf
, sizeof(buf
), "Mode: %d", x
);
893 lcd_puts(0, line
++, buf
);
895 category
= (control
>> 17) & 127;
907 snprintf(buf
, sizeof(buf
), "Category: 0x%02x (%s)", category
, s
);
908 lcd_puts(0, line
++, buf
);
910 x
= (control
>> 16) & 1;
912 if(((category
& 0x70) == 0x10) ||
913 ((category
& 0x70) == 0x40) ||
914 ((category
& 0x78) == 0x38))
916 generation
= !generation
;
918 snprintf(buf
, sizeof(buf
), "Generation: %d (%s)",
919 x
, generation
?"Original":"No ind.");
920 lcd_puts(0, line
++, buf
);
922 x
= (control
>> 12) & 15;
923 snprintf(buf
, sizeof(buf
), "Source: %d", x
);
924 lcd_puts(0, line
++, buf
);
926 x
= (control
>> 8) & 15;
942 snprintf(buf
, sizeof(buf
), "Channel: %d (%s)", x
, s
);
943 lcd_puts(0, line
++, buf
);
945 x
= (control
>> 4) & 15;
958 snprintf(buf
, sizeof(buf
), "Frequency: %d (%s)", x
, s
);
959 lcd_puts(0, line
++, buf
);
961 x
= (control
>> 2) & 3;
962 snprintf(buf
, sizeof(buf
), "Clock accuracy: %d", x
);
963 lcd_puts(0, line
++, buf
);
967 snprintf(buf
, sizeof(buf
), "Measured freq: %ldHz",
968 spdif_measure_frequency());
969 lcd_puts(0, line
++, buf
);
974 if (action_userabort(HZ
/10))
978 spdif_set_output_source(spdif_source
IF_SPDIF_POWER_(, spdif_src_on
));
980 #ifdef HAVE_SPDIF_POWER
981 spdif_power_enable(global_settings
.spdif_enable
);
984 lcd_setfont(FONT_UI
);
987 #endif /* CPU_COLDFIRE */
990 #ifdef HAVE_LCD_BITMAP
991 /* button definitions */
992 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
993 (CONFIG_KEYPAD == IRIVER_H300_PAD)
994 # define DEBUG_CANCEL BUTTON_OFF
996 #elif CONFIG_KEYPAD == RECORDER_PAD
997 # define DEBUG_CANCEL BUTTON_OFF
999 #elif CONFIG_KEYPAD == ONDIO_PAD
1000 # define DEBUG_CANCEL BUTTON_MENU
1002 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
1003 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
1004 (CONFIG_KEYPAD == IPOD_4G_PAD)
1005 # define DEBUG_CANCEL BUTTON_MENU
1007 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
1008 # define DEBUG_CANCEL BUTTON_PLAY
1010 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
1011 # define DEBUG_CANCEL BUTTON_REC
1013 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
1014 # define DEBUG_CANCEL BUTTON_RC_REC
1016 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
1017 # define DEBUG_CANCEL BUTTON_REW
1019 #elif (CONFIG_KEYPAD == MROBE100_PAD)
1020 # define DEBUG_CANCEL BUTTON_MENU
1022 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
1023 (CONFIG_KEYPAD == SANSA_C200_PAD)
1024 # define DEBUG_CANCEL BUTTON_LEFT
1026 /* This is temporary until the SA9200 touchpad works */
1027 #elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
1028 (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
1029 # define DEBUG_CANCEL BUTTON_POWER
1031 #endif /* key definitions */
1034 bool dbg_ports(void)
1036 #if CONFIG_CPU == SH7034
1038 int adc_battery_voltage
, adc_battery_level
;
1040 lcd_setfont(FONT_SYSFIXED
);
1041 lcd_clear_display();
1045 snprintf(buf
, 32, "PADR: %04x", (unsigned short)PADR
);
1046 lcd_puts(0, 0, buf
);
1047 snprintf(buf
, 32, "PBDR: %04x", (unsigned short)PBDR
);
1048 lcd_puts(0, 1, buf
);
1050 snprintf(buf
, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
1051 lcd_puts(0, 2, buf
);
1052 snprintf(buf
, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
1053 lcd_puts(0, 3, buf
);
1054 snprintf(buf
, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
1055 lcd_puts(0, 4, buf
);
1056 snprintf(buf
, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
1057 lcd_puts(0, 5, buf
);
1059 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1060 snprintf(buf
, 32, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1061 adc_battery_voltage
% 1000, adc_battery_level
);
1062 lcd_puts(0, 6, buf
);
1065 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1067 lcd_setfont(FONT_UI
);
1071 #elif defined(CPU_COLDFIRE)
1072 unsigned int gpio_out
;
1073 unsigned int gpio1_out
;
1074 unsigned int gpio_read
;
1075 unsigned int gpio1_read
;
1076 unsigned int gpio_function
;
1077 unsigned int gpio1_function
;
1078 unsigned int gpio_enable
;
1079 unsigned int gpio1_enable
;
1080 int adc_buttons
, adc_remote
;
1081 int adc_battery_voltage
, adc_battery_level
;
1085 lcd_clear_display();
1086 lcd_setfont(FONT_SYSFIXED
);
1091 gpio_read
= GPIO_READ
;
1092 gpio1_read
= GPIO1_READ
;
1093 gpio_out
= GPIO_OUT
;
1094 gpio1_out
= GPIO1_OUT
;
1095 gpio_function
= GPIO_FUNCTION
;
1096 gpio1_function
= GPIO1_FUNCTION
;
1097 gpio_enable
= GPIO_ENABLE
;
1098 gpio1_enable
= GPIO1_ENABLE
;
1100 snprintf(buf
, sizeof(buf
), "GPIO_READ: %08x", gpio_read
);
1101 lcd_puts(0, line
++, buf
);
1102 snprintf(buf
, sizeof(buf
), "GPIO_OUT: %08x", gpio_out
);
1103 lcd_puts(0, line
++, buf
);
1104 snprintf(buf
, sizeof(buf
), "GPIO_FUNC: %08x", gpio_function
);
1105 lcd_puts(0, line
++, buf
);
1106 snprintf(buf
, sizeof(buf
), "GPIO_ENA: %08x", gpio_enable
);
1107 lcd_puts(0, line
++, buf
);
1109 snprintf(buf
, sizeof(buf
), "GPIO1_READ: %08x", gpio1_read
);
1110 lcd_puts(0, line
++, buf
);
1111 snprintf(buf
, sizeof(buf
), "GPIO1_OUT: %08x", gpio1_out
);
1112 lcd_puts(0, line
++, buf
);
1113 snprintf(buf
, sizeof(buf
), "GPIO1_FUNC: %08x", gpio1_function
);
1114 lcd_puts(0, line
++, buf
);
1115 snprintf(buf
, sizeof(buf
), "GPIO1_ENA: %08x", gpio1_enable
);
1116 lcd_puts(0, line
++, buf
);
1118 adc_buttons
= adc_read(ADC_BUTTONS
);
1119 adc_remote
= adc_read(ADC_REMOTE
);
1120 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1121 #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
1122 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS (%c): %02x",
1123 button_scan_enabled() ? '+' : '-', adc_buttons
);
1125 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS: %02x", adc_buttons
);
1127 lcd_puts(0, line
++, buf
);
1128 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
1129 snprintf(buf
, sizeof(buf
), "ADC_REMOTE (%c): %02x",
1130 remote_detect() ? '+' : '-', adc_remote
);
1132 snprintf(buf
, sizeof(buf
), "ADC_REMOTE: %02x", adc_remote
);
1134 lcd_puts(0, line
++, buf
);
1135 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1136 snprintf(buf
, sizeof(buf
), "ADC_REMOTEDETECT: %02x",
1137 adc_read(ADC_REMOTEDETECT
));
1138 lcd_puts(0, line
++, buf
);
1141 snprintf(buf
, 32, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1142 adc_battery_voltage
% 1000, adc_battery_level
);
1143 lcd_puts(0, line
++, buf
);
1145 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1146 snprintf(buf
, sizeof(buf
), "remotetype: %d", remote_type());
1147 lcd_puts(0, line
++, buf
);
1151 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1153 lcd_setfont(FONT_UI
);
1158 #elif defined(CPU_PP502x)
1163 lcd_clear_display();
1164 lcd_setfont(FONT_SYSFIXED
);
1169 lcd_puts(0, line
++, "GPIO STATES:");
1170 snprintf(buf
, sizeof(buf
), "A: %02x E: %02x I: %02x",
1171 (unsigned int)GPIOA_INPUT_VAL
,
1172 (unsigned int)GPIOE_INPUT_VAL
,
1173 (unsigned int)GPIOI_INPUT_VAL
);
1174 lcd_puts(0, line
++, buf
);
1175 snprintf(buf
, sizeof(buf
), "B: %02x F: %02x J: %02x",
1176 (unsigned int)GPIOB_INPUT_VAL
,
1177 (unsigned int)GPIOF_INPUT_VAL
,
1178 (unsigned int)GPIOJ_INPUT_VAL
);
1179 lcd_puts(0, line
++, buf
);
1180 snprintf(buf
, sizeof(buf
), "C: %02x G: %02x K: %02x",
1181 (unsigned int)GPIOC_INPUT_VAL
,
1182 (unsigned int)GPIOG_INPUT_VAL
,
1183 (unsigned int)GPIOK_INPUT_VAL
);
1184 lcd_puts(0, line
++, buf
);
1185 snprintf(buf
, sizeof(buf
), "D: %02x H: %02x L: %02x",
1186 (unsigned int)GPIOD_INPUT_VAL
,
1187 (unsigned int)GPIOH_INPUT_VAL
,
1188 (unsigned int)GPIOL_INPUT_VAL
);
1189 lcd_puts(0, line
++, buf
);
1191 snprintf(buf
, sizeof(buf
), "GPO32_VAL: %08lx", GPO32_VAL
);
1192 lcd_puts(0, line
++, buf
);
1193 snprintf(buf
, sizeof(buf
), "GPO32_EN: %08lx", GPO32_ENABLE
);
1194 lcd_puts(0, line
++, buf
);
1195 snprintf(buf
, sizeof(buf
), "DEV_EN: %08lx", DEV_EN
);
1196 lcd_puts(0, line
++, buf
);
1197 snprintf(buf
, sizeof(buf
), "DEV_EN2: %08lx", DEV_EN2
);
1198 lcd_puts(0, line
++, buf
);
1199 snprintf(buf
, sizeof(buf
), "DEV_EN3: %08lx", inl(0x60006044));
1200 lcd_puts(0, line
++, buf
); /* to be verified */
1201 snprintf(buf
, sizeof(buf
), "DEV_INIT1: %08lx", DEV_INIT1
);
1202 lcd_puts(0, line
++, buf
);
1203 snprintf(buf
, sizeof(buf
), "DEV_INIT2: %08lx", DEV_INIT2
);
1204 lcd_puts(0, line
++, buf
);
1205 #ifdef ADC_ACCESSORY
1206 snprintf(buf
, sizeof(buf
), "ACCESSORY: %d", adc_read(ADC_ACCESSORY
));
1207 lcd_puts(0, line
++, buf
);
1210 #if defined(IPOD_ACCESSORY_PROTOCOL)
1211 extern unsigned char serbuf
[];
1212 snprintf(buf
, sizeof(buf
), "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
1213 serbuf
[0], serbuf
[1], serbuf
[2], serbuf
[3], serbuf
[4], serbuf
[5],
1214 serbuf
[6], serbuf
[7]);
1215 lcd_puts(0, line
++, buf
);
1218 #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1220 snprintf(buf
, sizeof(buf
), "BATT: %03x UNK1: %03x",
1221 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1222 lcd_puts(0, line
++, buf
);
1223 snprintf(buf
, sizeof(buf
), "REM: %03x PAD: %03x",
1224 adc_read(ADC_REMOTE
), adc_read(ADC_SCROLLPAD
));
1225 lcd_puts(0, line
++, buf
);
1226 #elif defined(PHILIPS_HDD1630)
1228 snprintf(buf
, sizeof(buf
), "BATT: %03x UNK1: %03x",
1229 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1230 lcd_puts(0, line
++, buf
);
1231 #elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
1232 snprintf(buf
, sizeof(buf
), "ADC_BVDD: %4d", adc_read(ADC_BVDD
));
1233 lcd_puts(0, line
++, buf
);
1234 snprintf(buf
, sizeof(buf
), "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP
));
1235 lcd_puts(0, line
++, buf
);
1236 snprintf(buf
, sizeof(buf
), "ADC_UVDD: %4d", adc_read(ADC_UVDD
));
1237 lcd_puts(0, line
++, buf
);
1238 snprintf(buf
, sizeof(buf
), "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN
));
1239 lcd_puts(0, line
++, buf
);
1240 snprintf(buf
, sizeof(buf
), "ADC_CVDD: %4d", adc_read(ADC_CVDD
));
1241 lcd_puts(0, line
++, buf
);
1242 snprintf(buf
, sizeof(buf
), "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP
));
1243 lcd_puts(0, line
++, buf
);
1244 snprintf(buf
, sizeof(buf
), "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1
));
1245 lcd_puts(0, line
++, buf
);
1246 snprintf(buf
, sizeof(buf
), "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2
));
1247 lcd_puts(0, line
++, buf
);
1248 snprintf(buf
, sizeof(buf
), "ADC_VBE1: %4d", adc_read(ADC_VBE1
));
1249 lcd_puts(0, line
++, buf
);
1250 snprintf(buf
, sizeof(buf
), "ADC_VBE2: %4d", adc_read(ADC_VBE2
));
1251 lcd_puts(0, line
++, buf
);
1252 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1
));
1253 lcd_puts(0, line
++, buf
);
1254 #if !defined(PHILIPS_SA9200)
1255 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2
));
1256 lcd_puts(0, line
++, buf
);
1257 snprintf(buf
, sizeof(buf
), "ADC_VBAT: %4d", adc_read(ADC_VBAT
));
1258 lcd_puts(0, line
++, buf
);
1262 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1264 lcd_setfont(FONT_UI
);
1269 #elif CONFIG_CPU == PP5002
1273 lcd_clear_display();
1274 lcd_setfont(FONT_SYSFIXED
);
1279 snprintf(buf
, sizeof(buf
), "GPIO_A: %02x GPIO_B: %02x",
1280 (unsigned int)GPIOA_INPUT_VAL
, (unsigned int)GPIOB_INPUT_VAL
);
1281 lcd_puts(0, line
++, buf
);
1282 snprintf(buf
, sizeof(buf
), "GPIO_C: %02x GPIO_D: %02x",
1283 (unsigned int)GPIOC_INPUT_VAL
, (unsigned int)GPIOD_INPUT_VAL
);
1284 lcd_puts(0, line
++, buf
);
1286 snprintf(buf
, sizeof(buf
), "DEV_EN: %08lx", DEV_EN
);
1287 lcd_puts(0, line
++, buf
);
1288 snprintf(buf
, sizeof(buf
), "CLOCK_ENABLE: %08lx", CLOCK_ENABLE
);
1289 lcd_puts(0, line
++, buf
);
1290 snprintf(buf
, sizeof(buf
), "CLOCK_SOURCE: %08lx", CLOCK_SOURCE
);
1291 lcd_puts(0, line
++, buf
);
1292 snprintf(buf
, sizeof(buf
), "PLL_CONTROL: %08lx", PLL_CONTROL
);
1293 lcd_puts(0, line
++, buf
);
1294 snprintf(buf
, sizeof(buf
), "PLL_DIV: %08lx", PLL_DIV
);
1295 lcd_puts(0, line
++, buf
);
1296 snprintf(buf
, sizeof(buf
), "PLL_MULT: %08lx", PLL_MULT
);
1297 lcd_puts(0, line
++, buf
);
1298 snprintf(buf
, sizeof(buf
), "TIMING1_CTL: %08lx", TIMING1_CTL
);
1299 lcd_puts(0, line
++, buf
);
1300 snprintf(buf
, sizeof(buf
), "TIMING2_CTL: %08lx", TIMING2_CTL
);
1301 lcd_puts(0, line
++, buf
);
1304 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1306 lcd_setfont(FONT_UI
);
1310 lcd_setfont(FONT_UI
);
1312 return __dbg_ports();
1316 #else /* !HAVE_LCD_BITMAP */
1317 bool dbg_ports(void)
1321 int adc_battery_voltage
;
1324 lcd_clear_display();
1331 snprintf(buf
, 32, "PADR: %04x", (unsigned short)PADR
);
1334 snprintf(buf
, 32, "PBDR: %04x", (unsigned short)PBDR
);
1337 snprintf(buf
, 32, "AN0: %03x", adc_read(0));
1340 snprintf(buf
, 32, "AN1: %03x", adc_read(1));
1343 snprintf(buf
, 32, "AN2: %03x", adc_read(2));
1346 snprintf(buf
, 32, "AN3: %03x", adc_read(3));
1349 snprintf(buf
, 32, "AN4: %03x", adc_read(4));
1352 snprintf(buf
, 32, "AN5: %03x", adc_read(5));
1355 snprintf(buf
, 32, "AN6: %03x", adc_read(6));
1358 snprintf(buf
, 32, "AN7: %03x", adc_read(7));
1361 lcd_puts(0, 0, buf
);
1363 battery_read_info(&adc_battery_voltage
, NULL
);
1364 snprintf(buf
, 32, "Batt: %d.%03dV", adc_battery_voltage
/ 1000,
1365 adc_battery_voltage
% 1000);
1366 lcd_puts(0, 1, buf
);
1369 button
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1373 case ACTION_STD_CANCEL
:
1376 case ACTION_SETTINGS_DEC
:
1382 case ACTION_SETTINGS_INC
:
1391 #endif /* !HAVE_LCD_BITMAP */
1392 #endif /* !SIMULATOR */
1394 #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
1395 static bool dbg_pcf(void)
1400 #ifdef HAVE_LCD_BITMAP
1401 lcd_setfont(FONT_SYSFIXED
);
1403 lcd_clear_display();
1409 snprintf(buf
, sizeof(buf
), "DCDC1: %02x", pcf50605_read(0x1b));
1410 lcd_puts(0, line
++, buf
);
1411 snprintf(buf
, sizeof(buf
), "DCDC2: %02x", pcf50605_read(0x1c));
1412 lcd_puts(0, line
++, buf
);
1413 snprintf(buf
, sizeof(buf
), "DCDC3: %02x", pcf50605_read(0x1d));
1414 lcd_puts(0, line
++, buf
);
1415 snprintf(buf
, sizeof(buf
), "DCDC4: %02x", pcf50605_read(0x1e));
1416 lcd_puts(0, line
++, buf
);
1417 snprintf(buf
, sizeof(buf
), "DCDEC1: %02x", pcf50605_read(0x1f));
1418 lcd_puts(0, line
++, buf
);
1419 snprintf(buf
, sizeof(buf
), "DCDEC2: %02x", pcf50605_read(0x20));
1420 lcd_puts(0, line
++, buf
);
1421 snprintf(buf
, sizeof(buf
), "DCUDC1: %02x", pcf50605_read(0x21));
1422 lcd_puts(0, line
++, buf
);
1423 snprintf(buf
, sizeof(buf
), "DCUDC2: %02x", pcf50605_read(0x22));
1424 lcd_puts(0, line
++, buf
);
1425 snprintf(buf
, sizeof(buf
), "IOREGC: %02x", pcf50605_read(0x23));
1426 lcd_puts(0, line
++, buf
);
1427 snprintf(buf
, sizeof(buf
), "D1REGC: %02x", pcf50605_read(0x24));
1428 lcd_puts(0, line
++, buf
);
1429 snprintf(buf
, sizeof(buf
), "D2REGC: %02x", pcf50605_read(0x25));
1430 lcd_puts(0, line
++, buf
);
1431 snprintf(buf
, sizeof(buf
), "D3REGC: %02x", pcf50605_read(0x26));
1432 lcd_puts(0, line
++, buf
);
1433 snprintf(buf
, sizeof(buf
), "LPREG1: %02x", pcf50605_read(0x27));
1434 lcd_puts(0, line
++, buf
);
1437 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1439 lcd_setfont(FONT_UI
);
1444 lcd_setfont(FONT_UI
);
1449 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
1450 static bool dbg_cpufreq(void)
1456 #ifdef HAVE_LCD_BITMAP
1457 lcd_setfont(FONT_SYSFIXED
);
1459 lcd_clear_display();
1465 snprintf(buf
, sizeof(buf
), "Frequency: %ld", FREQ
);
1466 lcd_puts(0, line
++, buf
);
1468 snprintf(buf
, sizeof(buf
), "boost_counter: %d", get_cpu_boost_counter());
1469 lcd_puts(0, line
++, buf
);
1472 button
= get_action(CONTEXT_STD
,HZ
/10);
1476 case ACTION_STD_PREV
:
1480 case ACTION_STD_NEXT
:
1485 while (get_cpu_boost_counter() > 0)
1487 set_cpu_frequency(CPUFREQ_DEFAULT
);
1490 case ACTION_STD_CANCEL
:
1491 lcd_setfont(FONT_UI
);
1495 lcd_setfont(FONT_UI
);
1498 #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1500 #if defined(HAVE_TSC2100) && !defined(SIMULATOR)
1501 #include "tsc2100.h"
1502 static char *itob(int n
, int len
)
1504 static char binary
[64];
1506 for (i
=1, j
=0;i
<=len
;i
++)
1508 binary
[j
++] = n
&(1<<(len
-i
))?'1':'0';
1515 static char* tsc2100_debug_getname(int selected_item
, void * data
,
1516 char *buffer
, size_t buffer_len
)
1518 int *page
= (int*)data
;
1519 bool reserved
= false;
1523 if ((selected_item
> 0x0a) ||
1524 (selected_item
== 0x04) ||
1525 (selected_item
== 0x08))
1529 if ((selected_item
> 0x05) ||
1530 (selected_item
== 0x02))
1534 if (selected_item
> 0x1e)
1539 snprintf(buffer
, buffer_len
, "%02x: RESERVED", selected_item
);
1541 snprintf(buffer
, buffer_len
, "%02x: %s", selected_item
,
1542 itob(tsc2100_readreg(*page
, selected_item
)&0xffff,16));
1545 static int tsc2100debug_action_callback(int action
, struct gui_synclist
*lists
)
1547 int *page
= (int*)lists
->data
;
1548 if (action
== ACTION_STD_OK
)
1550 *page
= (*page
+1)%3;
1551 snprintf(lists
->title
, 32,
1552 "tsc2100 registers - Page %d", *page
);
1553 return ACTION_REDRAW
;
1557 static bool tsc2100_debug(void)
1560 char title
[32] = "tsc2100 registers - Page 0";
1561 struct simplelist_info info
;
1562 simplelist_info_init(&info
, title
, 32, &page
);
1563 info
.timeout
= HZ
/100;
1564 info
.get_name
= tsc2100_debug_getname
;
1565 info
.action_callback
= tsc2100debug_action_callback
;
1566 return simplelist_show_list(&info
);
1570 #ifdef HAVE_LCD_BITMAP
1572 * view_battery() shows a automatically scaled graph of the battery voltage
1573 * over time. Usable for estimating battery life / charging rate.
1574 * The power_history array is updated in power_thread of powermgmt.c.
1577 #define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
1578 #define BAT_YSPACE (LCD_HEIGHT - 20)
1580 static bool view_battery(void)
1584 unsigned short maxv
, minv
;
1587 lcd_setfont(FONT_SYSFIXED
);
1591 lcd_clear_display();
1593 case 0: /* voltage history graph */
1594 /* Find maximum and minimum voltage for scaling */
1595 minv
= power_history
[0];
1597 for (i
= 1; i
< BAT_LAST_VAL
&& power_history
[i
]; i
++) {
1598 if (power_history
[i
] > maxv
)
1599 maxv
= power_history
[i
];
1600 if (power_history
[i
] < minv
)
1601 minv
= power_history
[i
];
1604 snprintf(buf
, 30, "Battery %d.%03d", power_history
[0] / 1000,
1605 power_history
[0] % 1000);
1606 lcd_puts(0, 0, buf
);
1607 snprintf(buf
, 30, "scale %d.%03d-%d.%03dV",
1608 minv
/ 1000, minv
% 1000, maxv
/ 1000, maxv
% 1000);
1609 lcd_puts(0, 1, buf
);
1612 for (i
= BAT_LAST_VAL
- 1; i
>= 0; i
--) {
1613 y
= (power_history
[i
] - minv
) * BAT_YSPACE
/ (maxv
- minv
);
1614 lcd_set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
1615 lcd_vline(x
, LCD_HEIGHT
-1, 20);
1616 lcd_set_drawmode(DRMODE_SOLID
);
1617 lcd_vline(x
, LCD_HEIGHT
-1,
1618 MIN(MAX(LCD_HEIGHT
-1 - y
, 20), LCD_HEIGHT
-1));
1624 case 1: /* status: */
1625 lcd_puts(0, 0, "Power status:");
1627 battery_read_info(&y
, NULL
);
1628 snprintf(buf
, 30, "Battery: %d.%03d V", y
/ 1000, y
% 1000);
1629 lcd_puts(0, 1, buf
);
1630 #ifdef ADC_EXT_POWER
1631 y
= (adc_read(ADC_EXT_POWER
) * EXT_SCALE_FACTOR
) / 1000;
1632 snprintf(buf
, 30, "External: %d.%03d V", y
/ 1000, y
% 1000);
1633 lcd_puts(0, 2, buf
);
1636 #if defined ARCHOS_RECORDER
1637 snprintf(buf
, 30, "Chgr: %s %s",
1638 charger_inserted() ? "present" : "absent",
1639 charger_enabled() ? "on" : "off");
1640 lcd_puts(0, 3, buf
);
1641 snprintf(buf
, 30, "short delta: %d", short_delta
);
1642 lcd_puts(0, 5, buf
);
1643 snprintf(buf
, 30, "long delta: %d", long_delta
);
1644 lcd_puts(0, 6, buf
);
1645 lcd_puts(0, 7, power_message
);
1646 snprintf(buf
, 30, "USB Inserted: %s",
1647 usb_inserted() ? "yes" : "no");
1648 lcd_puts(0, 8, buf
);
1649 #elif defined IRIVER_H300_SERIES
1650 snprintf(buf
, 30, "USB Charging Enabled: %s",
1651 usb_charging_enabled() ? "yes" : "no");
1652 lcd_puts(0, 9, buf
);
1653 #elif defined IPOD_NANO || defined IPOD_VIDEO
1654 int usb_pwr
= (GPIOL_INPUT_VAL
& 0x10)?true:false;
1655 int ext_pwr
= (GPIOL_INPUT_VAL
& 0x08)?false:true;
1656 int dock
= (GPIOA_INPUT_VAL
& 0x10)?true:false;
1657 int charging
= (GPIOB_INPUT_VAL
& 0x01)?false:true;
1658 int headphone
= (GPIOA_INPUT_VAL
& 0x80)?true:false;
1660 snprintf(buf
, 30, "USB pwr: %s",
1661 usb_pwr
? "present" : "absent");
1662 lcd_puts(0, 3, buf
);
1663 snprintf(buf
, 30, "EXT pwr: %s",
1664 ext_pwr
? "present" : "absent");
1665 lcd_puts(0, 4, buf
);
1666 snprintf(buf
, 30, "Battery: %s",
1667 charging
? "charging" : (usb_pwr
||ext_pwr
) ? "charged" : "discharging");
1668 lcd_puts(0, 5, buf
);
1669 snprintf(buf
, 30, "Dock mode: %s",
1670 dock
? "enabled" : "disabled");
1671 lcd_puts(0, 6, buf
);
1672 snprintf(buf
, 30, "Headphone: %s",
1673 headphone
? "connected" : "disconnected");
1674 lcd_puts(0, 7, buf
);
1675 #elif defined TOSHIBA_GIGABEAT_S
1679 static const unsigned char * const chrgstate_strings
[] =
1690 snprintf(buf
, 30, "Charger: %s",
1691 charger_inserted() ? "present" : "absent");
1692 lcd_puts(0, line
++, buf
);
1694 st
= power_input_status() &
1695 (POWER_INPUT_CHARGER
| POWER_INPUT_BATTERY
);
1696 snprintf(buf
, 30, "%s%s",
1697 (st
& POWER_INPUT_MAIN_CHARGER
) ? " Main" : "",
1698 (st
& POWER_INPUT_USB_CHARGER
) ? " USB" : "");
1699 lcd_puts(0, line
++, buf
);
1701 snprintf(buf
, 30, "IUSB Max: %d", usb_allowed_current());
1702 lcd_puts(0, line
++, buf
);
1704 y
= ARRAYLEN(chrgstate_strings
) - 1;
1706 switch (charge_state
)
1708 case CHARGE_STATE_DISABLED
: y
--;
1709 case CHARGE_STATE_ERROR
: y
--;
1710 case DISCHARGING
: y
--;
1717 snprintf(buf
, 30, "State: %s", chrgstate_strings
[y
]);
1718 lcd_puts(0, line
++, buf
);
1720 snprintf(buf
, 30, "Battery Switch: %s",
1721 (st
& POWER_INPUT_BATTERY
) ? "On" : "Off");
1722 lcd_puts(0, line
++, buf
);
1724 y
= chrgraw_adc_voltage();
1725 snprintf(buf
, 30, "CHRGRAW: %d.%03d V",
1726 y
/ 1000, y
% 1000);
1727 lcd_puts(0, line
++, buf
);
1729 y
= application_supply_adc_voltage();
1730 snprintf(buf
, 30, "BP : %d.%03d V",
1731 y
/ 1000, y
% 1000);
1732 lcd_puts(0, line
++, buf
);
1734 y
= battery_adc_charge_current();
1735 if (y
< 0) x
= '-', y
= -y
;
1737 snprintf(buf
, 30, "CHRGISN:%c%d mA", x
, y
);
1738 lcd_puts(0, line
++, buf
);
1740 y
= cccv_regulator_dissipation();
1741 snprintf(buf
, 30, "P CCCV : %d mW", y
);
1742 lcd_puts(0, line
++, buf
);
1744 y
= battery_charge_current();
1745 if (y
< 0) x
= '-', y
= -y
;
1747 snprintf(buf
, 30, "I Charge:%c%d mA", x
, y
);
1748 lcd_puts(0, line
++, buf
);
1750 y
= battery_adc_temp();
1753 snprintf(buf
, 30, "T Battery: %dC (%dF)", y
,
1756 /* Conversion disabled */
1757 snprintf(buf
, 30, "T Battery: ?");
1760 lcd_puts(0, line
++, buf
);
1761 #elif defined(SANSA_E200) || defined(SANSA_C200)
1762 const int first
= CHARGE_STATE_DISABLED
;
1763 static const char * const chrgstate_strings
[] =
1765 [CHARGE_STATE_DISABLED
-first
] = "Disabled",
1766 [CHARGE_STATE_ERROR
-first
] = "Error",
1767 [DISCHARGING
-first
] = "Discharging",
1768 [CHARGING
-first
] = "Charging",
1770 const char *str
= NULL
;
1772 snprintf(buf
, 30, "Charger: %s",
1773 charger_inserted() ? "present" : "absent");
1774 lcd_puts(0, 3, buf
);
1776 y
= charge_state
- first
;
1777 if ((unsigned)y
< ARRAYLEN(chrgstate_strings
))
1778 str
= chrgstate_strings
[y
];
1780 snprintf(buf
, sizeof(buf
), "State: %s",
1781 str
? str
: "<unknown>");
1782 lcd_puts(0, 4, buf
);
1784 snprintf(buf
, sizeof(buf
), "CHARGER: %02X",
1785 ascodec_read(AS3514_CHARGER
));
1786 lcd_puts(0, 5, buf
);
1788 snprintf(buf
, 30, "Charger: %s",
1789 charger_inserted() ? "present" : "absent");
1790 lcd_puts(0, 3, buf
);
1791 #endif /* target type */
1792 #endif /* CONFIG_CHARGING */
1795 case 2: /* voltage deltas: */
1796 lcd_puts(0, 0, "Voltage deltas:");
1798 for (i
= 0; i
<= 6; i
++) {
1799 y
= power_history
[i
] - power_history
[i
+1];
1800 snprintf(buf
, 30, "-%d min: %s%d.%03d V", i
,
1801 (y
< 0) ? "-" : "", ((y
< 0) ? y
* -1 : y
) / 1000,
1802 ((y
< 0) ? y
* -1 : y
) % 1000);
1803 lcd_puts(0, i
+1, buf
);
1807 case 3: /* remaining time estimation: */
1809 #ifdef ARCHOS_RECORDER
1810 snprintf(buf
, 30, "charge_state: %d", charge_state
);
1811 lcd_puts(0, 0, buf
);
1813 snprintf(buf
, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min
);
1814 lcd_puts(0, 1, buf
);
1816 snprintf(buf
, 30, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level
);
1817 lcd_puts(0, 2, buf
);
1819 snprintf(buf
, 30, "P=%2d I=%2d", pid_p
, pid_i
);
1820 lcd_puts(0, 3, buf
);
1822 snprintf(buf
, 30, "Trickle sec: %d/60", trickle_sec
);
1823 lcd_puts(0, 4, buf
);
1824 #endif /* ARCHOS_RECORDER */
1826 snprintf(buf
, 30, "Last PwrHist: %d.%03dV",
1827 power_history
[0] / 1000,
1828 power_history
[0] % 1000);
1829 lcd_puts(0, 5, buf
);
1831 snprintf(buf
, 30, "battery level: %d%%", battery_level());
1832 lcd_puts(0, 6, buf
);
1834 snprintf(buf
, 30, "Est. remain: %d m", battery_time());
1835 lcd_puts(0, 7, buf
);
1841 switch(get_action(CONTEXT_STD
,HZ
/2))
1843 case ACTION_STD_PREV
:
1848 case ACTION_STD_NEXT
:
1853 case ACTION_STD_CANCEL
:
1854 lcd_setfont(FONT_UI
);
1858 lcd_setfont(FONT_UI
);
1862 #endif /* HAVE_LCD_BITMAP */
1866 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
1868 #if (CONFIG_STORAGE & STORAGE_MMC)
1869 #define CARDTYPE "MMC"
1870 #elif (CONFIG_STORAGE & STORAGE_SD)
1871 #define CARDTYPE "microSD"
1874 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1877 int *cardnum
= (int*)lists
->data
;
1878 unsigned char card_name
[7];
1879 unsigned char pbuf
[32];
1880 char *title
= lists
->title
;
1881 static const unsigned char i_vmin
[] = { 0, 1, 5, 10, 25, 35, 60, 100 };
1882 static const unsigned char i_vmax
[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
1883 static const unsigned char *kbit_units
[] = { "kBit/s", "MBit/s", "GBit/s" };
1884 static const unsigned char *nsec_units
[] = { "ns", "µs", "ms" };
1885 static const char *spec_vers
[] = { "1.0-1.2", "1.4", "2.0-2.2",
1886 "3.1-3.31", "4.0" };
1887 if ((btn
== ACTION_STD_OK
) || (btn
== SYS_FS_CHANGED
) || (btn
== ACTION_REDRAW
))
1890 if (btn
== ACTION_STD_OK
)
1892 *cardnum
^= 0x1; /* change cards */
1896 simplelist_set_line_count(0);
1898 card
= card_get_info(*cardnum
);
1900 if (card
->initialized
> 0)
1902 card_name
[6] = '\0';
1903 strncpy(card_name
, ((unsigned char*)card
->cid
) + 3, 6);
1904 simplelist_addline(SIMPLELIST_ADD_LINE
,
1905 "%s Rev %d.%d", card_name
,
1906 (int) card_extract_bits(card
->cid
, 72, 4),
1907 (int) card_extract_bits(card
->cid
, 76, 4));
1908 simplelist_addline(SIMPLELIST_ADD_LINE
,
1910 (int) card_extract_bits(card
->cid
, 112, 4),
1911 (int) card_extract_bits(card
->cid
, 116, 4) + 1997);
1912 simplelist_addline(SIMPLELIST_ADD_LINE
,
1914 card_extract_bits(card
->cid
, 80, 32));
1915 simplelist_addline(SIMPLELIST_ADD_LINE
,
1917 (int) card_extract_bits(card
->cid
, 0, 8),
1918 (int) card_extract_bits(card
->cid
, 8, 16));
1919 int temp
= card_extract_bits(card
->csd
, 2, 4);
1920 simplelist_addline(SIMPLELIST_ADD_LINE
,
1921 CARDTYPE
" v%s", temp
< 5 ?
1922 spec_vers
[temp
] : "?.?");
1923 simplelist_addline(SIMPLELIST_ADD_LINE
,
1924 "Blocks: 0x%08lx", card
->numblocks
);
1925 output_dyn_value(pbuf
, sizeof pbuf
, card
->speed
/ 1000,
1927 simplelist_addline(SIMPLELIST_ADD_LINE
,
1929 output_dyn_value(pbuf
, sizeof pbuf
, card
->tsac
,
1931 simplelist_addline(SIMPLELIST_ADD_LINE
,
1933 simplelist_addline(SIMPLELIST_ADD_LINE
,
1934 "Nsac: %d clk", card
->nsac
);
1935 simplelist_addline(SIMPLELIST_ADD_LINE
,
1936 "R2W: *%d", card
->r2w_factor
);
1937 simplelist_addline(SIMPLELIST_ADD_LINE
,
1939 i_vmin
[card_extract_bits(card
->csd
, 66, 3)],
1940 i_vmax
[card_extract_bits(card
->csd
, 69, 3)]);
1941 simplelist_addline(SIMPLELIST_ADD_LINE
,
1943 i_vmin
[card_extract_bits(card
->csd
, 72, 3)],
1944 i_vmax
[card_extract_bits(card
->csd
, 75, 3)]);
1946 else if (card
->initialized
== 0)
1948 simplelist_addline(SIMPLELIST_ADD_LINE
, "Not Found!");
1950 #if (CONFIG_STORAGE & STORAGE_SD)
1951 else /* card->initialized < 0 */
1953 simplelist_addline(SIMPLELIST_ADD_LINE
, "Init Error! (%d)", card
->initialized
);
1956 snprintf(title
, 16, "[" CARDTYPE
" %d]", *cardnum
);
1957 gui_synclist_set_title(lists
, title
, Icon_NOICON
);
1958 gui_synclist_set_nb_items(lists
, simplelist_get_line_count());
1959 gui_synclist_select_item(lists
, 0);
1960 btn
= ACTION_REDRAW
;
1964 #elif (CONFIG_STORAGE & STORAGE_ATA)
1965 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1970 unsigned short* identify_info
= ata_get_identify();
1971 bool timing_info_present
= false;
1974 simplelist_set_line_count(0);
1976 for (i
=0; i
< 20; i
++)
1977 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+27]);
1979 /* kill trailing space */
1980 for (i
=39; i
&& buf
[i
]==' '; i
--)
1982 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", buf
);
1983 for (i
=0; i
< 4; i
++)
1984 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+23]);
1986 simplelist_addline(SIMPLELIST_ADD_LINE
,
1987 "Firmware: %s", buf
);
1988 snprintf(buf
, sizeof buf
, "%ld MB",
1989 ((unsigned long)identify_info
[61] << 16 |
1990 (unsigned long)identify_info
[60]) / 2048 );
1991 simplelist_addline(SIMPLELIST_ADD_LINE
,
1994 fat_size( IF_MV2(0,) NULL
, &free
);
1995 simplelist_addline(SIMPLELIST_ADD_LINE
,
1996 "Free: %ld MB", free
/ 1024);
1997 simplelist_addline(SIMPLELIST_ADD_LINE
,
1998 "Spinup time: %d ms", storage_spinup_time() * (1000/HZ
));
1999 i
= identify_info
[83] & (1<<3);
2000 simplelist_addline(SIMPLELIST_ADD_LINE
,
2001 "Power mgmt: %s", i
? "enabled" : "unsupported");
2002 i
= identify_info
[83] & (1<<9);
2003 simplelist_addline(SIMPLELIST_ADD_LINE
,
2004 "Noise mgmt: %s", i
? "enabled" : "unsupported");
2005 i
= identify_info
[82] & (1<<6);
2006 simplelist_addline(SIMPLELIST_ADD_LINE
,
2007 "Read-ahead: %s", i
? "enabled" : "unsupported");
2008 timing_info_present
= identify_info
[53] & (1<<1);
2009 if(timing_info_present
) {
2010 char pio3
[2], pio4
[2];pio3
[1] = 0;
2012 pio3
[0] = (identify_info
[64] & (1<<0)) ? '3' : 0;
2013 pio4
[0] = (identify_info
[64] & (1<<1)) ? '4' : 0;
2014 simplelist_addline(SIMPLELIST_ADD_LINE
,
2015 "PIO modes: 0 1 2 %s %s", pio3
, pio4
);
2018 simplelist_addline(SIMPLELIST_ADD_LINE
,
2019 "No PIO mode info");
2021 timing_info_present
= identify_info
[53] & (1<<1);
2022 if(timing_info_present
) {
2023 simplelist_addline(SIMPLELIST_ADD_LINE
,
2024 "Cycle times %dns/%dns",
2026 identify_info
[68] );
2028 simplelist_addline(SIMPLELIST_ADD_LINE
,
2031 #if defined (TOSHIBA_GIGABEAT_F) || defined (TOSHIBA_GIGABEAT_S)
2032 if (identify_info
[63] & (1<<0)) {
2033 char mdma0
[2], mdma1
[2], mdma2
[2];
2034 mdma0
[1] = mdma1
[1] = mdma2
[1] = 0;
2035 mdma0
[0] = (identify_info
[63] & (1<<0)) ? '0' : 0;
2036 mdma1
[0] = (identify_info
[63] & (1<<1)) ? '1' : 0;
2037 mdma2
[0] = (identify_info
[63] & (1<<2)) ? '2' : 0;
2038 simplelist_addline(SIMPLELIST_ADD_LINE
,
2039 "MDMA modes: %s %s %s", mdma0
, mdma1
, mdma2
);
2040 simplelist_addline(SIMPLELIST_ADD_LINE
,
2041 "MDMA Cycle times %dns/%dns",
2043 identify_info
[66] );
2046 simplelist_addline(SIMPLELIST_ADD_LINE
,
2047 "No MDMA mode info");
2049 if (identify_info
[88] & (1<<0)) {
2050 char udma0
[2], udma1
[2], udma2
[2], udma3
[2], udma4
[2], udma5
[2];
2051 udma0
[1] = udma1
[1] = udma2
[1] = udma3
[1] = udma4
[1] = udma5
[1] = 0;
2052 udma0
[0] = (identify_info
[88] & (1<<0)) ? '0' : 0;
2053 udma1
[0] = (identify_info
[88] & (1<<1)) ? '1' : 0;
2054 udma2
[0] = (identify_info
[88] & (1<<2)) ? '2' : 0;
2055 udma3
[0] = (identify_info
[88] & (1<<3)) ? '3' : 0;
2056 udma4
[0] = (identify_info
[88] & (1<<4)) ? '4' : 0;
2057 udma5
[0] = (identify_info
[88] & (1<<5)) ? '5' : 0;
2058 simplelist_addline(SIMPLELIST_ADD_LINE
,
2059 "UDMA modes: %s %s %s %s %s %s", udma0
, udma1
, udma2
,
2060 udma3
, udma4
, udma5
);
2063 simplelist_addline(SIMPLELIST_ADD_LINE
,
2064 "No UDMA mode info");
2066 #endif /* defined (TOSHIBA_GIGABEAT_F) || defined (TOSHIBA_GIGABEAT_S) */
2067 timing_info_present
= identify_info
[53] & (1<<1);
2068 if(timing_info_present
) {
2069 i
= identify_info
[49] & (1<<11);
2070 simplelist_addline(SIMPLELIST_ADD_LINE
,
2071 "IORDY support: %s", i
? "yes" : "no");
2072 i
= identify_info
[49] & (1<<10);
2073 simplelist_addline(SIMPLELIST_ADD_LINE
,
2074 "IORDY disable: %s", i
? "yes" : "no");
2076 simplelist_addline(SIMPLELIST_ADD_LINE
,
2079 simplelist_addline(SIMPLELIST_ADD_LINE
,
2080 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2083 #else /* No SD, MMC or ATA */
2084 static int disk_callback(int btn
, struct gui_synclist
*lists
)
2088 struct storage_info info
;
2089 storage_get_info(0,&info
);
2090 simplelist_addline(SIMPLELIST_ADD_LINE
, "Vendor: %s", info
.vendor
);
2091 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", info
.product
);
2092 simplelist_addline(SIMPLELIST_ADD_LINE
, "Firmware: %s", info
.revision
);
2093 simplelist_addline(SIMPLELIST_ADD_LINE
,
2094 "Size: %ld MB", info
.num_sectors
*(info
.sector_size
/512)/2024);
2096 fat_size( IF_MV2(0,) NULL
, &free
);
2097 simplelist_addline(SIMPLELIST_ADD_LINE
,
2098 "Free: %ld MB", free
/ 1024);
2099 simplelist_addline(SIMPLELIST_ADD_LINE
,
2100 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2105 #if (CONFIG_STORAGE & STORAGE_ATA)
2106 static bool dbg_identify_info(void)
2108 int fd
= creat("/identify_info.bin");
2111 #ifdef ROCKBOX_LITTLE_ENDIAN
2112 ecwrite(fd
, ata_get_identify(), SECTOR_SIZE
/2, "s", true);
2114 write(fd
, ata_get_identify(), SECTOR_SIZE
);
2122 static bool dbg_disk_info(void)
2124 struct simplelist_info info
;
2125 simplelist_info_init(&info
, "Disk Info", 1, NULL
);
2126 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
2129 info
.callback_data
= (void*)&card
;
2132 info
.action_callback
= disk_callback
;
2133 info
.hide_selection
= true;
2134 info
.scroll_all
= true;
2135 return simplelist_show_list(&info
);
2137 #endif /* !SIMULATOR */
2139 #ifdef HAVE_DIRCACHE
2140 static int dircache_callback(int btn
, struct gui_synclist
*lists
)
2142 (void)btn
; (void)lists
;
2143 simplelist_set_line_count(0);
2144 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache initialized: %s",
2145 dircache_is_enabled() ? "Yes" : "No");
2146 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache size: %d B",
2147 dircache_get_cache_size());
2148 simplelist_addline(SIMPLELIST_ADD_LINE
, "Last size: %d B",
2149 global_status
.dircache_size
);
2150 simplelist_addline(SIMPLELIST_ADD_LINE
, "Limit: %d B",
2152 simplelist_addline(SIMPLELIST_ADD_LINE
, "Reserve: %d/%d B",
2153 dircache_get_reserve_used(), DIRCACHE_RESERVE
);
2154 simplelist_addline(SIMPLELIST_ADD_LINE
, "Scanning took: %d s",
2155 dircache_get_build_ticks() / HZ
);
2156 simplelist_addline(SIMPLELIST_ADD_LINE
, "Entry count: %d",
2157 dircache_get_entry_count());
2161 static bool dbg_dircache_info(void)
2163 struct simplelist_info info
;
2164 simplelist_info_init(&info
, "Dircache Info", 7, NULL
);
2165 info
.action_callback
= dircache_callback
;
2166 info
.hide_selection
= true;
2167 info
.scroll_all
= true;
2168 return simplelist_show_list(&info
);
2171 #endif /* HAVE_DIRCACHE */
2173 #ifdef HAVE_TAGCACHE
2174 static int database_callback(int btn
, struct gui_synclist
*lists
)
2177 struct tagcache_stat
*stat
= tagcache_get_stat();
2178 static bool synced
= false;
2180 simplelist_set_line_count(0);
2182 simplelist_addline(SIMPLELIST_ADD_LINE
, "Initialized: %s",
2183 stat
->initialized
? "Yes" : "No");
2184 simplelist_addline(SIMPLELIST_ADD_LINE
, "DB Ready: %s",
2185 stat
->ready
? "Yes" : "No");
2186 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM Cache: %s",
2187 stat
->ramcache
? "Yes" : "No");
2188 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM: %d/%d B",
2189 stat
->ramcache_used
, stat
->ramcache_allocated
);
2190 simplelist_addline(SIMPLELIST_ADD_LINE
, "Progress: %d%% (%d entries)",
2191 stat
->progress
, stat
->processed_entries
);
2192 simplelist_addline(SIMPLELIST_ADD_LINE
, "Curfile: %s",
2193 stat
->curentry
? stat
->curentry
: "---");
2194 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit step: %d",
2196 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit delayed: %s",
2197 stat
->commit_delayed
? "Yes" : "No");
2199 simplelist_addline(SIMPLELIST_ADD_LINE
, "Queue length: %d",
2200 stat
->queue_length
);
2205 tagcache_screensync_event();
2208 if (!btn
&& stat
->curentry
)
2211 return ACTION_REDRAW
;
2214 if (btn
== ACTION_STD_CANCEL
)
2215 tagcache_screensync_enable(false);
2219 static bool dbg_tagcache_info(void)
2221 struct simplelist_info info
;
2222 simplelist_info_init(&info
, "Database Info", 8, NULL
);
2223 info
.action_callback
= database_callback
;
2224 info
.hide_selection
= true;
2225 info
.scroll_all
= true;
2227 /* Don't do nonblock here, must give enough processing time
2228 for tagcache thread. */
2229 /* info.timeout = TIMEOUT_NOBLOCK; */
2231 tagcache_screensync_enable(true);
2232 return simplelist_show_list(&info
);
2236 #if CONFIG_CPU == SH7034
2237 static bool dbg_save_roms(void)
2240 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2242 fd
= creat("/internal_rom_0000-FFFF.bin");
2245 write(fd
, (void *)0, 0x10000);
2249 fd
= creat("/internal_rom_2000000-203FFFF.bin");
2252 write(fd
, (void *)0x2000000, 0x40000);
2256 system_memory_guard(oldmode
);
2259 #elif defined CPU_COLDFIRE
2260 static bool dbg_save_roms(void)
2263 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2265 #if defined(IRIVER_H100_SERIES)
2266 fd
= creat("/internal_rom_000000-1FFFFF.bin");
2267 #elif defined(IRIVER_H300_SERIES)
2268 fd
= creat("/internal_rom_000000-3FFFFF.bin");
2269 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3)
2270 fd
= creat("/internal_rom_000000-3FFFFF.bin");
2274 write(fd
, (void *)0, FLASH_SIZE
);
2277 system_memory_guard(oldmode
);
2280 fd
= creat("/internal_eeprom.bin");
2284 char buf
[EEPROM_SIZE
];
2287 old_irq_level
= disable_irq_save();
2289 err
= eeprom_24cxx_read(0, buf
, sizeof buf
);
2291 restore_irq(old_irq_level
);
2294 splashf(HZ
*3, "Eeprom read failure (%d)", err
);
2297 write(fd
, buf
, sizeof buf
);
2306 #elif defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)
2307 static bool dbg_save_roms(void)
2311 fd
= creat("/internal_rom_000000-0FFFFF.bin");
2314 write(fd
, (void *)0x20000000, FLASH_SIZE
);
2324 static int radio_callback(int btn
, struct gui_synclist
*lists
)
2327 if (btn
== ACTION_STD_CANCEL
)
2329 simplelist_set_line_count(1);
2331 #if (CONFIG_TUNER & LV24020LP)
2332 simplelist_addline(SIMPLELIST_ADD_LINE
,
2333 "CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT
) );
2334 simplelist_addline(SIMPLELIST_ADD_LINE
,
2335 "RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT
) );
2336 simplelist_addline(SIMPLELIST_ADD_LINE
,
2337 "MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM
) );
2338 simplelist_addline(SIMPLELIST_ADD_LINE
,
2339 "MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF
) );
2340 simplelist_addline(SIMPLELIST_ADD_LINE
,
2341 "MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD
) );
2342 simplelist_addline(SIMPLELIST_ADD_LINE
,
2343 "if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET
) );
2344 simplelist_addline(SIMPLELIST_ADD_LINE
,
2345 "sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET
) );
2346 #endif /* LV24020LP */
2347 #if (CONFIG_TUNER & S1A0903X01)
2348 simplelist_addline(SIMPLELIST_ADD_LINE
,
2349 "Samsung regs: %08X", s1a0903x01_get(RADIO_ALL
));
2350 /* This one doesn't return dynamic data atm */
2351 #endif /* S1A0903X01 */
2352 #if (CONFIG_TUNER & TEA5767)
2353 struct tea5767_dbg_info nfo
;
2354 tea5767_dbg_info(&nfo
);
2355 simplelist_addline(SIMPLELIST_ADD_LINE
, "Philips regs:");
2356 simplelist_addline(SIMPLELIST_ADD_LINE
,
2357 " Read: %02X %02X %02X %02X %02X",
2358 (unsigned)nfo
.read_regs
[0], (unsigned)nfo
.read_regs
[1],
2359 (unsigned)nfo
.read_regs
[2], (unsigned)nfo
.read_regs
[3],
2360 (unsigned)nfo
.read_regs
[4]);
2361 simplelist_addline(SIMPLELIST_ADD_LINE
,
2362 " Write: %02X %02X %02X %02X %02X",
2363 (unsigned)nfo
.write_regs
[0], (unsigned)nfo
.write_regs
[1],
2364 (unsigned)nfo
.write_regs
[2], (unsigned)nfo
.write_regs
[3],
2365 (unsigned)nfo
.write_regs
[4]);
2366 #endif /* TEA5767 */
2367 #if (CONFIG_TUNER & SI4700)
2368 struct si4700_dbg_info nfo
;
2369 si4700_dbg_info(&nfo
);
2370 simplelist_addline(SIMPLELIST_ADD_LINE
, "SI4700 regs:");
2372 simplelist_addline(SIMPLELIST_ADD_LINE
,
2373 "%04X %04X %04X %04X",
2374 (unsigned)nfo
.regs
[0], (unsigned)nfo
.regs
[1],
2375 (unsigned)nfo
.regs
[2], (unsigned)nfo
.regs
[3]);
2376 simplelist_addline(SIMPLELIST_ADD_LINE
,
2377 "%04X %04X %04X %04X",
2378 (unsigned)nfo
.regs
[4], (unsigned)nfo
.regs
[5],
2379 (unsigned)nfo
.regs
[6], (unsigned)nfo
.regs
[7]);
2380 simplelist_addline(SIMPLELIST_ADD_LINE
,
2381 "%04X %04X %04X %04X",
2382 (unsigned)nfo
.regs
[8], (unsigned)nfo
.regs
[9],
2383 (unsigned)nfo
.regs
[10], (unsigned)nfo
.regs
[11]);
2384 simplelist_addline(SIMPLELIST_ADD_LINE
,
2385 "%04X %04X %04X %04X",
2386 (unsigned)nfo
.regs
[12], (unsigned)nfo
.regs
[13],
2387 (unsigned)nfo
.regs
[14], (unsigned)nfo
.regs
[15]);
2389 return ACTION_REDRAW
;
2391 static bool dbg_fm_radio(void)
2393 struct simplelist_info info
;
2394 info
.scroll_all
= true;
2395 simplelist_info_init(&info
, "FM Radio", 1, NULL
);
2396 simplelist_set_line_count(0);
2397 simplelist_addline(SIMPLELIST_ADD_LINE
, "HW detected: %s",
2398 radio_hardware_present() ? "yes" : "no");
2400 info
.action_callback
= radio_hardware_present()?radio_callback
: NULL
;
2401 info
.hide_selection
= true;
2402 return simplelist_show_list(&info
);
2404 #endif /* CONFIG_TUNER */
2405 #endif /* !SIMULATOR */
2407 #ifdef HAVE_LCD_BITMAP
2408 extern bool do_screendump_instead_of_usb
;
2410 static bool dbg_screendump(void)
2412 do_screendump_instead_of_usb
= !do_screendump_instead_of_usb
;
2413 splashf(HZ
, "Screendump %s",
2414 do_screendump_instead_of_usb
?"enabled":"disabled");
2417 #endif /* HAVE_LCD_BITMAP */
2419 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2420 static bool dbg_set_memory_guard(void)
2422 static const struct opt_items names
[MAXMEMGUARD
] = {
2424 { "Flash ROM writes", -1 },
2425 { "Zero area (all)", -1 }
2427 int mode
= system_memory_guard(MEMGUARD_KEEP
);
2429 set_option( "Catch mem accesses", &mode
, INT
, names
, MAXMEMGUARD
, NULL
);
2430 system_memory_guard(mode
);
2434 #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
2436 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2437 static bool dbg_write_eeprom(void)
2442 char buf
[EEPROM_SIZE
];
2445 fd
= open("/internal_eeprom.bin", O_RDONLY
);
2449 rc
= read(fd
, buf
, EEPROM_SIZE
);
2451 if(rc
== EEPROM_SIZE
)
2453 old_irq_level
= disable_irq_save();
2455 err
= eeprom_24cxx_write(0, buf
, sizeof buf
);
2457 splashf(HZ
*3, "Eeprom write failure (%d)", err
);
2459 splash(HZ
*3, "Eeprom written successfully");
2461 restore_irq(old_irq_level
);
2465 splashf(HZ
*3, "File read error (%d)",rc
);
2471 splash(HZ
*3, "Failed to open 'internal_eeprom.bin'");
2476 #endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
2477 #ifdef CPU_BOOST_LOGGING
2478 static bool cpu_boost_log(void)
2481 int count
= cpu_boost_log_getcount();
2482 int lines
= LCD_HEIGHT
/SYSFONT_HEIGHT
;
2485 lcd_setfont(FONT_SYSFIXED
);
2486 str
= cpu_boost_log_getlog_first();
2489 lcd_clear_display();
2490 for(j
=0; j
<lines
; j
++,i
++)
2493 str
= cpu_boost_log_getlog_next();
2504 switch(get_action(CONTEXT_STD
,TIMEOUT_BLOCK
))
2507 case ACTION_STD_PREV
:
2508 case ACTION_STD_NEXT
:
2511 case ACTION_STD_CANCEL
:
2518 get_action(CONTEXT_STD
,TIMEOUT_BLOCK
);
2519 lcd_setfont(FONT_UI
);
2524 #if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR))
2525 extern bool wheel_is_touched
;
2526 extern int old_wheel_value
;
2527 extern int new_wheel_value
;
2528 extern int wheel_delta
;
2529 extern unsigned int accumulated_wheel_delta
;
2530 extern unsigned int wheel_velocity
;
2532 static bool dbg_scrollwheel(void)
2537 lcd_setfont(FONT_SYSFIXED
);
2541 if (action_userabort(HZ
/10))
2544 lcd_clear_display();
2546 /* show internal variables of scrollwheel driver */
2547 snprintf(buf
, sizeof(buf
), "wheel touched: %s", (wheel_is_touched
) ? "true" : "false");
2548 lcd_puts(0, 0, buf
);
2549 snprintf(buf
, sizeof(buf
), "new position: %2d", new_wheel_value
);
2550 lcd_puts(0, 1, buf
);
2551 snprintf(buf
, sizeof(buf
), "old position: %2d", old_wheel_value
);
2552 lcd_puts(0, 2, buf
);
2553 snprintf(buf
, sizeof(buf
), "wheel delta: %2d", wheel_delta
);
2554 lcd_puts(0, 3, buf
);
2555 snprintf(buf
, sizeof(buf
), "accumulated delta: %2d", accumulated_wheel_delta
);
2556 lcd_puts(0, 4, buf
);
2557 snprintf(buf
, sizeof(buf
), "velo [deg/s]: %4d", (int)wheel_velocity
);
2558 lcd_puts(0, 5, buf
);
2560 /* show effective accelerated scrollspeed */
2561 speed
= button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity
);
2562 snprintf(buf
, sizeof(buf
), "accel. speed: %4d", speed
);
2563 lcd_puts(0, 6, buf
);
2567 lcd_setfont(FONT_UI
);
2572 #if defined(HAVE_USBSTACK) && defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
2573 static bool logf_usb_serial(void)
2575 bool serial_enabled
= !usb_core_driver_enabled(USB_DRIVER_SERIAL
);
2576 usb_core_enable_driver(USB_DRIVER_SERIAL
,serial_enabled
);
2577 splashf(HZ
, "USB logf %s",
2578 serial_enabled
?"enabled":"disabled");
2583 #if 0 && defined(HAVE_USBSTACK) && defined(USB_STORAGE)
2584 static bool usb_reconnect(void)
2586 splash(HZ
, "Reconnect mass storage");
2587 usb_storage_reconnect();
2592 #if CONFIG_USBOTG == USBOTG_ISP1583
2593 extern int dbg_usb_num_items(void);
2594 extern char* dbg_usb_item(int selected_item
, void *data
, char *buffer
, size_t buffer_len
);
2596 static int isp1583_action_callback(int action
, struct gui_synclist
*lists
)
2599 if (action
== ACTION_NONE
)
2600 action
= ACTION_REDRAW
;
2604 static bool dbg_isp1583(void)
2606 struct simplelist_info isp1583
;
2607 isp1583
.scroll_all
= true;
2608 simplelist_info_init(&isp1583
, "ISP1583", dbg_usb_num_items(), NULL
);
2609 isp1583
.timeout
= HZ
/100;
2610 isp1583
.hide_selection
= true;
2611 isp1583
.get_name
= dbg_usb_item
;
2612 isp1583
.action_callback
= isp1583_action_callback
;
2613 return simplelist_show_list(&isp1583
);
2617 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2618 extern int pic_dbg_num_items(void);
2619 extern char* pic_dbg_item(int selected_item
, void *data
, char *buffer
, size_t buffer_len
);
2621 static int pic_action_callback(int action
, struct gui_synclist
*lists
)
2624 if (action
== ACTION_NONE
)
2625 action
= ACTION_REDRAW
;
2629 static bool dbg_pic(void)
2631 struct simplelist_info pic
;
2632 pic
.scroll_all
= true;
2633 simplelist_info_init(&pic
, "PIC", pic_dbg_num_items(), NULL
);
2634 pic
.timeout
= HZ
/100;
2635 pic
.hide_selection
= true;
2636 pic
.get_name
= pic_dbg_item
;
2637 pic
.action_callback
= pic_action_callback
;
2638 return simplelist_show_list(&pic
);
2643 /****** The menu *********/
2644 struct the_menu_item
{
2645 unsigned char *desc
; /* string or ID */
2646 bool (*function
) (void); /* return true if USB was connected */
2648 static const struct the_menu_item menuitems
[] = {
2649 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2650 (defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD))
2651 { "Dump ROM contents", dbg_save_roms
},
2653 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \
2654 || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L
2655 { "View I/O ports", dbg_ports
},
2657 #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
2658 { "View PCF registers", dbg_pcf
},
2660 #if defined(HAVE_TSC2100) && !defined(SIMULATOR)
2661 { "TSC2100 debug", tsc2100_debug
},
2663 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
2664 { "CPU frequency", dbg_cpufreq
},
2666 #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
2667 { "S/PDIF analyzer", dbg_spdif
},
2669 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2670 { "Catch mem accesses", dbg_set_memory_guard
},
2672 { "View OS stacks", dbg_os
},
2673 #ifdef HAVE_LCD_BITMAP
2675 { "View battery", view_battery
},
2677 { "Screendump", dbg_screendump
},
2680 { "View HW info", dbg_hw_info
},
2683 { "View partitions", dbg_partitions
},
2686 { "View disk info", dbg_disk_info
},
2687 #if (CONFIG_STORAGE & STORAGE_ATA)
2688 { "Dump ATA identify info", dbg_identify_info
},
2691 #ifdef HAVE_DIRCACHE
2692 { "View dircache info", dbg_dircache_info
},
2694 #ifdef HAVE_TAGCACHE
2695 { "View database info", dbg_tagcache_info
},
2697 #ifdef HAVE_LCD_BITMAP
2698 #if CONFIG_CODEC == SWCODEC
2699 { "View buffering thread", dbg_buffering_thread
},
2700 #elif !defined(SIMULATOR)
2701 { "View audio thread", dbg_audio_thread
},
2704 { "pm histogram", peak_meter_histogram
},
2705 #endif /* PM_DEBUG */
2706 #endif /* HAVE_LCD_BITMAP */
2709 { "FM Radio", dbg_fm_radio
},
2712 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2713 { "Write back EEPROM", dbg_write_eeprom
},
2715 #if CONFIG_USBOTG == USBOTG_ISP1583
2716 { "View ISP1583 info", dbg_isp1583
},
2718 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2719 { "View PIC info", dbg_pic
},
2721 #ifdef ROCKBOX_HAS_LOGF
2722 {"logf", logfdisplay
},
2723 {"logfdump", logfdump
},
2725 #if defined(HAVE_USBSTACK) && defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
2726 {"logf over usb",logf_usb_serial
},
2728 #if 0 && defined(HAVE_USBSTACK) && defined(USB_STORAGE)
2729 {"reconnect usb storage",usb_reconnect
},
2731 #ifdef CPU_BOOST_LOGGING
2732 {"cpu_boost log",cpu_boost_log
},
2734 #if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR))
2735 {"Debug scrollwheel", dbg_scrollwheel
},
2738 static int menu_action_callback(int btn
, struct gui_synclist
*lists
)
2740 if (btn
== ACTION_STD_OK
)
2742 bool oldbars
= viewportmanager_set_statusbar(false);
2743 menuitems
[gui_synclist_get_sel_pos(lists
)].function();
2744 btn
= ACTION_REDRAW
;
2745 viewportmanager_set_statusbar(oldbars
);
2749 static char* dbg_menu_getname(int item
, void * data
,
2750 char *buffer
, size_t buffer_len
)
2752 (void)data
; (void)buffer
; (void)buffer_len
;
2753 return menuitems
[item
].desc
;
2755 bool debug_menu(void)
2757 struct simplelist_info info
;
2759 simplelist_info_init(&info
, "Debug Menu", ARRAYLEN(menuitems
), NULL
);
2760 info
.action_callback
= menu_action_callback
;
2761 info
.get_name
= dbg_menu_getname
;
2762 return simplelist_show_list(&info
);