1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Heikki Hannikainen
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
26 #include "debug_menu.h"
32 #include "powermgmt.h"
36 #include "mp3_playback.h"
39 #include "statusbar.h"
49 #include "lcd-remote.h"
61 #include "eeprom_24cxx.h"
71 #ifdef HAVE_LCD_BITMAP
72 #include "scrollbar.h"
73 #include "peakmeter.h"
76 #if CONFIG_CODEC == SWCODEC
78 #include "pcm_playback.h"
79 #if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
83 #ifdef IRIVER_H300_SERIES
84 #include "pcf50606.h" /* for pcf50606_read */
91 static bool dbg_list(char *title
, int count
, int selection_size
,
92 int (*action_callback
)(int btn
, struct gui_synclist
*lists
),
93 char* (*dbg_getname
)(int item
, void * data
, char *buffer
))
95 struct gui_synclist lists
;
98 gui_synclist_init(&lists
, dbg_getname
, NULL
, false, selection_size
);
99 gui_synclist_set_title(&lists
, title
, NOICON
);
100 gui_synclist_set_icon_callback(&lists
, NULL
);
101 gui_synclist_set_nb_items(&lists
, count
*selection_size
);
102 action_signalscreenchange();
103 gui_synclist_draw(&lists
);
106 gui_syncstatusbar_draw(&statusbars
, true);
107 action
= get_action(CONTEXT_STD
, HZ
/5);
108 if (gui_synclist_do_button(&lists
, action
, LIST_WRAP_UNLESS_HELD
))
109 gui_synclist_draw(&lists
);
111 action
= action_callback(action
, &lists
);
112 if (action
== ACTION_STD_CANCEL
)
114 else if(default_event_handler(action
) == SYS_USB_CONNECTED
)
117 action_signalscreenchange();
120 /*---------------------------------------------------*/
121 /* SPECIAL DEBUG STUFF */
122 /*---------------------------------------------------*/
123 extern struct thread_entry threads
[MAXTHREADS
];
127 static char thread_status_char(int status
)
131 case STATE_RUNNING
: return 'R';
132 case STATE_BLOCKED
: return 'B';
133 case STATE_SLEEPING
: return 'S';
134 case STATE_BLOCKED_W_TMO
: return 'T';
140 #define IF_COP2(...) __VA_ARGS__
144 static char* threads_getname(int selected_item
, void * data
, char *buffer
)
147 struct thread_entry
*thread
= NULL
;
149 thread
= &threads
[selected_item
];
151 if (thread
->name
== NULL
)
153 snprintf(buffer
, MAX_PATH
, "%2d: ---", selected_item
);
157 usage
= thread_stack_usage(thread
);
158 status
= thread_get_status(thread
);
159 #ifdef HAVE_PRIORITY_SCHEDULING
160 snprintf(buffer
, MAX_PATH
, "%2d: " IF_COP2("(%d) ") "%c%c %d %2d%% %s",
162 IF_COP2(thread
->core
,)
163 (status
== STATE_RUNNING
) ? '*' : ' ',
164 thread_status_char(status
),
166 usage
, thread
->name
);
168 snprintf(buffer
, MAX_PATH
, "%2d: " IF_COP2("(%d) ") "%c%c %2d%% %s",
170 IF_COP2(thread
->core
,)
171 (status
== STATE_RUNNING
) ? '*' : ' ',
172 thread_status_char(status
),
173 usage
, thread
->name
);
177 static int dbg_threads_action_callback(int action
, struct gui_synclist
*lists
)
179 #ifdef ROCKBOX_HAS_LOGF
180 if (action
== ACTION_STD_OK
)
182 struct thread_entry
*thread
= &threads
[gui_synclist_get_sel_pos(lists
)];
183 if (thread
->name
!= NULL
)
184 remove_thread(thread
);
187 gui_synclist_draw(lists
);
191 static bool dbg_os(void)
193 return dbg_list(IF_COP2("Core and ") "Stack usage:", MAXTHREADS
, 1,
194 dbg_threads_action_callback
, threads_getname
);
196 #endif /* !SIMULATOR */
198 #ifdef HAVE_LCD_BITMAP
199 #if CONFIG_CODEC != SWCODEC
201 static bool dbg_audio_thread(void)
204 struct audio_debug d
;
206 lcd_setmargins(0, 0);
207 lcd_setfont(FONT_SYSFIXED
);
211 if (action_userabort(HZ
/5))
214 audio_get_debugdata(&d
);
218 snprintf(buf
, sizeof(buf
), "read: %x", d
.audiobuf_read
);
220 snprintf(buf
, sizeof(buf
), "write: %x", d
.audiobuf_write
);
222 snprintf(buf
, sizeof(buf
), "swap: %x", d
.audiobuf_swapwrite
);
224 snprintf(buf
, sizeof(buf
), "playing: %d", d
.playing
);
226 snprintf(buf
, sizeof(buf
), "playable: %x", d
.playable_space
);
228 snprintf(buf
, sizeof(buf
), "unswapped: %x", d
.unswapped_space
);
231 /* Playable space left */
232 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8, 112, 4, d
.audiobuflen
, 0,
233 d
.playable_space
, HORIZONTAL
);
235 /* Show the watermark limit */
236 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8+4, 112, 4, d
.audiobuflen
, 0,
237 d
.low_watermark_level
, HORIZONTAL
);
239 snprintf(buf
, sizeof(buf
), "wm: %x - %x",
240 d
.low_watermark_level
, d
.lowest_watermark_level
);
247 #endif /* !SIMULATOR */
248 #else /* CONFIG_CODEC == SWCODEC */
249 extern size_t filebuflen
;
250 /* This is a size_t, but call it a long so it puts a - when it's bad. */
252 static unsigned int ticks
, boost_ticks
;
254 static void dbg_audio_task(void)
257 if(FREQ
> CPUFREQ_NORMAL
)
264 static bool dbg_audio_thread(void)
271 size_t bufsize
= pcmbuf_get_bufsize();
272 int pcmbufdescs
= pcmbuf_descs();
274 ticks
= boost_ticks
= 0;
276 tick_add_task(dbg_audio_task
);
278 lcd_setmargins(0, 0);
279 lcd_setfont(FONT_SYSFIXED
);
282 button
= get_action(CONTEXT_STD
,HZ
/5);
285 case ACTION_STD_NEXT
:
288 case ACTION_STD_PREV
:
291 case ACTION_STD_CANCEL
:
295 action_signalscreenchange();
300 bufused
= bufsize
- pcmbuf_free();
302 snprintf(buf
, sizeof(buf
), "pcm: %7ld/%7ld", (long) bufused
, (long) bufsize
);
303 lcd_puts(0, line
++, buf
);
305 /* Playable space left */
306 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6, bufsize
, 0, bufused
, HORIZONTAL
);
309 snprintf(buf
, sizeof(buf
), "codec: %8ld/%8ld", audio_filebufused(), (long) filebuflen
);
310 lcd_puts(0, line
++, buf
);
312 /* Playable space left */
313 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6, filebuflen
, 0,
314 audio_filebufused(), HORIZONTAL
);
317 snprintf(buf
, sizeof(buf
), "track count: %2d", audio_track_count());
318 lcd_puts(0, line
++, buf
);
321 snprintf(buf
, sizeof(buf
), "cpu freq: %3dMHz",
322 (int)((FREQ
+ 500000) / 1000000));
323 lcd_puts(0, line
++, buf
);
328 snprintf(buf
, sizeof(buf
), "boost ratio: %3d%%",
329 boost_ticks
* 100 / ticks
);
330 lcd_puts(0, line
++, buf
);
333 snprintf(buf
, sizeof(buf
), "pcmbufdesc: %2d/%2d",
334 pcmbuf_used_descs(), pcmbufdescs
);
335 lcd_puts(0, line
++, buf
);
340 tick_remove_task(dbg_audio_task
);
344 #endif /* CONFIG_CODEC */
345 #endif /* HAVE_LCD_BITMAP */
348 #if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE))
349 /* Tool function to read the flash manufacturer and type, if available.
350 Only chips which could be reprogrammed in system will return values.
351 (The mode switch addresses vary between flash manufacturers, hence addr1/2) */
352 /* In IRAM to avoid problems when running directly from Flash */
353 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
354 unsigned addr1
, unsigned addr2
)
355 ICODE_ATTR
__attribute__((noinline
));
356 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
357 unsigned addr1
, unsigned addr2
)
360 unsigned not_manu
, not_id
; /* read values before switching to ID mode */
361 unsigned manu
, id
; /* read values when in ID mode */
363 #if CONFIG_CPU == SH7034
364 volatile unsigned char* flash
= (unsigned char*)0x2000000; /* flash mapping */
365 #elif defined(CPU_COLDFIRE)
366 volatile unsigned short* flash
= (unsigned short*)0; /* flash mapping */
368 int old_level
; /* saved interrupt level */
370 not_manu
= flash
[0]; /* read the normal content */
371 not_id
= flash
[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */
373 /* disable interrupts, prevent any stray flash access */
374 old_level
= set_irq_level(HIGHEST_IRQ_LEVEL
);
376 flash
[addr1
] = 0xAA; /* enter command mode */
378 flash
[addr1
] = 0x90; /* ID command */
379 /* Atmel wants 20ms pause here */
380 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
382 manu
= flash
[0]; /* read the IDs */
385 flash
[0] = 0xF0; /* reset flash (back to normal read mode) */
386 /* Atmel wants 20ms pause here */
387 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
389 set_irq_level(old_level
); /* enable interrupts again */
391 /* I assume success if the obtained values are different from
392 the normal flash content. This is not perfectly bulletproof, they
393 could theoretically be the same by chance, causing us to fail. */
394 if (not_manu
!= manu
|| not_id
!= id
) /* a value has changed */
396 *p_manufacturer
= manu
; /* return the results */
398 return true; /* success */
400 return false; /* fail */
402 #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
405 #ifdef HAVE_LCD_BITMAP
406 static bool dbg_hw_info(void)
408 #if CONFIG_CPU == SH7034
410 int bitmask
= HW_MASK
;
411 int rom_version
= ROM_VERSION
;
412 unsigned manu
, id
; /* flash IDs */
413 bool got_id
; /* flag if we managed to get the flash IDs */
414 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
415 bool has_bootrom
; /* flag for boot ROM present */
416 int oldmode
; /* saved memory guard mode */
418 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
420 /* get flash ROM type */
421 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
423 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
425 /* check if the boot ROM area is a flash mirror */
426 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
427 if (has_bootrom
) /* if ROM and Flash different */
429 /* calculate CRC16 checksum of boot ROM */
430 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
433 system_memory_guard(oldmode
); /* re-enable memory guard */
435 lcd_setmargins(0, 0);
436 lcd_setfont(FONT_SYSFIXED
);
439 lcd_puts(0, 0, "[Hardware info]");
441 snprintf(buf
, 32, "ROM: %d.%02d", rom_version
/100, rom_version
%100);
444 snprintf(buf
, 32, "Mask: 0x%04x", bitmask
);
448 snprintf(buf
, 32, "Flash: M=%02x D=%02x", manu
, id
);
450 snprintf(buf
, 32, "Flash: M=?? D=??"); /* unknown, sorry */
455 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
456 snprintf(buf
, 32, "Boot ROM: V1");
458 snprintf(buf
, 32, "ROMcrc: 0x%08x", rom_crc
);
462 snprintf(buf
, 32, "Boot ROM: none");
470 if (action_userabort(TIMEOUT_BLOCK
))
473 #elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
475 unsigned manu
, id
; /* flash IDs */
476 int got_id
; /* flag if we managed to get the flash IDs */
477 int oldmode
; /* saved memory guard mode */
480 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
482 /* get flash ROM type */
483 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
485 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
487 system_memory_guard(oldmode
); /* re-enable memory guard */
489 lcd_setmargins(0, 0);
490 lcd_setfont(FONT_SYSFIXED
);
493 lcd_puts(0, line
++, "[Hardware info]");
496 snprintf(buf
, 32, "Flash: M=%04x D=%04x", manu
, id
);
498 snprintf(buf
, 32, "Flash: M=???? D=????"); /* unknown, sorry */
499 lcd_puts(0, line
++, buf
);
505 lcd_puts(0, ++line
, "Serial Number:");
507 got_id
= ds2411_read_id(&id
);
509 if (got_id
== DS2411_OK
)
511 snprintf(buf
, 32, " FC=%02x", (unsigned)id
.family_code
);
512 lcd_puts(0, ++line
, buf
);
513 snprintf(buf
, 32, " ID=%02X %02X %02X %02X %02X %02X",
514 (unsigned)id
.uid
[0], (unsigned)id
.uid
[1], (unsigned)id
.uid
[2],
515 (unsigned)id
.uid
[3], (unsigned)id
.uid
[4], (unsigned)id
.uid
[5]);
516 lcd_puts(0, ++line
, buf
);
517 snprintf(buf
, 32, " CRC=%02X", (unsigned)id
.crc
);
521 snprintf(buf
, 32, "READ ERR=%d", got_id
);
524 lcd_puts(0, ++line
, buf
);
532 if (action_userabort(TIMEOUT_BLOCK
))
535 #elif CONFIG_CPU == PP5020
537 char pp_version
[] = { (PP_VER2
>> 24) & 0xff, (PP_VER2
>> 16) & 0xff,
538 (PP_VER2
>> 8) & 0xff, (PP_VER2
) & 0xff,
539 (PP_VER1
>> 24) & 0xff, (PP_VER1
>> 16) & 0xff,
540 (PP_VER1
>> 8) & 0xff, (PP_VER1
) & 0xff, '\0' };
542 lcd_setmargins(0, 0);
543 lcd_setfont(FONT_SYSFIXED
);
546 lcd_puts(0, 0, "[Hardware info]");
548 snprintf(buf
, sizeof(buf
), "HW rev: 0x%08x", ipod_hw_rev
);
551 snprintf(buf
, sizeof(buf
), "PP version: %s", pp_version
);
557 if (action_userabort(TIMEOUT_BLOCK
))
560 #endif /* CONFIG_CPU */
563 #else /* !HAVE_LCD_BITMAP */
564 static bool dbg_hw_info(void)
569 int rom_version
= ROM_VERSION
;
570 unsigned manu
, id
; /* flash IDs */
571 bool got_id
; /* flag if we managed to get the flash IDs */
572 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
573 bool has_bootrom
; /* flag for boot ROM present */
574 int oldmode
; /* saved memory guard mode */
576 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
578 /* get flash ROM type */
579 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
581 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
583 /* check if the boot ROM area is a flash mirror */
584 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
585 if (has_bootrom
) /* if ROM and Flash different */
587 /* calculate CRC16 checksum of boot ROM */
588 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
591 system_memory_guard(oldmode
); /* re-enable memory guard */
595 lcd_puts(0, 0, "[HW Info]");
601 snprintf(buf
, 32, "ROM: %d.%02d",
602 rom_version
/100, rom_version
%100);
606 snprintf(buf
, 32, "Flash:%02x,%02x", manu
, id
);
608 snprintf(buf
, 32, "Flash:??,??"); /* unknown, sorry */
613 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
614 snprintf(buf
, 32, "BootROM: V1");
615 else if (rom_crc
== 0x358099E8)
616 snprintf(buf
, 32, "BootROM: V2");
617 /* alternative boot ROM found in one single player so far */
619 snprintf(buf
, 32, "R: %08x", rom_crc
);
622 snprintf(buf
, 32, "BootROM: no");
628 button
= get_action(CONTEXT_SETTINGS
,TIMEOUT_BLOCK
);
632 case ACTION_STD_CANCEL
:
633 action_signalscreenchange();
636 case ACTION_SETTINGS_DEC
:
642 case ACTION_SETTINGS_INC
:
651 #endif /* !HAVE_LCD_BITMAP */
652 #endif /* !SIMULATOR */
655 static char* dbg_partitions_getname(int selected_item
, void * data
, char *buffer
)
658 int partition
= selected_item
/2;
659 struct partinfo
* p
= disk_partinfo(partition
);
662 snprintf(buffer
, MAX_PATH
, "T:%x %ld MB", p
->type
, p
->size
/ 2048);
666 snprintf(buffer
, MAX_PATH
, "P%d: S:%lx", partition
, p
->start
);
671 bool dbg_partitions(void)
673 return dbg_list("Partition Info", 4, 2,
674 NULL
, dbg_partitions_getname
);
678 #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
679 static bool dbg_spdif(void)
683 unsigned int control
;
688 unsigned int interruptstat
;
689 bool valnogood
, symbolerr
, parityerr
;
692 int spdif_source
= spdif_get_output_source(&spdif_src_on
);
693 spdif_set_output_source(AUDIO_SRC_SPDIF
, true);
695 lcd_setmargins(0, 0);
697 lcd_setfont(FONT_SYSFIXED
);
699 #ifdef HAVE_SPDIF_POWER
700 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
707 control
= EBU1RCVCCHANNEL1
;
708 interruptstat
= INTERRUPTSTAT
;
709 INTERRUPTCLEAR
= 0x03c00000;
711 valnogood
= (interruptstat
& 0x01000000)?true:false;
712 symbolerr
= (interruptstat
& 0x00800000)?true:false;
713 parityerr
= (interruptstat
& 0x00400000)?true:false;
715 snprintf(buf
, sizeof(buf
), "Val: %s Sym: %s Par: %s",
718 parityerr
?"--":"OK");
719 lcd_puts(0, line
++, buf
);
721 snprintf(buf
, sizeof(buf
), "Status word: %08x", (int)control
);
722 lcd_puts(0, line
++, buf
);
727 snprintf(buf
, sizeof(buf
), "PRO: %d (%s)",
728 x
, x
?"Professional":"Consumer");
729 lcd_puts(0, line
++, buf
);
731 x
= (control
>> 30) & 1;
732 snprintf(buf
, sizeof(buf
), "Audio: %d (%s)",
733 x
, x
?"Non-PCM":"PCM");
734 lcd_puts(0, line
++, buf
);
736 x
= (control
>> 29) & 1;
737 snprintf(buf
, sizeof(buf
), "Copy: %d (%s)",
738 x
, x
?"Permitted":"Inhibited");
739 lcd_puts(0, line
++, buf
);
741 x
= (control
>> 27) & 7;
754 snprintf(buf
, sizeof(buf
), "Preemphasis: %d (%s)", x
, s
);
755 lcd_puts(0, line
++, buf
);
757 x
= (control
>> 24) & 3;
758 snprintf(buf
, sizeof(buf
), "Mode: %d", x
);
759 lcd_puts(0, line
++, buf
);
761 category
= (control
>> 17) & 127;
773 snprintf(buf
, sizeof(buf
), "Category: 0x%02x (%s)", category
, s
);
774 lcd_puts(0, line
++, buf
);
776 x
= (control
>> 16) & 1;
778 if(((category
& 0x70) == 0x10) ||
779 ((category
& 0x70) == 0x40) ||
780 ((category
& 0x78) == 0x38))
782 generation
= !generation
;
784 snprintf(buf
, sizeof(buf
), "Generation: %d (%s)",
785 x
, generation
?"Original":"No ind.");
786 lcd_puts(0, line
++, buf
);
788 x
= (control
>> 12) & 15;
789 snprintf(buf
, sizeof(buf
), "Source: %d", x
);
790 lcd_puts(0, line
++, buf
);
792 x
= (control
>> 8) & 15;
808 snprintf(buf
, sizeof(buf
), "Channel: %d (%s)", x
, s
);
809 lcd_puts(0, line
++, buf
);
811 x
= (control
>> 4) & 15;
824 snprintf(buf
, sizeof(buf
), "Frequency: %d (%s)", x
, s
);
825 lcd_puts(0, line
++, buf
);
827 x
= (control
>> 2) & 3;
828 snprintf(buf
, sizeof(buf
), "Clock accuracy: %d", x
);
829 lcd_puts(0, line
++, buf
);
833 snprintf(buf
, sizeof(buf
), "Measured freq: %ldHz",
834 spdif_measure_frequency());
835 lcd_puts(0, line
++, buf
);
840 if (action_userabort(HZ
/10))
844 spdif_set_output_source(spdif_source
, spdif_src_on
);
846 #ifdef HAVE_SPDIF_POWER
847 spdif_power_enable(global_settings
.spdif_enable
);
852 #endif /* CPU_COLDFIRE */
855 #ifdef HAVE_LCD_BITMAP
856 /* button definitions */
857 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
858 (CONFIG_KEYPAD == IRIVER_H300_PAD)
859 # define DEBUG_CANCEL BUTTON_OFF
861 #elif CONFIG_KEYPAD == RECORDER_PAD
862 # define DEBUG_CANCEL BUTTON_OFF
864 #elif CONFIG_KEYPAD == ONDIO_PAD
865 # define DEBUG_CANCEL BUTTON_MENU
867 #elif (CONFIG_KEYPAD == IPOD_3G_PAD) || \
868 (CONFIG_KEYPAD == IPOD_4G_PAD)
869 # define DEBUG_CANCEL BUTTON_MENU
871 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
872 # define DEBUG_CANCEL BUTTON_PLAY
874 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
875 # define DEBUG_CANCEL BUTTON_REC
877 #elif CONFIG_KEYPAD == GIGABEAT_PAD
878 # define DEBUG_CANCEL BUTTON_A
880 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
881 # define DEBUG_CANCEL BUTTON_REW
883 #elif CONFIG_KEYPAD == SANSA_E200_PAD
884 # define DEBUG_CANCEL BUTTON_LEFT
885 #endif /* key definitios */
890 #if CONFIG_CPU == SH7034
891 unsigned short porta
;
892 unsigned short portb
;
895 int adc_battery_voltage
, adc_battery_level
;
897 lcd_setfont(FONT_SYSFIXED
);
898 lcd_setmargins(0, 0);
907 snprintf(buf
, 32, "PADR: %04x", porta
);
909 snprintf(buf
, 32, "PBDR: %04x", portb
);
912 snprintf(buf
, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
914 snprintf(buf
, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
916 snprintf(buf
, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
918 snprintf(buf
, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
921 battery_read_info(NULL
, &adc_battery_voltage
,
923 snprintf(buf
, 32, "Batt: %d.%02dV %d%% ", adc_battery_voltage
/ 100,
924 adc_battery_voltage
% 100, adc_battery_level
);
928 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
931 #elif defined(CPU_COLDFIRE)
932 unsigned int gpio_out
;
933 unsigned int gpio1_out
;
934 unsigned int gpio_read
;
935 unsigned int gpio1_read
;
936 unsigned int gpio_function
;
937 unsigned int gpio1_function
;
938 unsigned int gpio_enable
;
939 unsigned int gpio1_enable
;
940 int adc_buttons
, adc_remote
;
941 int adc_battery
, adc_battery_voltage
, adc_battery_level
;
945 lcd_setmargins(0, 0);
947 lcd_setfont(FONT_SYSFIXED
);
952 gpio_read
= GPIO_READ
;
953 gpio1_read
= GPIO1_READ
;
955 gpio1_out
= GPIO1_OUT
;
956 gpio_function
= GPIO_FUNCTION
;
957 gpio1_function
= GPIO1_FUNCTION
;
958 gpio_enable
= GPIO_ENABLE
;
959 gpio1_enable
= GPIO1_ENABLE
;
961 snprintf(buf
, sizeof(buf
), "GPIO_READ: %08x", gpio_read
);
962 lcd_puts(0, line
++, buf
);
963 snprintf(buf
, sizeof(buf
), "GPIO_OUT: %08x", gpio_out
);
964 lcd_puts(0, line
++, buf
);
965 snprintf(buf
, sizeof(buf
), "GPIO_FUNCTION: %08x", gpio_function
);
966 lcd_puts(0, line
++, buf
);
967 snprintf(buf
, sizeof(buf
), "GPIO_ENABLE: %08x", gpio_enable
);
968 lcd_puts(0, line
++, buf
);
970 snprintf(buf
, sizeof(buf
), "GPIO1_READ: %08x", gpio1_read
);
971 lcd_puts(0, line
++, buf
);
972 snprintf(buf
, sizeof(buf
), "GPIO1_OUT: %08x", gpio1_out
);
973 lcd_puts(0, line
++, buf
);
974 snprintf(buf
, sizeof(buf
), "GPIO1_FUNCTION: %08x", gpio1_function
);
975 lcd_puts(0, line
++, buf
);
976 snprintf(buf
, sizeof(buf
), "GPIO1_ENABLE: %08x", gpio1_enable
);
977 lcd_puts(0, line
++, buf
);
979 adc_buttons
= adc_read(ADC_BUTTONS
);
980 adc_remote
= adc_read(ADC_REMOTE
);
981 battery_read_info(&adc_battery
, &adc_battery_voltage
,
983 #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
984 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS (%c): %02x",
985 button_scan_enabled() ? '+' : '-', adc_buttons
);
987 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS: %02x", adc_buttons
);
989 lcd_puts(0, line
++, buf
);
990 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
991 snprintf(buf
, sizeof(buf
), "ADC_REMOTE (%c): %02x",
992 remote_detect() ? '+' : '-', adc_remote
);
994 snprintf(buf
, sizeof(buf
), "ADC_REMOTE: %02x", adc_remote
);
997 lcd_puts(0, line
++, buf
);
998 snprintf(buf
, sizeof(buf
), "ADC_BATTERY: %02x", adc_battery
);
999 lcd_puts(0, line
++, buf
);
1000 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1001 snprintf(buf
, sizeof(buf
), "ADC_REMOTEDETECT: %02x",
1002 adc_read(ADC_REMOTEDETECT
));
1003 lcd_puts(0, line
++, buf
);
1006 snprintf(buf
, 32, "Batt: %d.%02dV %d%% ", adc_battery_voltage
/ 100,
1007 adc_battery_voltage
% 100, adc_battery_level
);
1008 lcd_puts(0, line
++, buf
);
1010 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1011 snprintf(buf
, sizeof(buf
), "remotetype: %d", remote_type());
1012 lcd_puts(0, line
++, buf
);
1016 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1020 #elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5024
1022 unsigned int gpio_a
, gpio_b
, gpio_c
, gpio_d
;
1023 unsigned int gpio_e
, gpio_f
, gpio_g
, gpio_h
;
1024 unsigned int gpio_i
, gpio_j
, gpio_k
, gpio_l
;
1029 lcd_setmargins(0, 0);
1030 lcd_clear_display();
1031 lcd_setfont(FONT_SYSFIXED
);
1035 gpio_a
= GPIOA_INPUT_VAL
;
1036 gpio_b
= GPIOB_INPUT_VAL
;
1037 gpio_c
= GPIOC_INPUT_VAL
;
1039 gpio_g
= GPIOG_INPUT_VAL
;
1040 gpio_h
= GPIOH_INPUT_VAL
;
1041 gpio_i
= GPIOI_INPUT_VAL
;
1044 snprintf(buf
, sizeof(buf
), "GPIO_A: %02x GPIO_G: %02x", gpio_a
, gpio_g
);
1045 lcd_puts(0, line
++, buf
);
1046 snprintf(buf
, sizeof(buf
), "GPIO_B: %02x GPIO_H: %02x", gpio_b
, gpio_h
);
1047 lcd_puts(0, line
++, buf
);
1048 snprintf(buf
, sizeof(buf
), "GPIO_C: %02x GPIO_I: %02x", gpio_c
, gpio_i
);
1049 lcd_puts(0, line
++, buf
);
1052 gpio_d
= GPIOD_INPUT_VAL
;
1053 gpio_e
= GPIOE_INPUT_VAL
;
1054 gpio_f
= GPIOF_INPUT_VAL
;
1056 gpio_j
= GPIOJ_INPUT_VAL
;
1057 gpio_k
= GPIOK_INPUT_VAL
;
1058 gpio_l
= GPIOL_INPUT_VAL
;
1060 snprintf(buf
, sizeof(buf
), "GPIO_D: %02x GPIO_J: %02x", gpio_d
, gpio_j
);
1061 lcd_puts(0, line
++, buf
);
1062 snprintf(buf
, sizeof(buf
), "GPIO_E: %02x GPIO_K: %02x", gpio_e
, gpio_k
);
1063 lcd_puts(0, line
++, buf
);
1064 snprintf(buf
, sizeof(buf
), "GPIO_F: %02x GPIO_L: %02x", gpio_f
, gpio_l
);
1065 lcd_puts(0, line
++, buf
);
1066 #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1068 snprintf(buf
, sizeof(buf
), "ADC_BATTERY: %02x", adc_read(ADC_BATTERY
));
1069 lcd_puts(0, line
++, buf
);
1070 snprintf(buf
, sizeof(buf
), "ADC_UNKNOWN_1: %02x", adc_read(ADC_UNKNOWN_1
));
1071 lcd_puts(0, line
++, buf
);
1072 snprintf(buf
, sizeof(buf
), "ADC_REMOTE: %02x", adc_read(ADC_REMOTE
));
1073 lcd_puts(0, line
++, buf
);
1074 snprintf(buf
, sizeof(buf
), "ADC_SCROLLPAD: %02x", adc_read(ADC_SCROLLPAD
));
1075 lcd_puts(0, line
++, buf
);
1076 #elif defined(SANSA_E200)
1078 snprintf(buf
, sizeof(buf
), "ADC_BVDD: %02x", adc_read(ADC_BVDD
));
1079 lcd_puts(0, line
++, buf
);
1080 snprintf(buf
, sizeof(buf
), "ADC_RTCSUP: %02x", adc_read(ADC_RTCSUP
));
1081 lcd_puts(0, line
++, buf
);
1082 snprintf(buf
, sizeof(buf
), "ADC_UVDD: %02x", adc_read(ADC_UVDD
));
1083 lcd_puts(0, line
++, buf
);
1084 snprintf(buf
, sizeof(buf
), "ADC_CHG_IN: %02x", adc_read(ADC_CHG_IN
));
1085 lcd_puts(0, line
++, buf
);
1086 snprintf(buf
, sizeof(buf
), "ADC_CVDD: %02x", adc_read(ADC_CVDD
));
1087 lcd_puts(0, line
++, buf
);
1088 snprintf(buf
, sizeof(buf
), "ADC_BATTEMP: %02x", adc_read(ADC_BATTEMP
));
1089 lcd_puts(0, line
++, buf
);
1090 snprintf(buf
, sizeof(buf
), "ADC_MICSUP1: %02x", adc_read(ADC_MICSUP1
));
1091 lcd_puts(0, line
++, buf
);
1092 snprintf(buf
, sizeof(buf
), "ADC_MICSUP2: %02x", adc_read(ADC_MICSUP2
));
1093 lcd_puts(0, line
++, buf
);
1094 snprintf(buf
, sizeof(buf
), "ADC_VBE1: %02x", adc_read(ADC_VBE1
));
1095 lcd_puts(0, line
++, buf
);
1096 snprintf(buf
, sizeof(buf
), "ADC_VBE2: %02x", adc_read(ADC_VBE2
));
1097 lcd_puts(0, line
++, buf
);
1098 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP1: %02x", adc_read(ADC_I_MICSUP1
));
1099 lcd_puts(0, line
++, buf
);
1100 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP2: %02x", adc_read(ADC_I_MICSUP2
));
1101 lcd_puts(0, line
++, buf
);
1102 snprintf(buf
, sizeof(buf
), "ADC_VBAT: %02x", adc_read(ADC_VBAT
));
1103 lcd_puts(0, line
++, buf
);
1106 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1110 #elif CONFIG_CPU == PP5002
1111 unsigned int gpio_a
, gpio_b
, gpio_c
, gpio_d
;
1116 lcd_setmargins(0, 0);
1117 lcd_clear_display();
1118 lcd_setfont(FONT_SYSFIXED
);
1122 gpio_a
= GPIOA_INPUT_VAL
;
1123 gpio_b
= GPIOB_INPUT_VAL
;
1124 gpio_c
= GPIOC_INPUT_VAL
;
1125 gpio_d
= GPIOD_INPUT_VAL
;
1128 snprintf(buf
, sizeof(buf
), "GPIO_A: %02x GPIO_B: %02x", gpio_a
, gpio_b
);
1129 lcd_puts(0, line
++, buf
);
1130 snprintf(buf
, sizeof(buf
), "GPIO_C: %02x GPIO_D: %02x", gpio_c
, gpio_d
);
1131 lcd_puts(0, line
++, buf
);
1134 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1137 #elif CONFIG_CPU == S3C2440
1141 lcd_setmargins(0, 0);
1142 lcd_clear_display();
1143 lcd_setfont(FONT_SYSFIXED
);
1148 snprintf(buf
, sizeof(buf
), "[Ports and Registers]"); lcd_puts(0, line
++, buf
);
1150 snprintf(buf
, sizeof(buf
), "GPACON: %08x GPBCON: %08x", GPACON
, GPBCON
); lcd_puts(0, line
++, buf
);
1151 snprintf(buf
, sizeof(buf
), "GPADAT: %08x GPBDAT: %08x", GPADAT
, GPBDAT
); lcd_puts(0, line
++, buf
);
1152 snprintf(buf
, sizeof(buf
), "GPAUP: %08x GPBUP: %08x", 0, GPBUP
); lcd_puts(0, line
++, buf
);
1153 snprintf(buf
, sizeof(buf
), "GPCCON: %08x GPDCON: %08x", GPCCON
, GPDCON
); lcd_puts(0, line
++, buf
);
1154 snprintf(buf
, sizeof(buf
), "GPCDAT: %08x GPDDAT: %08x", GPCDAT
, GPDDAT
); lcd_puts(0, line
++, buf
);
1155 snprintf(buf
, sizeof(buf
), "GPCUP: %08x GPDUP: %08x", GPCUP
, GPDUP
); lcd_puts(0, line
++, buf
);
1157 snprintf(buf
, sizeof(buf
), "GPCCON: %08x GPDCON: %08x", GPCCON
, GPDCON
); lcd_puts(0, line
++, buf
);
1158 snprintf(buf
, sizeof(buf
), "GPCDAT: %08x GPDDAT: %08x", GPCDAT
, GPDDAT
); lcd_puts(0, line
++, buf
);
1159 snprintf(buf
, sizeof(buf
), "GPCUP: %08x GPDUP: %08x", GPCUP
, GPDUP
); lcd_puts(0, line
++, buf
);
1161 snprintf(buf
, sizeof(buf
), "GPECON: %08x GPFCON: %08x", GPECON
, GPFCON
); lcd_puts(0, line
++, buf
);
1162 snprintf(buf
, sizeof(buf
), "GPEDAT: %08x GPFDAT: %08x", GPEDAT
, GPFDAT
); lcd_puts(0, line
++, buf
);
1163 snprintf(buf
, sizeof(buf
), "GPEUP: %08x GPFUP: %08x", GPEUP
, GPFUP
); lcd_puts(0, line
++, buf
);
1165 snprintf(buf
, sizeof(buf
), "GPGCON: %08x GPHCON: %08x", GPGCON
, GPHCON
); lcd_puts(0, line
++, buf
);
1166 snprintf(buf
, sizeof(buf
), "GPGDAT: %08x GPHDAT: %08x", GPGDAT
, GPHDAT
); lcd_puts(0, line
++, buf
);
1167 snprintf(buf
, sizeof(buf
), "GPGUP: %08x GPHUP: %08x", GPGUP
, GPHUP
); lcd_puts(0, line
++, buf
);
1169 snprintf(buf
, sizeof(buf
), "GPJCON: %08x", GPJCON
); lcd_puts(0, line
++, buf
);
1170 snprintf(buf
, sizeof(buf
), "GPJDAT: %08x", GPJDAT
); lcd_puts(0, line
++, buf
);
1171 snprintf(buf
, sizeof(buf
), "GPJUP: %08x", GPJUP
); lcd_puts(0, line
++, buf
);
1175 snprintf(buf
, sizeof(buf
), "SRCPND: %08x INTMOD: %08x", SRCPND
, INTMOD
); lcd_puts(0, line
++, buf
);
1176 snprintf(buf
, sizeof(buf
), "INTMSK: %08x INTPND: %08x", INTMSK
, INTPND
); lcd_puts(0, line
++, buf
);
1177 snprintf(buf
, sizeof(buf
), "CLKCON: %08x CLKSLOW: %08x", CLKCON
, CLKSLOW
); lcd_puts(0, line
++, buf
);
1179 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1185 #else /* !HAVE_LCD_BITMAP */
1186 bool dbg_ports(void)
1188 unsigned short porta
;
1189 unsigned short portb
;
1190 unsigned char portc
;
1193 int adc_battery_voltage
;
1196 lcd_clear_display();
1207 snprintf(buf
, 32, "PADR: %04x", porta
);
1210 snprintf(buf
, 32, "PBDR: %04x", portb
);
1213 snprintf(buf
, 32, "AN0: %03x", adc_read(0));
1216 snprintf(buf
, 32, "AN1: %03x", adc_read(1));
1219 snprintf(buf
, 32, "AN2: %03x", adc_read(2));
1222 snprintf(buf
, 32, "AN3: %03x", adc_read(3));
1225 snprintf(buf
, 32, "AN4: %03x", adc_read(4));
1228 snprintf(buf
, 32, "AN5: %03x", adc_read(5));
1231 snprintf(buf
, 32, "AN6: %03x", adc_read(6));
1234 snprintf(buf
, 32, "AN7: %03x", adc_read(7));
1238 lcd_puts(0, 0, buf
);
1240 battery_read_info(NULL
, &adc_battery_voltage
, NULL
);
1241 snprintf(buf
, 32, "Batt: %d.%02dV", adc_battery_voltage
/ 100,
1242 adc_battery_voltage
% 100);
1243 lcd_puts(0, 1, buf
);
1246 button
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1250 case ACTION_STD_CANCEL
:
1251 action_signalscreenchange();
1254 case ACTION_SETTINGS_DEC
:
1260 case ACTION_SETTINGS_INC
:
1269 #endif /* !HAVE_LCD_BITMAP */
1270 #endif /* !SIMULATOR */
1272 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
1273 static bool dbg_cpufreq(void)
1279 #ifdef HAVE_LCD_BITMAP
1280 lcd_setmargins(0, 0);
1281 lcd_setfont(FONT_SYSFIXED
);
1283 lcd_clear_display();
1289 snprintf(buf
, sizeof(buf
), "Frequency: %ld", FREQ
);
1290 lcd_puts(0, line
++, buf
);
1292 snprintf(buf
, sizeof(buf
), "boost_counter: %d", get_cpu_boost_counter());
1293 lcd_puts(0, line
++, buf
);
1296 button
= get_action(CONTEXT_STD
,HZ
/10);
1300 case ACTION_STD_PREV
:
1304 case ACTION_STD_NEXT
:
1309 while (get_cpu_boost_counter() > 0)
1311 set_cpu_frequency(CPUFREQ_DEFAULT
);
1314 case ACTION_STD_CANCEL
:
1315 action_signalscreenchange();
1322 #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1325 #ifdef HAVE_LCD_BITMAP
1327 * view_battery() shows a automatically scaled graph of the battery voltage
1328 * over time. Usable for estimating battery life / charging rate.
1329 * The power_history array is updated in power_thread of powermgmt.c.
1332 #define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
1333 #define BAT_YSPACE (LCD_HEIGHT - 20)
1335 static bool view_battery(void)
1339 unsigned short maxv
, minv
;
1342 lcd_setmargins(0, 0);
1343 lcd_setfont(FONT_SYSFIXED
);
1347 lcd_clear_display();
1349 case 0: /* voltage history graph */
1350 /* Find maximum and minimum voltage for scaling */
1353 for (i
= 0; i
< BAT_LAST_VAL
; i
++) {
1354 if (power_history
[i
] > maxv
)
1355 maxv
= power_history
[i
];
1356 if (power_history
[i
] && (power_history
[i
] < minv
))
1358 minv
= power_history
[i
];
1362 if ((minv
< 1) || (minv
>= 65535))
1367 maxv
< 65535 ? maxv
++ : minv
--;
1369 snprintf(buf
, 30, "Battery %d.%02d", power_history
[0] / 100,
1370 power_history
[0] % 100);
1371 lcd_puts(0, 0, buf
);
1372 snprintf(buf
, 30, "scale %d.%02d-%d.%02d V",
1373 minv
/ 100, minv
% 100, maxv
/ 100, maxv
% 100);
1374 lcd_puts(0, 1, buf
);
1377 for (i
= BAT_LAST_VAL
- 1; i
>= 0; i
--) {
1378 y
= (power_history
[i
] - minv
) * BAT_YSPACE
/ (maxv
- minv
);
1379 lcd_set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
1380 lcd_vline(x
, LCD_HEIGHT
-1, 20);
1381 lcd_set_drawmode(DRMODE_SOLID
);
1382 lcd_vline(x
, LCD_HEIGHT
-1,
1383 MIN(MAX(LCD_HEIGHT
-1 - y
, 20), LCD_HEIGHT
-1));
1389 case 1: /* status: */
1390 lcd_puts(0, 0, "Power status:");
1392 battery_read_info(NULL
, &y
, NULL
);
1393 snprintf(buf
, 30, "Battery: %d.%02d V", y
/ 100, y
% 100);
1394 lcd_puts(0, 1, buf
);
1395 #ifdef ADC_EXT_POWER
1396 y
= (adc_read(ADC_EXT_POWER
) * EXT_SCALE_FACTOR
) / 10000;
1397 snprintf(buf
, 30, "External: %d.%02d V", y
/ 100, y
% 100);
1398 lcd_puts(0, 2, buf
);
1401 #if CONFIG_CHARGING == CHARGING_CONTROL
1402 snprintf(buf
, 30, "Chgr: %s %s",
1403 charger_inserted() ? "present" : "absent",
1404 charger_enabled
? "on" : "off");
1405 lcd_puts(0, 3, buf
);
1406 snprintf(buf
, 30, "short delta: %d", short_delta
);
1407 lcd_puts(0, 5, buf
);
1408 snprintf(buf
, 30, "long delta: %d", long_delta
);
1409 lcd_puts(0, 6, buf
);
1410 lcd_puts(0, 7, power_message
);
1411 snprintf(buf
, 30, "USB Inserted: %s",
1412 usb_inserted() ? "yes" : "no");
1413 lcd_puts(0, 8, buf
);
1414 #if defined IRIVER_H300_SERIES
1415 snprintf(buf
, 30, "USB Charging Enabled: %s",
1416 usb_charging_enabled() ? "yes" : "no");
1417 lcd_puts(0, 9, buf
);
1419 #else /* CONFIG_CHARGING != CHARGING_CONTROL */
1420 #if defined IPOD_NANO || defined IPOD_VIDEO
1421 int usb_pwr
= (GPIOL_INPUT_VAL
& 0x10)?true:false;
1422 int ext_pwr
= (GPIOL_INPUT_VAL
& 0x08)?false:true;
1423 int dock
= (GPIOA_INPUT_VAL
& 0x10)?true:false;
1424 int charging
= (GPIOB_INPUT_VAL
& 0x01)?false:true;
1425 int headphone
= (GPIOA_INPUT_VAL
& 0x80)?true:false;
1427 snprintf(buf
, 30, "USB pwr: %s",
1428 usb_pwr
? "present" : "absent");
1429 lcd_puts(0, 3, buf
);
1430 snprintf(buf
, 30, "EXT pwr: %s",
1431 ext_pwr
? "present" : "absent");
1432 lcd_puts(0, 4, buf
);
1433 snprintf(buf
, 30, "Battery: %s",
1434 charging
? "charging" : (usb_pwr
||ext_pwr
) ? "charged" : "discharging");
1435 lcd_puts(0, 5, buf
);
1436 snprintf(buf
, 30, "Dock mode: %s",
1437 dock
? "enabled" : "disabled");
1438 lcd_puts(0, 6, buf
);
1439 snprintf(buf
, 30, "Headphone: %s",
1440 headphone
? "connected" : "disconnected");
1441 lcd_puts(0, 7, buf
);
1443 snprintf(buf
, 30, "Charger: %s",
1444 charger_inserted() ? "present" : "absent");
1445 lcd_puts(0, 3, buf
);
1447 #endif /* CONFIG_CHARGING != CHARGING_CONTROL */
1448 #endif /* CONFIG_CHARGING */
1451 case 2: /* voltage deltas: */
1452 lcd_puts(0, 0, "Voltage deltas:");
1454 for (i
= 0; i
<= 6; i
++) {
1455 y
= power_history
[i
] - power_history
[i
+i
];
1456 snprintf(buf
, 30, "-%d min: %s%d.%02d V", i
,
1457 (y
< 0) ? "-" : "", ((y
< 0) ? y
* -1 : y
) / 100,
1458 ((y
< 0) ? y
* -1 : y
) % 100);
1459 lcd_puts(0, i
+1, buf
);
1463 case 3: /* remaining time estimation: */
1465 #if CONFIG_CHARGING == CHARGING_CONTROL
1466 snprintf(buf
, 30, "charge_state: %d", charge_state
);
1467 lcd_puts(0, 0, buf
);
1469 snprintf(buf
, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min
);
1470 lcd_puts(0, 1, buf
);
1472 snprintf(buf
, 30, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level
);
1473 lcd_puts(0, 2, buf
);
1475 snprintf(buf
, 30, "P=%2d I=%2d", pid_p
, pid_i
);
1476 lcd_puts(0, 3, buf
);
1478 snprintf(buf
, 30, "Trickle sec: %d/60", trickle_sec
);
1479 lcd_puts(0, 4, buf
);
1480 #endif /* CONFIG_CHARGING == CHARGING_CONTROL */
1482 snprintf(buf
, 30, "Last PwrHist: %d.%02d V",
1483 power_history
[0] / 100,
1484 power_history
[0] % 100);
1485 lcd_puts(0, 5, buf
);
1487 snprintf(buf
, 30, "battery level: %d%%", battery_level());
1488 lcd_puts(0, 6, buf
);
1490 snprintf(buf
, 30, "Est. remain: %d m", battery_time());
1491 lcd_puts(0, 7, buf
);
1497 switch(get_action(CONTEXT_SETTINGS
,HZ
/2))
1499 case ACTION_SETTINGS_DEC
:
1504 case ACTION_SETTINGS_INC
:
1509 case ACTION_STD_CANCEL
:
1510 action_signalscreenchange();
1517 #endif /* HAVE_LCD_BITMAP */
1522 static bool dbg_mmc_info(void)
1528 unsigned char pbuf
[32], pbuf2
[32];
1529 unsigned char card_name
[7];
1531 static const unsigned char i_vmin
[] = { 0, 1, 5, 10, 25, 35, 60, 100 };
1532 static const unsigned char i_vmax
[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
1533 static const unsigned char *kbit_units
[] = { "kBit/s", "MBit/s", "GBit/s" };
1534 static const unsigned char *nsec_units
[] = { "ns", "µs", "ms" };
1535 static const char *spec_vers
[] = { "1.0-1.2", "1.4", "2.0-2.2",
1536 "3.1-3.31", "4.0" };
1538 card_name
[6] = '\0';
1540 lcd_setmargins(0, 0);
1541 lcd_setfont(FONT_SYSFIXED
);
1545 card
= mmc_card_info(currval
/ 2);
1548 lcd_clear_display();
1549 snprintf(pbuf
, sizeof(pbuf
), "[MMC%d p%d]", currval
/ 2,
1551 lcd_puts(0, line
++, pbuf
);
1553 if (card
->initialized
)
1555 if (!(currval
% 2)) /* General info */
1559 strncpy(card_name
, ((unsigned char*)card
->cid
) + 3, 6);
1560 snprintf(pbuf
, sizeof(pbuf
), "%s Rev %d.%d", card_name
,
1561 (int) mmc_extract_bits(card
->cid
, 72, 4),
1562 (int) mmc_extract_bits(card
->cid
, 76, 4));
1563 lcd_puts(0, line
++, pbuf
);
1564 snprintf(pbuf
, sizeof(pbuf
), "Prod: %d/%d",
1565 (int) mmc_extract_bits(card
->cid
, 112, 4),
1566 (int) mmc_extract_bits(card
->cid
, 116, 4) + 1997);
1567 lcd_puts(0, line
++, pbuf
);
1568 snprintf(pbuf
, sizeof(pbuf
), "Ser#: 0x%08lx",
1569 mmc_extract_bits(card
->cid
, 80, 32));
1570 lcd_puts(0, line
++, pbuf
);
1571 snprintf(pbuf
, sizeof(pbuf
), "M=%02x, O=%04x",
1572 (int) mmc_extract_bits(card
->cid
, 0, 8),
1573 (int) mmc_extract_bits(card
->cid
, 8, 16));
1574 lcd_puts(0, line
++, pbuf
);
1575 temp
= mmc_extract_bits(card
->csd
, 2, 4);
1576 snprintf(pbuf
, sizeof(pbuf
), "MMC v%s", temp
< 5 ?
1577 spec_vers
[temp
] : "?.?");
1578 lcd_puts(0, line
++, pbuf
);
1579 snprintf(pbuf
, sizeof(pbuf
), "Blocks: 0x%06lx", card
->numblocks
);
1580 lcd_puts(0, line
++, pbuf
);
1581 snprintf(pbuf
, sizeof(pbuf
), "Blksz.: %d P:%c%c", card
->blocksize
,
1582 mmc_extract_bits(card
->csd
, 48, 1) ? 'R' : '-',
1583 mmc_extract_bits(card
->csd
, 106, 1) ? 'W' : '-');
1584 lcd_puts(0, line
++, pbuf
);
1586 else /* Technical details */
1588 output_dyn_value(pbuf2
, sizeof pbuf2
, card
->speed
/ 1000,
1590 snprintf(pbuf
, sizeof pbuf
, "Speed: %s", pbuf2
);
1591 lcd_puts(0, line
++, pbuf
);
1593 output_dyn_value(pbuf2
, sizeof pbuf2
, card
->tsac
,
1595 snprintf(pbuf
, sizeof pbuf
, "Tsac: %s", pbuf2
);
1596 lcd_puts(0, line
++, pbuf
);
1598 snprintf(pbuf
, sizeof(pbuf
), "Nsac: %d clk", card
->nsac
);
1599 lcd_puts(0, line
++, pbuf
);
1600 snprintf(pbuf
, sizeof(pbuf
), "R2W: *%d", card
->r2w_factor
);
1601 lcd_puts(0, line
++, pbuf
);
1602 snprintf(pbuf
, sizeof(pbuf
), "IRmax: %d..%d mA",
1603 i_vmin
[mmc_extract_bits(card
->csd
, 66, 3)],
1604 i_vmax
[mmc_extract_bits(card
->csd
, 69, 3)]);
1605 lcd_puts(0, line
++, pbuf
);
1606 snprintf(pbuf
, sizeof(pbuf
), "IWmax: %d..%d mA",
1607 i_vmin
[mmc_extract_bits(card
->csd
, 72, 3)],
1608 i_vmax
[mmc_extract_bits(card
->csd
, 75, 3)]);
1609 lcd_puts(0, line
++, pbuf
);
1613 lcd_puts(0, line
++, "Not found!");
1617 switch (get_action(CONTEXT_SETTINGS
,HZ
/2))
1619 case ACTION_STD_CANCEL
:
1623 case ACTION_SETTINGS_DEC
:
1629 case ACTION_SETTINGS_INC
:
1636 action_signalscreenchange();
1639 #else /* !HAVE_MMC */
1640 static bool dbg_disk_info(void)
1646 const int max_page
= 11;
1647 unsigned short* identify_info
= ata_get_identify();
1648 bool timing_info_present
= false;
1649 char pio3
[2], pio4
[2];
1651 lcd_setmargins(0, 0);
1657 lcd_clear_display();
1658 #ifdef HAVE_LCD_BITMAP
1659 lcd_puts(0, y
++, "Disk info:");
1665 for (i
=0; i
< 20; i
++)
1666 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+27]);
1668 /* kill trailing space */
1669 for (i
=39; i
&& buf
[i
]==' '; i
--)
1671 lcd_puts(0, y
++, "Model");
1672 lcd_puts_scroll(0, y
++, buf
);
1676 for (i
=0; i
< 4; i
++)
1677 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+23]);
1679 lcd_puts(0, y
++, "Firmware");
1680 lcd_puts(0, y
++, buf
);
1684 snprintf(buf
, sizeof buf
, "%ld MB",
1685 ((unsigned long)identify_info
[61] << 16 |
1686 (unsigned long)identify_info
[60]) / 2048 );
1687 lcd_puts(0, y
++, "Size");
1688 lcd_puts(0, y
++, buf
);
1693 fat_size( IF_MV2(0,) NULL
, &free
);
1694 snprintf(buf
, sizeof buf
, "%ld MB", free
/ 1024 );
1695 lcd_puts(0, y
++, "Free");
1696 lcd_puts(0, y
++, buf
);
1701 snprintf(buf
, sizeof buf
, "%d ms", ata_spinup_time
* (1000/HZ
));
1702 lcd_puts(0, y
++, "Spinup time");
1703 lcd_puts(0, y
++, buf
);
1707 i
= identify_info
[83] & (1<<3);
1708 lcd_puts(0, y
++, "Power mgmt:");
1709 lcd_puts(0, y
++, i
? "enabled" : "unsupported");
1713 i
= identify_info
[83] & (1<<9);
1714 lcd_puts(0, y
++, "Noise mgmt:");
1715 lcd_puts(0, y
++, i
? "enabled" : "unsupported");
1719 i
= identify_info
[82] & (1<<6);
1720 lcd_puts(0, y
++, "Read-ahead:");
1721 lcd_puts(0, y
++, i
? "enabled" : "unsupported");
1725 timing_info_present
= identify_info
[53] & (1<<1);
1726 if(timing_info_present
) {
1729 lcd_puts(0, y
++, "PIO modes:");
1730 pio3
[0] = (identify_info
[64] & (1<<0)) ? '3' : 0;
1731 pio4
[0] = (identify_info
[64] & (1<<1)) ? '4' : 0;
1732 snprintf(buf
, 128, "0 1 2 %s %s", pio3
, pio4
);
1733 lcd_puts(0, y
++, buf
);
1735 lcd_puts(0, y
++, "No PIO mode info");
1740 timing_info_present
= identify_info
[53] & (1<<1);
1741 if(timing_info_present
) {
1742 lcd_puts(0, y
++, "Cycle times");
1743 snprintf(buf
, 128, "%dns/%dns",
1746 lcd_puts(0, y
++, buf
);
1748 lcd_puts(0, y
++, "No timing info");
1753 timing_info_present
= identify_info
[53] & (1<<1);
1754 if(timing_info_present
) {
1755 i
= identify_info
[49] & (1<<11);
1756 snprintf(buf
, 128, "IORDY support: %s", i
? "yes" : "no");
1757 lcd_puts(0, y
++, buf
);
1758 i
= identify_info
[49] & (1<<10);
1759 snprintf(buf
, 128, "IORDY disable: %s", i
? "yes" : "no");
1760 lcd_puts(0, y
++, buf
);
1762 lcd_puts(0, y
++, "No timing info");
1767 lcd_puts(0, y
++, "Cluster size");
1768 snprintf(buf
, 128, "%d bytes", fat_get_cluster_size(IF_MV(0)));
1769 lcd_puts(0, y
++, buf
);
1774 /* Wait for a key to be pushed */
1775 key
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1777 case ACTION_STD_CANCEL
:
1781 case ACTION_SETTINGS_DEC
:
1786 case ACTION_SETTINGS_INC
:
1787 if (++page
> max_page
)
1793 action_signalscreenchange();
1796 #endif /* !HAVE_MMC */
1797 #endif /* !SIMULATOR */
1799 #ifdef HAVE_DIRCACHE
1800 static bool dbg_dircache_info(void)
1806 lcd_setmargins(0, 0);
1807 lcd_setfont(FONT_SYSFIXED
);
1813 lcd_clear_display();
1814 snprintf(buf
, sizeof(buf
), "Cache initialized: %s",
1815 dircache_is_enabled() ? "Yes" : "No");
1816 lcd_puts(0, line
++, buf
);
1818 snprintf(buf
, sizeof(buf
), "Cache size: %d B",
1819 dircache_get_cache_size());
1820 lcd_puts(0, line
++, buf
);
1822 snprintf(buf
, sizeof(buf
), "Last size: %d B",
1823 global_status
.dircache_size
);
1824 lcd_puts(0, line
++, buf
);
1826 snprintf(buf
, sizeof(buf
), "Limit: %d B", DIRCACHE_LIMIT
);
1827 lcd_puts(0, line
++, buf
);
1829 snprintf(buf
, sizeof(buf
), "Reserve: %d/%d B",
1830 dircache_get_reserve_used(), DIRCACHE_RESERVE
);
1831 lcd_puts(0, line
++, buf
);
1833 snprintf(buf
, sizeof(buf
), "Scanning took: %d s",
1834 dircache_get_build_ticks() / HZ
);
1835 lcd_puts(0, line
++, buf
);
1837 snprintf(buf
, sizeof(buf
), "Entry count: %d",
1838 dircache_get_entry_count());
1839 lcd_puts(0, line
++, buf
);
1843 if (action_userabort(HZ
/2))
1850 #endif /* HAVE_DIRCACHE */
1852 #ifdef HAVE_LCD_BITMAP
1853 #ifdef HAVE_TAGCACHE
1854 static bool dbg_tagcache_info(void)
1859 struct tagcache_stat
*stat
;
1861 lcd_setmargins(0, 0);
1862 lcd_setfont(FONT_SYSFIXED
);
1868 lcd_clear_display();
1869 stat
= tagcache_get_stat();
1870 snprintf(buf
, sizeof(buf
), "Initialized: %s", stat
->initialized
? "Yes" : "No");
1871 lcd_puts(0, line
++, buf
);
1872 snprintf(buf
, sizeof(buf
), "DB Ready: %s", stat
->ready
? "Yes" : "No");
1873 lcd_puts(0, line
++, buf
);
1874 snprintf(buf
, sizeof(buf
), "RAM Cache: %s", stat
->ramcache
? "Yes" : "No");
1875 lcd_puts(0, line
++, buf
);
1876 snprintf(buf
, sizeof(buf
), "RAM: %d/%d B",
1877 stat
->ramcache_used
, stat
->ramcache_allocated
);
1878 lcd_puts(0, line
++, buf
);
1879 snprintf(buf
, sizeof(buf
), "Progress: %d%% (%d entries)",
1880 stat
->progress
, stat
->processed_entries
);
1881 lcd_puts(0, line
++, buf
);
1882 snprintf(buf
, sizeof(buf
), "Commit step: %d", stat
->commit_step
);
1883 lcd_puts(0, line
++, buf
);
1884 snprintf(buf
, sizeof(buf
), "Commit delayed: %s",
1885 stat
->commit_delayed
? "Yes" : "No");
1886 lcd_puts(0, line
++, buf
);
1890 if (action_userabort(HZ
/2))
1899 #if CONFIG_CPU == SH7034
1900 static bool dbg_save_roms(void)
1903 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
1905 fd
= creat("/internal_rom_0000-FFFF.bin");
1908 write(fd
, (void *)0, 0x10000);
1912 fd
= creat("/internal_rom_2000000-203FFFF.bin");
1915 write(fd
, (void *)0x2000000, 0x40000);
1919 system_memory_guard(oldmode
);
1922 #elif defined CPU_COLDFIRE
1923 static bool dbg_save_roms(void)
1926 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
1928 #if defined(IRIVER_H100_SERIES)
1929 fd
= creat("/internal_rom_000000-1FFFFF.bin");
1930 #elif defined(IRIVER_H300_SERIES)
1931 fd
= creat("/internal_rom_000000-3FFFFF.bin");
1932 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
1933 fd
= creat("/internal_rom_000000-3FFFFF.bin");
1937 write(fd
, (void *)0, FLASH_SIZE
);
1940 system_memory_guard(oldmode
);
1943 fd
= creat("/internal_eeprom.bin");
1947 char buf
[EEPROM_SIZE
];
1950 old_irq_level
= set_irq_level(HIGHEST_IRQ_LEVEL
);
1952 err
= eeprom_24cxx_read(0, buf
, sizeof buf
);
1954 gui_syncsplash(HZ
*3, "Eeprom read failure (%d)",err
);
1957 write(fd
, buf
, sizeof buf
);
1960 set_irq_level(old_irq_level
);
1968 #elif defined(CPU_PP) && !defined(SANSA_E200)
1969 static bool dbg_save_roms(void)
1973 fd
= creat("/internal_rom_000000-0FFFFF.bin");
1976 write(fd
, (void *)0x20000000, FLASH_SIZE
);
1986 static bool dbg_fm_radio(void)
1991 lcd_setmargins(0, 0);
1997 lcd_clear_display();
1998 fm_detected
= radio_hardware_present();
2000 snprintf(buf
, sizeof buf
, "HW detected: %s", fm_detected
?"yes":"no");
2001 lcd_puts(0, row
++, buf
);
2003 #if (CONFIG_TUNER & S1A0903X01)
2004 snprintf(buf
, sizeof buf
, "Samsung regs: %08X",
2005 samsung_get(RADIO_ALL
));
2006 lcd_puts(0, row
++, buf
);
2008 #if (CONFIG_TUNER & TEA5767)
2010 struct philips_dbg_info info
;
2011 philips_dbg_info(&info
);
2013 snprintf(buf
, sizeof buf
, "Philips regs:");
2014 lcd_puts(0, row
++, buf
);
2016 snprintf(buf
, sizeof buf
, " Read: %02X %02X %02X %02X %02X",
2017 (unsigned)info
.read_regs
[0], (unsigned)info
.read_regs
[1],
2018 (unsigned)info
.read_regs
[2], (unsigned)info
.read_regs
[3],
2019 (unsigned)info
.read_regs
[4]);
2020 lcd_puts(0, row
++, buf
);
2022 snprintf(buf
, sizeof buf
, " Write: %02X %02X %02X %02X %02X",
2023 (unsigned)info
.write_regs
[0], (unsigned)info
.write_regs
[1],
2024 (unsigned)info
.write_regs
[2], (unsigned)info
.write_regs
[3],
2025 (unsigned)info
.write_regs
[4]);
2026 lcd_puts(0, row
++, buf
);
2031 if (action_userabort(HZ
))
2036 #endif /* CONFIG_TUNER */
2037 #endif /* !SIMULATOR */
2039 #ifdef HAVE_LCD_BITMAP
2040 extern bool do_screendump_instead_of_usb
;
2042 static bool dbg_screendump(void)
2044 do_screendump_instead_of_usb
= !do_screendump_instead_of_usb
;
2045 gui_syncsplash(HZ
, "Screendump %s",
2046 do_screendump_instead_of_usb
?"enabled":"disabled");
2049 #endif /* HAVE_LCD_BITMAP */
2051 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2052 static bool dbg_set_memory_guard(void)
2054 static const struct opt_items names
[MAXMEMGUARD
] = {
2056 { "Flash ROM writes", -1 },
2057 { "Zero area (all)", -1 }
2059 int mode
= system_memory_guard(MEMGUARD_KEEP
);
2061 set_option( "Catch mem accesses", &mode
, INT
, names
, MAXMEMGUARD
, NULL
);
2062 system_memory_guard(mode
);
2066 #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
2068 #if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
2070 extern volatile bool lcd_poweroff
;
2072 static bool dbg_lcd_power_off(void)
2074 lcd_setmargins(0, 0);
2080 lcd_clear_display();
2081 lcd_puts(0, 0, "LCD Power Off");
2083 lcd_puts(1, 1, "Yes");
2085 lcd_puts(1, 1, "No");
2089 button
= get_action(CONTEXT_STD
,HZ
/5);
2092 case ACTION_STD_PREV
:
2093 case ACTION_STD_NEXT
:
2094 lcd_poweroff
= !lcd_poweroff
;
2097 case ACTION_STD_CANCEL
:
2098 action_signalscreenchange();
2109 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2110 static bool dbg_write_eeprom(void)
2115 char buf
[EEPROM_SIZE
];
2118 fd
= open("/internal_eeprom.bin", O_RDONLY
);
2122 rc
= read(fd
, buf
, EEPROM_SIZE
);
2124 if(rc
== EEPROM_SIZE
)
2126 old_irq_level
= set_irq_level(HIGHEST_IRQ_LEVEL
);
2128 err
= eeprom_24cxx_write(0, buf
, sizeof buf
);
2130 gui_syncsplash(HZ
*3, "Eeprom write failure (%d)",err
);
2132 gui_syncsplash(HZ
*3, "Eeprom written successfully");
2134 set_irq_level(old_irq_level
);
2138 gui_syncsplash(HZ
*3, "File read error (%d)",rc
);
2144 gui_syncsplash(HZ
*3, "Failed to open 'internal_eeprom.bin'");
2149 #endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
2150 #ifdef CPU_BOOST_LOGGING
2151 static bool cpu_boost_log(void)
2154 int count
= cpu_boost_log_getcount();
2155 int lines
= LCD_HEIGHT
/SYSFONT_HEIGHT
;
2158 lcd_setmargins(0, 0);
2159 lcd_setfont(FONT_SYSFIXED
);
2160 str
= cpu_boost_log_getlog_first();
2163 lcd_clear_display();
2164 for(j
=0; j
<lines
; j
++,i
++)
2167 str
= cpu_boost_log_getlog_next();
2176 action_signalscreenchange();
2179 switch(get_action(CONTEXT_STD
,TIMEOUT_BLOCK
))
2182 case ACTION_STD_PREV
:
2183 case ACTION_STD_NEXT
:
2186 case ACTION_STD_CANCEL
:
2193 get_action(CONTEXT_STD
,TIMEOUT_BLOCK
);
2194 lcd_setfont(FONT_UI
);
2195 action_signalscreenchange();
2202 /****** The menu *********/
2203 struct the_menu_item
{
2204 unsigned char *desc
; /* string or ID */
2205 bool (*function
) (void); /* return true if USB was connected */
2207 static const struct the_menu_item menuitems
[] = {
2208 #if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
2209 { "LCD Power Off", dbg_lcd_power_off
},
2211 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2212 (defined(CPU_PP) && !defined(SANSA_E200))
2213 { "Dump ROM contents", dbg_save_roms
},
2215 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) || CONFIG_CPU == S3C2440
2216 { "View I/O ports", dbg_ports
},
2218 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
2219 { "CPU frequency", dbg_cpufreq
},
2221 #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
2222 { "S/PDIF analyzer", dbg_spdif
},
2224 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2225 { "Catch mem accesses", dbg_set_memory_guard
},
2228 { "View OS stacks", dbg_os
},
2230 #ifdef HAVE_LCD_BITMAP
2232 { "View battery", view_battery
},
2234 { "Screendump", dbg_screendump
},
2237 { "View HW info", dbg_hw_info
},
2240 { "View partitions", dbg_partitions
},
2244 { "View MMC info", dbg_mmc_info
},
2246 { "View disk info", dbg_disk_info
},
2249 #ifdef HAVE_DIRCACHE
2250 { "View dircache info", dbg_dircache_info
},
2252 #ifdef HAVE_LCD_BITMAP
2253 #ifdef HAVE_TAGCACHE
2254 { "View database info", dbg_tagcache_info
},
2256 #if CONFIG_CODEC == SWCODEC || !defined(SIMULATOR)
2257 { "View audio thread", dbg_audio_thread
},
2260 { "pm histogram", peak_meter_histogram
},
2261 #endif /* PM_DEBUG */
2262 #endif /* HAVE_LCD_BITMAP */
2265 { "FM Radio", dbg_fm_radio
},
2268 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2269 { "Write back EEPROM", dbg_write_eeprom
},
2271 #ifdef ROCKBOX_HAS_LOGF
2272 {"logf", logfdisplay
},
2273 {"logfdump", logfdump
},
2275 #ifdef CPU_BOOST_LOGGING
2276 {"cpu_boost log",cpu_boost_log
},
2279 static int menu_action_callback(int btn
, struct gui_synclist
*lists
)
2281 if (btn
== ACTION_STD_OK
)
2283 menuitems
[gui_synclist_get_sel_pos(lists
)].function();
2284 gui_synclist_draw(lists
);
2288 static char* dbg_menu_getname(int item
, void * data
, char *buffer
)
2290 (void)data
; (void)buffer
;
2291 return menuitems
[item
].desc
;
2293 bool debug_menu(void)
2295 dbg_list("Debug Menu",ARRAYLEN(menuitems
) , 1,
2296 menu_action_callback
,