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 #endif /* SIMULATOR */
121 /*---------------------------------------------------*/
122 /* SPECIAL DEBUG STUFF */
123 /*---------------------------------------------------*/
124 extern int ata_device
;
125 extern int ata_io_address
;
126 extern struct thread_entry threads
[MAXTHREADS
];
130 static char thread_status_char(int status
)
134 case STATE_RUNNING
: return 'R';
135 case STATE_BLOCKED
: return 'B';
136 case STATE_SLEEPING
: return 'S';
137 case STATE_BLOCKED_W_TMO
: return 'T';
143 #define IF_COP2(...) __VA_ARGS__
147 static char* threads_getname(int selected_item
, void * data
, char *buffer
)
150 struct thread_entry
*thread
= NULL
;
152 thread
= &threads
[selected_item
];
154 if (thread
->name
== NULL
)
156 snprintf(buffer
, MAX_PATH
, "%2d: ---", selected_item
);
160 usage
= thread_stack_usage(thread
);
161 status
= thread_get_status(thread
);
162 #ifdef HAVE_PRIORITY_SCHEDULING
163 snprintf(buffer
, MAX_PATH
, "%2d: " IF_COP2("(%d) ") "%c%c %d %2d%% %s",
165 IF_COP2(thread
->core
,)
166 (status
== STATE_RUNNING
) ? '*' : ' ',
167 thread_status_char(status
),
169 usage
, thread
->name
);
171 snprintf(buffer
, MAX_PATH
, "%2d: " IF_COP2("(%d) ") "%c%c %2d%% %s",
173 IF_COP2(thread
->core
,)
174 (status
== STATE_RUNNING
) ? '*' : ' ',
175 thread_status_char(status
),
176 usage
, thread
->name
);
180 static int dbg_threads_action_callback(int action
, struct gui_synclist
*lists
)
182 #ifdef ROCKBOX_HAS_LOGF
183 if (action
== ACTION_STD_OK
)
185 struct thread_entry
*thread
= &threads
[gui_synclist_get_sel_pos(lists
)];
186 if (thread
->name
!= NULL
)
187 remove_thread(thread
);
190 gui_synclist_draw(lists
);
194 static bool dbg_os(void)
196 return dbg_list(IF_COP2("Core and ") "Stack usage:", MAXTHREADS
, 1,
197 dbg_threads_action_callback
, threads_getname
);
199 #endif /* !SIMULATOR */
201 #ifdef HAVE_LCD_BITMAP
202 #if CONFIG_CODEC != SWCODEC
204 static bool dbg_audio_thread(void)
207 struct audio_debug d
;
209 lcd_setmargins(0, 0);
210 lcd_setfont(FONT_SYSFIXED
);
214 if (action_userabort(HZ
/5))
217 audio_get_debugdata(&d
);
221 snprintf(buf
, sizeof(buf
), "read: %x", d
.audiobuf_read
);
223 snprintf(buf
, sizeof(buf
), "write: %x", d
.audiobuf_write
);
225 snprintf(buf
, sizeof(buf
), "swap: %x", d
.audiobuf_swapwrite
);
227 snprintf(buf
, sizeof(buf
), "playing: %d", d
.playing
);
229 snprintf(buf
, sizeof(buf
), "playable: %x", d
.playable_space
);
231 snprintf(buf
, sizeof(buf
), "unswapped: %x", d
.unswapped_space
);
234 /* Playable space left */
235 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8, 112, 4, d
.audiobuflen
, 0,
236 d
.playable_space
, HORIZONTAL
);
238 /* Show the watermark limit */
239 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8+4, 112, 4, d
.audiobuflen
, 0,
240 d
.low_watermark_level
, HORIZONTAL
);
242 snprintf(buf
, sizeof(buf
), "wm: %x - %x",
243 d
.low_watermark_level
, d
.lowest_watermark_level
);
250 #endif /* !SIMULATOR */
251 #else /* CONFIG_CODEC == SWCODEC */
252 extern size_t filebuflen
;
253 /* This is a size_t, but call it a long so it puts a - when it's bad. */
255 static unsigned int ticks
, boost_ticks
;
257 static void dbg_audio_task(void)
260 if(FREQ
> CPUFREQ_NORMAL
)
267 static bool dbg_audio_thread(void)
274 size_t bufsize
= pcmbuf_get_bufsize();
275 int pcmbufdescs
= pcmbuf_descs();
277 ticks
= boost_ticks
= 0;
279 tick_add_task(dbg_audio_task
);
281 lcd_setmargins(0, 0);
282 lcd_setfont(FONT_SYSFIXED
);
285 button
= get_action(CONTEXT_STD
,HZ
/5);
288 case ACTION_STD_NEXT
:
291 case ACTION_STD_PREV
:
294 case ACTION_STD_CANCEL
:
298 action_signalscreenchange();
303 bufused
= bufsize
- pcmbuf_free();
305 snprintf(buf
, sizeof(buf
), "pcm: %7ld/%7ld", (long) bufused
, (long) bufsize
);
306 lcd_puts(0, line
++, buf
);
308 /* Playable space left */
309 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6, bufsize
, 0, bufused
, HORIZONTAL
);
312 snprintf(buf
, sizeof(buf
), "codec: %8ld/%8ld", audio_filebufused(), (long) filebuflen
);
313 lcd_puts(0, line
++, buf
);
315 /* Playable space left */
316 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6, filebuflen
, 0,
317 audio_filebufused(), HORIZONTAL
);
320 snprintf(buf
, sizeof(buf
), "track count: %2d", audio_track_count());
321 lcd_puts(0, line
++, buf
);
324 snprintf(buf
, sizeof(buf
), "cpu freq: %3dMHz",
325 (int)((FREQ
+ 500000) / 1000000));
326 lcd_puts(0, line
++, buf
);
329 snprintf(buf
, sizeof(buf
), "boost ratio: %3d%%",
330 boost_ticks
* 100 / ticks
);
331 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)) && !defined(SIMULATOR)
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) && !SIMULATOR */
405 #ifdef HAVE_LCD_BITMAP
406 static bool dbg_hw_info(void)
408 #if CONFIG_CPU == SH7034
412 int bitmask
= *(unsigned short*)0x20000fc;
413 int rom_version
= *(unsigned short*)0x20000fe;
414 unsigned manu
, id
; /* flash IDs */
415 bool got_id
; /* flag if we managed to get the flash IDs */
416 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
417 bool has_bootrom
; /* flag for boot ROM present */
418 int oldmode
; /* saved memory guard mode */
420 #ifdef USB_ENABLE_ONDIOSTYLE
425 usb_polarity
= 0; /* Negative */
427 usb_polarity
= 1; /* Positive */
430 pr_polarity
= 0; /* Negative */
432 pr_polarity
= 1; /* Positive */
434 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
436 /* get flash ROM type */
437 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
439 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
441 /* check if the boot ROM area is a flash mirror */
442 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
443 if (has_bootrom
) /* if ROM and Flash different */
445 /* calculate CRC16 checksum of boot ROM */
446 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
449 system_memory_guard(oldmode
); /* re-enable memory guard */
451 lcd_setmargins(0, 0);
452 lcd_setfont(FONT_SYSFIXED
);
455 lcd_puts(0, 0, "[Hardware info]");
457 snprintf(buf
, 32, "ROM: %d.%02d", rom_version
/100, rom_version
%100);
460 snprintf(buf
, 32, "Mask: 0x%04x", bitmask
);
463 snprintf(buf
, 32, "USB: %s", usb_polarity
?"positive":"negative");
466 snprintf(buf
, 32, "PR: %s", pr_polarity
?"positive":"negative");
470 snprintf(buf
, 32, "Flash: M=%02x D=%02x", manu
, id
);
472 snprintf(buf
, 32, "Flash: M=?? D=??"); /* unknown, sorry */
477 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
478 snprintf(buf
, 32, "Boot ROM: V1");
480 snprintf(buf
, 32, "ROMcrc: 0x%08x", rom_crc
);
484 snprintf(buf
, 32, "Boot ROM: none");
488 #ifndef HAVE_MMC /* have ATA */
489 snprintf(buf
, 32, "ATA: 0x%x,%s", ata_io_address
,
490 ata_device
? "slave":"master");
497 if (action_userabort(TIMEOUT_BLOCK
))
500 #elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
502 unsigned manu
, id
; /* flash IDs */
503 int got_id
; /* flag if we managed to get the flash IDs */
504 int oldmode
; /* saved memory guard mode */
507 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
509 /* get flash ROM type */
510 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
512 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
514 system_memory_guard(oldmode
); /* re-enable memory guard */
516 lcd_setmargins(0, 0);
517 lcd_setfont(FONT_SYSFIXED
);
520 lcd_puts(0, line
++, "[Hardware info]");
523 snprintf(buf
, 32, "Flash: M=%04x D=%04x", manu
, id
);
525 snprintf(buf
, 32, "Flash: M=???? D=????"); /* unknown, sorry */
526 lcd_puts(0, line
++, buf
);
532 lcd_puts(0, ++line
, "Serial Number:");
534 got_id
= ds2411_read_id(&id
);
536 if (got_id
== DS2411_OK
)
538 snprintf(buf
, 32, " FC=%02x", (unsigned)id
.family_code
);
539 lcd_puts(0, ++line
, buf
);
540 snprintf(buf
, 32, " ID=%02X %02X %02X %02X %02X %02X",
541 (unsigned)id
.uid
[0], (unsigned)id
.uid
[1], (unsigned)id
.uid
[2],
542 (unsigned)id
.uid
[3], (unsigned)id
.uid
[4], (unsigned)id
.uid
[5]);
543 lcd_puts(0, ++line
, buf
);
544 snprintf(buf
, 32, " CRC=%02X", (unsigned)id
.crc
);
548 snprintf(buf
, 32, "READ ERR=%d", got_id
);
551 lcd_puts(0, ++line
, buf
);
559 if (action_userabort(TIMEOUT_BLOCK
))
562 #elif CONFIG_CPU == PP5020
564 char pp_version
[] = { (PP_VER2
>> 24) & 0xff, (PP_VER2
>> 16) & 0xff,
565 (PP_VER2
>> 8) & 0xff, (PP_VER2
) & 0xff,
566 (PP_VER1
>> 24) & 0xff, (PP_VER1
>> 16) & 0xff,
567 (PP_VER1
>> 8) & 0xff, (PP_VER1
) & 0xff, '\0' };
569 lcd_setmargins(0, 0);
570 lcd_setfont(FONT_SYSFIXED
);
573 lcd_puts(0, 0, "[Hardware info]");
575 snprintf(buf
, sizeof(buf
), "HW rev: 0x%08x", ipod_hw_rev
);
578 snprintf(buf
, sizeof(buf
), "PP version: %s", pp_version
);
584 if (action_userabort(TIMEOUT_BLOCK
))
587 #endif /* CONFIG_CPU */
590 #else /* !HAVE_LCD_BITMAP */
591 static bool dbg_hw_info(void)
597 int bitmask
= *(unsigned short*)0x20000fc;
598 int rom_version
= *(unsigned short*)0x20000fe;
599 unsigned manu
, id
; /* flash IDs */
600 bool got_id
; /* flag if we managed to get the flash IDs */
601 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
602 bool has_bootrom
; /* flag for boot ROM present */
603 int oldmode
; /* saved memory guard mode */
606 usb_polarity
= 0; /* Negative */
608 usb_polarity
= 1; /* Positive */
610 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
612 /* get flash ROM type */
613 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
615 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
617 /* check if the boot ROM area is a flash mirror */
618 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
619 if (has_bootrom
) /* if ROM and Flash different */
621 /* calculate CRC16 checksum of boot ROM */
622 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
625 system_memory_guard(oldmode
); /* re-enable memory guard */
629 lcd_puts(0, 0, "[HW Info]");
635 snprintf(buf
, 32, "ROM: %d.%02d",
636 rom_version
/100, rom_version
%100);
639 snprintf(buf
, 32, "USB: %s",
640 usb_polarity
?"pos":"neg");
643 snprintf(buf
, 32, "ATA: 0x%x%s",
644 ata_io_address
, ata_device
? "s":"m");
647 snprintf(buf
, 32, "Mask: %04x", bitmask
);
651 snprintf(buf
, 32, "Flash:%02x,%02x", manu
, id
);
653 snprintf(buf
, 32, "Flash:??,??"); /* unknown, sorry */
658 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
659 snprintf(buf
, 32, "BootROM: V1");
660 else if (rom_crc
== 0x358099E8)
661 snprintf(buf
, 32, "BootROM: V2");
662 /* alternative boot ROM found in one single player so far */
664 snprintf(buf
, 32, "R: %08x", rom_crc
);
667 snprintf(buf
, 32, "BootROM: no");
673 button
= get_action(CONTEXT_SETTINGS
,TIMEOUT_BLOCK
);
677 case ACTION_STD_CANCEL
:
678 action_signalscreenchange();
681 case ACTION_SETTINGS_DEC
:
687 case ACTION_SETTINGS_INC
:
696 #endif /* !HAVE_LCD_BITMAP */
697 #endif /* !SIMULATOR */
700 static char* dbg_partitions_getname(int selected_item
, void * data
, char *buffer
)
703 int partition
= selected_item
/2;
704 struct partinfo
* p
= disk_partinfo(partition
);
707 snprintf(buffer
, MAX_PATH
, "T:%x %ld MB", p
->type
, p
->size
/ 2048);
711 snprintf(buffer
, MAX_PATH
, "P%d: S:%lx", partition
, p
->start
);
716 bool dbg_partitions(void)
718 return dbg_list("Partition Info", 4, 2,
719 NULL
, dbg_partitions_getname
);
723 #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
724 static bool dbg_spdif(void)
728 unsigned int control
;
733 unsigned int interruptstat
;
734 bool valnogood
, symbolerr
, parityerr
;
737 int spdif_source
= spdif_get_output_source(&spdif_src_on
);
738 spdif_set_output_source(AUDIO_SRC_SPDIF
, true);
740 lcd_setmargins(0, 0);
742 lcd_setfont(FONT_SYSFIXED
);
744 #ifdef HAVE_SPDIF_POWER
745 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
752 control
= EBU1RCVCCHANNEL1
;
753 interruptstat
= INTERRUPTSTAT
;
754 INTERRUPTCLEAR
= 0x03c00000;
756 valnogood
= (interruptstat
& 0x01000000)?true:false;
757 symbolerr
= (interruptstat
& 0x00800000)?true:false;
758 parityerr
= (interruptstat
& 0x00400000)?true:false;
760 snprintf(buf
, sizeof(buf
), "Val: %s Sym: %s Par: %s",
763 parityerr
?"--":"OK");
764 lcd_puts(0, line
++, buf
);
766 snprintf(buf
, sizeof(buf
), "Status word: %08x", (int)control
);
767 lcd_puts(0, line
++, buf
);
772 snprintf(buf
, sizeof(buf
), "PRO: %d (%s)",
773 x
, x
?"Professional":"Consumer");
774 lcd_puts(0, line
++, buf
);
776 x
= (control
>> 30) & 1;
777 snprintf(buf
, sizeof(buf
), "Audio: %d (%s)",
778 x
, x
?"Non-PCM":"PCM");
779 lcd_puts(0, line
++, buf
);
781 x
= (control
>> 29) & 1;
782 snprintf(buf
, sizeof(buf
), "Copy: %d (%s)",
783 x
, x
?"Permitted":"Inhibited");
784 lcd_puts(0, line
++, buf
);
786 x
= (control
>> 27) & 7;
799 snprintf(buf
, sizeof(buf
), "Preemphasis: %d (%s)", x
, s
);
800 lcd_puts(0, line
++, buf
);
802 x
= (control
>> 24) & 3;
803 snprintf(buf
, sizeof(buf
), "Mode: %d", x
);
804 lcd_puts(0, line
++, buf
);
806 category
= (control
>> 17) & 127;
818 snprintf(buf
, sizeof(buf
), "Category: 0x%02x (%s)", category
, s
);
819 lcd_puts(0, line
++, buf
);
821 x
= (control
>> 16) & 1;
823 if(((category
& 0x70) == 0x10) ||
824 ((category
& 0x70) == 0x40) ||
825 ((category
& 0x78) == 0x38))
827 generation
= !generation
;
829 snprintf(buf
, sizeof(buf
), "Generation: %d (%s)",
830 x
, generation
?"Original":"No ind.");
831 lcd_puts(0, line
++, buf
);
833 x
= (control
>> 12) & 15;
834 snprintf(buf
, sizeof(buf
), "Source: %d", x
);
835 lcd_puts(0, line
++, buf
);
837 x
= (control
>> 8) & 15;
853 snprintf(buf
, sizeof(buf
), "Channel: %d (%s)", x
, s
);
854 lcd_puts(0, line
++, buf
);
856 x
= (control
>> 4) & 15;
869 snprintf(buf
, sizeof(buf
), "Frequency: %d (%s)", x
, s
);
870 lcd_puts(0, line
++, buf
);
872 x
= (control
>> 2) & 3;
873 snprintf(buf
, sizeof(buf
), "Clock accuracy: %d", x
);
874 lcd_puts(0, line
++, buf
);
878 snprintf(buf
, sizeof(buf
), "Measured freq: %ldHz",
879 spdif_measure_frequency());
880 lcd_puts(0, line
++, buf
);
885 if (action_userabort(HZ
/10))
889 spdif_set_output_source(spdif_source
, spdif_src_on
);
891 #ifdef HAVE_SPDIF_POWER
892 spdif_power_enable(global_settings
.spdif_enable
);
897 #endif /* CPU_COLDFIRE */
900 #ifdef HAVE_LCD_BITMAP
901 /* button definitions */
902 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
903 (CONFIG_KEYPAD == IRIVER_H300_PAD)
904 # define DEBUG_CANCEL BUTTON_OFF
906 #elif CONFIG_KEYPAD == RECORDER_PAD
907 # define DEBUG_CANCEL BUTTON_OFF
909 #elif CONFIG_KEYPAD == ONDIO_PAD
910 # define DEBUG_CANCEL BUTTON_MENU
912 #elif (CONFIG_KEYPAD == IPOD_3G_PAD) || \
913 (CONFIG_KEYPAD == IPOD_4G_PAD)
914 # define DEBUG_CANCEL BUTTON_MENU
916 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
917 # define DEBUG_CANCEL BUTTON_PLAY
919 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
920 # define DEBUG_CANCEL BUTTON_REC
922 #elif CONFIG_KEYPAD == GIGABEAT_PAD
923 # define DEBUG_CANCEL BUTTON_A
925 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
926 # define DEBUG_CANCEL BUTTON_REW
928 #elif CONFIG_KEYPAD == SANSA_E200_PAD
929 # define DEBUG_CANCEL BUTTON_LEFT
930 #endif /* key definitios */
935 #if CONFIG_CPU == SH7034
936 unsigned short porta
;
937 unsigned short portb
;
940 int adc_battery_voltage
, adc_battery_level
;
942 lcd_setfont(FONT_SYSFIXED
);
943 lcd_setmargins(0, 0);
952 snprintf(buf
, 32, "PADR: %04x", porta
);
954 snprintf(buf
, 32, "PBDR: %04x", portb
);
957 snprintf(buf
, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
959 snprintf(buf
, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
961 snprintf(buf
, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
963 snprintf(buf
, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
966 battery_read_info(NULL
, &adc_battery_voltage
,
968 snprintf(buf
, 32, "Batt: %d.%02dV %d%% ", adc_battery_voltage
/ 100,
969 adc_battery_voltage
% 100, adc_battery_level
);
971 #ifndef HAVE_MMC /* have ATA */
972 snprintf(buf
, 32, "ATA: %s, 0x%x",
973 ata_device
?"slave":"master", ata_io_address
);
977 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
980 #elif defined(CPU_COLDFIRE)
981 unsigned int gpio_out
;
982 unsigned int gpio1_out
;
983 unsigned int gpio_read
;
984 unsigned int gpio1_read
;
985 unsigned int gpio_function
;
986 unsigned int gpio1_function
;
987 unsigned int gpio_enable
;
988 unsigned int gpio1_enable
;
989 int adc_buttons
, adc_remote
;
990 int adc_battery
, adc_battery_voltage
, adc_battery_level
;
994 lcd_setmargins(0, 0);
996 lcd_setfont(FONT_SYSFIXED
);
1001 gpio_read
= GPIO_READ
;
1002 gpio1_read
= GPIO1_READ
;
1003 gpio_out
= GPIO_OUT
;
1004 gpio1_out
= GPIO1_OUT
;
1005 gpio_function
= GPIO_FUNCTION
;
1006 gpio1_function
= GPIO1_FUNCTION
;
1007 gpio_enable
= GPIO_ENABLE
;
1008 gpio1_enable
= GPIO1_ENABLE
;
1010 snprintf(buf
, sizeof(buf
), "GPIO_READ: %08x", gpio_read
);
1011 lcd_puts(0, line
++, buf
);
1012 snprintf(buf
, sizeof(buf
), "GPIO_OUT: %08x", gpio_out
);
1013 lcd_puts(0, line
++, buf
);
1014 snprintf(buf
, sizeof(buf
), "GPIO_FUNCTION: %08x", gpio_function
);
1015 lcd_puts(0, line
++, buf
);
1016 snprintf(buf
, sizeof(buf
), "GPIO_ENABLE: %08x", gpio_enable
);
1017 lcd_puts(0, line
++, buf
);
1019 snprintf(buf
, sizeof(buf
), "GPIO1_READ: %08x", gpio1_read
);
1020 lcd_puts(0, line
++, buf
);
1021 snprintf(buf
, sizeof(buf
), "GPIO1_OUT: %08x", gpio1_out
);
1022 lcd_puts(0, line
++, buf
);
1023 snprintf(buf
, sizeof(buf
), "GPIO1_FUNCTION: %08x", gpio1_function
);
1024 lcd_puts(0, line
++, buf
);
1025 snprintf(buf
, sizeof(buf
), "GPIO1_ENABLE: %08x", gpio1_enable
);
1026 lcd_puts(0, line
++, buf
);
1028 adc_buttons
= adc_read(ADC_BUTTONS
);
1029 adc_remote
= adc_read(ADC_REMOTE
);
1030 battery_read_info(&adc_battery
, &adc_battery_voltage
,
1031 &adc_battery_level
);
1032 #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
1033 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS (%c): %02x",
1034 button_scan_enabled() ? '+' : '-', adc_buttons
);
1036 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS: %02x", adc_buttons
);
1038 lcd_puts(0, line
++, buf
);
1039 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
1040 snprintf(buf
, sizeof(buf
), "ADC_REMOTE (%c): %02x",
1041 remote_detect() ? '+' : '-', adc_remote
);
1043 snprintf(buf
, sizeof(buf
), "ADC_REMOTE: %02x", adc_remote
);
1046 lcd_puts(0, line
++, buf
);
1047 snprintf(buf
, sizeof(buf
), "ADC_BATTERY: %02x", adc_battery
);
1048 lcd_puts(0, line
++, buf
);
1049 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1050 snprintf(buf
, sizeof(buf
), "ADC_REMOTEDETECT: %02x",
1051 adc_read(ADC_REMOTEDETECT
));
1052 lcd_puts(0, line
++, buf
);
1055 snprintf(buf
, 32, "Batt: %d.%02dV %d%% ", adc_battery_voltage
/ 100,
1056 adc_battery_voltage
% 100, adc_battery_level
);
1057 lcd_puts(0, line
++, buf
);
1059 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1060 snprintf(buf
, sizeof(buf
), "remotetype: %d", remote_type());
1061 lcd_puts(0, line
++, buf
);
1065 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1069 #elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5024
1071 unsigned int gpio_a
, gpio_b
, gpio_c
, gpio_d
;
1072 unsigned int gpio_e
, gpio_f
, gpio_g
, gpio_h
;
1073 unsigned int gpio_i
, gpio_j
, gpio_k
, gpio_l
;
1078 lcd_setmargins(0, 0);
1079 lcd_clear_display();
1080 lcd_setfont(FONT_SYSFIXED
);
1084 gpio_a
= GPIOA_INPUT_VAL
;
1085 gpio_b
= GPIOB_INPUT_VAL
;
1086 gpio_c
= GPIOC_INPUT_VAL
;
1088 gpio_g
= GPIOG_INPUT_VAL
;
1089 gpio_h
= GPIOH_INPUT_VAL
;
1090 gpio_i
= GPIOI_INPUT_VAL
;
1093 snprintf(buf
, sizeof(buf
), "GPIO_A: %02x GPIO_G: %02x", gpio_a
, gpio_g
);
1094 lcd_puts(0, line
++, buf
);
1095 snprintf(buf
, sizeof(buf
), "GPIO_B: %02x GPIO_H: %02x", gpio_b
, gpio_h
);
1096 lcd_puts(0, line
++, buf
);
1097 snprintf(buf
, sizeof(buf
), "GPIO_C: %02x GPIO_I: %02x", gpio_c
, gpio_i
);
1098 lcd_puts(0, line
++, buf
);
1101 gpio_d
= GPIOD_INPUT_VAL
;
1102 gpio_e
= GPIOE_INPUT_VAL
;
1103 gpio_f
= GPIOF_INPUT_VAL
;
1105 gpio_j
= GPIOJ_INPUT_VAL
;
1106 gpio_k
= GPIOK_INPUT_VAL
;
1107 gpio_l
= GPIOL_INPUT_VAL
;
1109 snprintf(buf
, sizeof(buf
), "GPIO_D: %02x GPIO_J: %02x", gpio_d
, gpio_j
);
1110 lcd_puts(0, line
++, buf
);
1111 snprintf(buf
, sizeof(buf
), "GPIO_E: %02x GPIO_K: %02x", gpio_e
, gpio_k
);
1112 lcd_puts(0, line
++, buf
);
1113 snprintf(buf
, sizeof(buf
), "GPIO_F: %02x GPIO_L: %02x", gpio_f
, gpio_l
);
1114 lcd_puts(0, line
++, buf
);
1115 #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1117 snprintf(buf
, sizeof(buf
), "ADC_BATTERY: %02x", adc_read(ADC_BATTERY
));
1118 lcd_puts(0, line
++, buf
);
1119 snprintf(buf
, sizeof(buf
), "ADC_UNKNOWN_1: %02x", adc_read(ADC_UNKNOWN_1
));
1120 lcd_puts(0, line
++, buf
);
1121 snprintf(buf
, sizeof(buf
), "ADC_REMOTE: %02x", adc_read(ADC_REMOTE
));
1122 lcd_puts(0, line
++, buf
);
1123 snprintf(buf
, sizeof(buf
), "ADC_SCROLLPAD: %02x", adc_read(ADC_SCROLLPAD
));
1124 lcd_puts(0, line
++, buf
);
1125 #elif defined(SANSA_E200)
1127 snprintf(buf
, sizeof(buf
), "ADC_BVDD: %02x", adc_read(ADC_BVDD
));
1128 lcd_puts(0, line
++, buf
);
1129 snprintf(buf
, sizeof(buf
), "ADC_RTCSUP: %02x", adc_read(ADC_RTCSUP
));
1130 lcd_puts(0, line
++, buf
);
1131 snprintf(buf
, sizeof(buf
), "ADC_UVDD: %02x", adc_read(ADC_UVDD
));
1132 lcd_puts(0, line
++, buf
);
1133 snprintf(buf
, sizeof(buf
), "ADC_CHG_IN: %02x", adc_read(ADC_CHG_IN
));
1134 lcd_puts(0, line
++, buf
);
1135 snprintf(buf
, sizeof(buf
), "ADC_CVDD: %02x", adc_read(ADC_CVDD
));
1136 lcd_puts(0, line
++, buf
);
1137 snprintf(buf
, sizeof(buf
), "ADC_BATTEMP: %02x", adc_read(ADC_BATTEMP
));
1138 lcd_puts(0, line
++, buf
);
1139 snprintf(buf
, sizeof(buf
), "ADC_MICSUP1: %02x", adc_read(ADC_MICSUP1
));
1140 lcd_puts(0, line
++, buf
);
1141 snprintf(buf
, sizeof(buf
), "ADC_MICSUP2: %02x", adc_read(ADC_MICSUP2
));
1142 lcd_puts(0, line
++, buf
);
1143 snprintf(buf
, sizeof(buf
), "ADC_VBE1: %02x", adc_read(ADC_VBE1
));
1144 lcd_puts(0, line
++, buf
);
1145 snprintf(buf
, sizeof(buf
), "ADC_VBE2: %02x", adc_read(ADC_VBE2
));
1146 lcd_puts(0, line
++, buf
);
1147 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP1: %02x", adc_read(ADC_I_MICSUP1
));
1148 lcd_puts(0, line
++, buf
);
1149 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP2: %02x", adc_read(ADC_I_MICSUP2
));
1150 lcd_puts(0, line
++, buf
);
1151 snprintf(buf
, sizeof(buf
), "ADC_VBAT: %02x", adc_read(ADC_VBAT
));
1152 lcd_puts(0, line
++, buf
);
1155 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1159 #elif CONFIG_CPU == PP5002
1160 unsigned int gpio_a
, gpio_b
, gpio_c
, gpio_d
;
1165 lcd_setmargins(0, 0);
1166 lcd_clear_display();
1167 lcd_setfont(FONT_SYSFIXED
);
1171 gpio_a
= GPIOA_INPUT_VAL
;
1172 gpio_b
= GPIOB_INPUT_VAL
;
1173 gpio_c
= GPIOC_INPUT_VAL
;
1174 gpio_d
= GPIOD_INPUT_VAL
;
1177 snprintf(buf
, sizeof(buf
), "GPIO_A: %02x GPIO_B: %02x", gpio_a
, gpio_b
);
1178 lcd_puts(0, line
++, buf
);
1179 snprintf(buf
, sizeof(buf
), "GPIO_C: %02x GPIO_D: %02x", gpio_c
, gpio_d
);
1180 lcd_puts(0, line
++, buf
);
1183 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1189 #else /* !HAVE_LCD_BITMAP */
1190 bool dbg_ports(void)
1192 unsigned short porta
;
1193 unsigned short portb
;
1194 unsigned char portc
;
1197 int adc_battery_voltage
;
1200 lcd_clear_display();
1211 snprintf(buf
, 32, "PADR: %04x ", porta
);
1214 snprintf(buf
, 32, "PBDR: %04x ", portb
);
1217 snprintf(buf
, 32, "AN0: %03x ", adc_read(0));
1220 snprintf(buf
, 32, "AN1: %03x ", adc_read(1));
1223 snprintf(buf
, 32, "AN2: %03x ", adc_read(2));
1226 snprintf(buf
, 32, "AN3: %03x ", adc_read(3));
1229 snprintf(buf
, 32, "AN4: %03x ", adc_read(4));
1232 snprintf(buf
, 32, "AN5: %03x ", adc_read(5));
1235 snprintf(buf
, 32, "AN6: %03x ", adc_read(6));
1238 snprintf(buf
, 32, "AN7: %03x ", adc_read(7));
1241 snprintf(buf
, 32, "%s, 0x%x ",
1242 ata_device
?"slv":"mst", ata_io_address
);
1245 lcd_puts(0, 0, buf
);
1247 battery_read_info(NULL
, &adc_battery_voltage
, NULL
);
1248 snprintf(buf
, 32, "Batt: %d.%02dV", adc_battery_voltage
/ 100,
1249 adc_battery_voltage
% 100);
1250 lcd_puts(0, 1, buf
);
1253 button
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1257 case ACTION_STD_CANCEL
:
1258 action_signalscreenchange();
1261 case ACTION_SETTINGS_DEC
:
1267 case ACTION_SETTINGS_INC
:
1276 #endif /* !HAVE_LCD_BITMAP */
1277 #endif /* !SIMULATOR */
1279 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
1280 static bool dbg_cpufreq(void)
1286 #ifdef HAVE_LCD_BITMAP
1287 lcd_setmargins(0, 0);
1288 lcd_setfont(FONT_SYSFIXED
);
1290 lcd_clear_display();
1296 snprintf(buf
, sizeof(buf
), "Frequency: %ld", FREQ
);
1297 lcd_puts(0, line
++, buf
);
1299 snprintf(buf
, sizeof(buf
), "boost_counter: %d", get_cpu_boost_counter());
1300 lcd_puts(0, line
++, buf
);
1303 button
= get_action(CONTEXT_STD
,HZ
/10);
1307 case ACTION_STD_PREV
:
1311 case ACTION_STD_NEXT
:
1316 while (get_cpu_boost_counter() > 0)
1318 set_cpu_frequency(CPUFREQ_DEFAULT
);
1321 case ACTION_STD_CANCEL
:
1322 action_signalscreenchange();
1329 #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1332 #ifdef HAVE_LCD_BITMAP
1334 * view_battery() shows a automatically scaled graph of the battery voltage
1335 * over time. Usable for estimating battery life / charging rate.
1336 * The power_history array is updated in power_thread of powermgmt.c.
1339 #define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
1340 #define BAT_YSPACE (LCD_HEIGHT - 20)
1342 static bool view_battery(void)
1346 unsigned short maxv
, minv
;
1349 lcd_setmargins(0, 0);
1350 lcd_setfont(FONT_SYSFIXED
);
1354 lcd_clear_display();
1356 case 0: /* voltage history graph */
1357 /* Find maximum and minimum voltage for scaling */
1360 for (i
= 0; i
< BAT_LAST_VAL
; i
++) {
1361 if (power_history
[i
] > maxv
)
1362 maxv
= power_history
[i
];
1363 if (power_history
[i
] && (power_history
[i
] < minv
))
1365 minv
= power_history
[i
];
1369 if ((minv
< 1) || (minv
>= 65535))
1374 maxv
< 65535 ? maxv
++ : minv
--;
1376 snprintf(buf
, 30, "Battery %d.%02d", power_history
[0] / 100,
1377 power_history
[0] % 100);
1378 lcd_puts(0, 0, buf
);
1379 snprintf(buf
, 30, "scale %d.%02d-%d.%02d V",
1380 minv
/ 100, minv
% 100, maxv
/ 100, maxv
% 100);
1381 lcd_puts(0, 1, buf
);
1384 for (i
= BAT_LAST_VAL
- 1; i
>= 0; i
--) {
1385 y
= (power_history
[i
] - minv
) * BAT_YSPACE
/ (maxv
- minv
);
1386 lcd_set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
1387 lcd_vline(x
, LCD_HEIGHT
-1, 20);
1388 lcd_set_drawmode(DRMODE_SOLID
);
1389 lcd_vline(x
, LCD_HEIGHT
-1,
1390 MIN(MAX(LCD_HEIGHT
-1 - y
, 20), LCD_HEIGHT
-1));
1396 case 1: /* status: */
1397 lcd_puts(0, 0, "Power status:");
1399 battery_read_info(NULL
, &y
, NULL
);
1400 snprintf(buf
, 30, "Battery: %d.%02d V", y
/ 100, y
% 100);
1401 lcd_puts(0, 1, buf
);
1402 #ifdef ADC_EXT_POWER
1403 y
= (adc_read(ADC_EXT_POWER
) * EXT_SCALE_FACTOR
) / 10000;
1404 snprintf(buf
, 30, "External: %d.%02d V", y
/ 100, y
% 100);
1405 lcd_puts(0, 2, buf
);
1408 #if CONFIG_CHARGING == CHARGING_CONTROL
1409 snprintf(buf
, 30, "Chgr: %s %s",
1410 charger_inserted() ? "present" : "absent",
1411 charger_enabled
? "on" : "off");
1412 lcd_puts(0, 3, buf
);
1413 snprintf(buf
, 30, "short delta: %d", short_delta
);
1414 lcd_puts(0, 5, buf
);
1415 snprintf(buf
, 30, "long delta: %d", long_delta
);
1416 lcd_puts(0, 6, buf
);
1417 lcd_puts(0, 7, power_message
);
1418 snprintf(buf
, 30, "USB Inserted: %s",
1419 usb_inserted() ? "yes" : "no");
1420 lcd_puts(0, 8, buf
);
1421 #if defined IRIVER_H300_SERIES
1422 snprintf(buf
, 30, "USB Charging Enabled: %s",
1423 usb_charging_enabled() ? "yes" : "no");
1424 lcd_puts(0, 9, buf
);
1426 #else /* CONFIG_CHARGING != CHARGING_CONTROL */
1427 #if defined IPOD_NANO || defined IPOD_VIDEO
1428 int usb_pwr
= (GPIOL_INPUT_VAL
& 0x10)?true:false;
1429 int ext_pwr
= (GPIOL_INPUT_VAL
& 0x08)?false:true;
1430 int dock
= (GPIOA_INPUT_VAL
& 0x10)?true:false;
1431 int charging
= (GPIOB_INPUT_VAL
& 0x01)?false:true;
1432 int headphone
= (GPIOA_INPUT_VAL
& 0x80)?true:false;
1434 snprintf(buf
, 30, "USB pwr: %s",
1435 usb_pwr
? "present" : "absent");
1436 lcd_puts(0, 3, buf
);
1437 snprintf(buf
, 30, "EXT pwr: %s",
1438 ext_pwr
? "present" : "absent");
1439 lcd_puts(0, 4, buf
);
1440 snprintf(buf
, 30, "Battery: %s",
1441 charging
? "charging" : (usb_pwr
||ext_pwr
) ? "charged" : "discharging");
1442 lcd_puts(0, 5, buf
);
1443 snprintf(buf
, 30, "Dock mode: %s",
1444 dock
? "enabled" : "disabled");
1445 lcd_puts(0, 6, buf
);
1446 snprintf(buf
, 30, "Headphone: %s",
1447 headphone
? "connected" : "disconnected");
1448 lcd_puts(0, 7, buf
);
1450 snprintf(buf
, 30, "Charger: %s",
1451 charger_inserted() ? "present" : "absent");
1452 lcd_puts(0, 3, buf
);
1454 #endif /* CONFIG_CHARGING != CHARGING_CONTROL */
1455 #endif /* CONFIG_CHARGING */
1458 case 2: /* voltage deltas: */
1459 lcd_puts(0, 0, "Voltage deltas:");
1461 for (i
= 0; i
<= 6; i
++) {
1462 y
= power_history
[i
] - power_history
[i
+i
];
1463 snprintf(buf
, 30, "-%d min: %s%d.%02d V", i
,
1464 (y
< 0) ? "-" : "", ((y
< 0) ? y
* -1 : y
) / 100,
1465 ((y
< 0) ? y
* -1 : y
) % 100);
1466 lcd_puts(0, i
+1, buf
);
1470 case 3: /* remaining time estimation: */
1472 #if CONFIG_CHARGING == CHARGING_CONTROL
1473 snprintf(buf
, 30, "charge_state: %d", charge_state
);
1474 lcd_puts(0, 0, buf
);
1476 snprintf(buf
, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min
);
1477 lcd_puts(0, 1, buf
);
1479 snprintf(buf
, 30, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level
);
1480 lcd_puts(0, 2, buf
);
1482 snprintf(buf
, 30, "P=%2d I=%2d", pid_p
, pid_i
);
1483 lcd_puts(0, 3, buf
);
1485 snprintf(buf
, 30, "Trickle sec: %d/60", trickle_sec
);
1486 lcd_puts(0, 4, buf
);
1487 #endif /* CONFIG_CHARGING == CHARGING_CONTROL */
1489 snprintf(buf
, 30, "Last PwrHist: %d.%02d V",
1490 power_history
[0] / 100,
1491 power_history
[0] % 100);
1492 lcd_puts(0, 5, buf
);
1494 snprintf(buf
, 30, "battery level: %d%%", battery_level());
1495 lcd_puts(0, 6, buf
);
1497 snprintf(buf
, 30, "Est. remain: %d m", battery_time());
1498 lcd_puts(0, 7, buf
);
1504 switch(get_action(CONTEXT_SETTINGS
,HZ
/2))
1506 case ACTION_SETTINGS_DEC
:
1511 case ACTION_SETTINGS_INC
:
1516 case ACTION_STD_CANCEL
:
1517 action_signalscreenchange();
1524 #endif /* HAVE_LCD_BITMAP */
1529 static bool dbg_mmc_info(void)
1535 unsigned char pbuf
[32], pbuf2
[32];
1536 unsigned char card_name
[7];
1538 static const unsigned char i_vmin
[] = { 0, 1, 5, 10, 25, 35, 60, 100 };
1539 static const unsigned char i_vmax
[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
1540 static const unsigned char *kbit_units
[] = { "kBit/s", "MBit/s", "GBit/s" };
1541 static const unsigned char *nsec_units
[] = { "ns", "µs", "ms" };
1542 static const char *spec_vers
[] = { "1.0-1.2", "1.4", "2.0-2.2",
1543 "3.1-3.31", "4.0" };
1545 card_name
[6] = '\0';
1547 lcd_setmargins(0, 0);
1548 lcd_setfont(FONT_SYSFIXED
);
1552 card
= mmc_card_info(currval
/ 2);
1555 lcd_clear_display();
1556 snprintf(pbuf
, sizeof(pbuf
), "[MMC%d p%d]", currval
/ 2,
1558 lcd_puts(0, line
++, pbuf
);
1560 if (card
->initialized
)
1562 if (!(currval
% 2)) /* General info */
1566 strncpy(card_name
, ((unsigned char*)card
->cid
) + 3, 6);
1567 snprintf(pbuf
, sizeof(pbuf
), "%s Rev %d.%d", card_name
,
1568 (int) mmc_extract_bits(card
->cid
, 72, 4),
1569 (int) mmc_extract_bits(card
->cid
, 76, 4));
1570 lcd_puts(0, line
++, pbuf
);
1571 snprintf(pbuf
, sizeof(pbuf
), "Prod: %d/%d",
1572 (int) mmc_extract_bits(card
->cid
, 112, 4),
1573 (int) mmc_extract_bits(card
->cid
, 116, 4) + 1997);
1574 lcd_puts(0, line
++, pbuf
);
1575 snprintf(pbuf
, sizeof(pbuf
), "Ser#: 0x%08lx",
1576 mmc_extract_bits(card
->cid
, 80, 32));
1577 lcd_puts(0, line
++, pbuf
);
1578 snprintf(pbuf
, sizeof(pbuf
), "M=%02x, O=%04x",
1579 (int) mmc_extract_bits(card
->cid
, 0, 8),
1580 (int) mmc_extract_bits(card
->cid
, 8, 16));
1581 lcd_puts(0, line
++, pbuf
);
1582 temp
= mmc_extract_bits(card
->csd
, 2, 4);
1583 snprintf(pbuf
, sizeof(pbuf
), "MMC v%s", temp
< 5 ?
1584 spec_vers
[temp
] : "?.?");
1585 lcd_puts(0, line
++, pbuf
);
1586 snprintf(pbuf
, sizeof(pbuf
), "Blocks: 0x%06lx", card
->numblocks
);
1587 lcd_puts(0, line
++, pbuf
);
1588 snprintf(pbuf
, sizeof(pbuf
), "Blksz.: %d P:%c%c", card
->blocksize
,
1589 mmc_extract_bits(card
->csd
, 48, 1) ? 'R' : '-',
1590 mmc_extract_bits(card
->csd
, 106, 1) ? 'W' : '-');
1591 lcd_puts(0, line
++, pbuf
);
1593 else /* Technical details */
1595 output_dyn_value(pbuf2
, sizeof pbuf2
, card
->speed
/ 1000,
1597 snprintf(pbuf
, sizeof pbuf
, "Speed: %s", pbuf2
);
1598 lcd_puts(0, line
++, pbuf
);
1600 output_dyn_value(pbuf2
, sizeof pbuf2
, card
->tsac
,
1602 snprintf(pbuf
, sizeof pbuf
, "Tsac: %s", pbuf2
);
1603 lcd_puts(0, line
++, pbuf
);
1605 snprintf(pbuf
, sizeof(pbuf
), "Nsac: %d clk", card
->nsac
);
1606 lcd_puts(0, line
++, pbuf
);
1607 snprintf(pbuf
, sizeof(pbuf
), "R2W: *%d", card
->r2w_factor
);
1608 lcd_puts(0, line
++, pbuf
);
1609 snprintf(pbuf
, sizeof(pbuf
), "IRmax: %d..%d mA",
1610 i_vmin
[mmc_extract_bits(card
->csd
, 66, 3)],
1611 i_vmax
[mmc_extract_bits(card
->csd
, 69, 3)]);
1612 lcd_puts(0, line
++, pbuf
);
1613 snprintf(pbuf
, sizeof(pbuf
), "IWmax: %d..%d mA",
1614 i_vmin
[mmc_extract_bits(card
->csd
, 72, 3)],
1615 i_vmax
[mmc_extract_bits(card
->csd
, 75, 3)]);
1616 lcd_puts(0, line
++, pbuf
);
1620 lcd_puts(0, line
++, "Not found!");
1624 switch (get_action(CONTEXT_SETTINGS
,HZ
/2))
1626 case ACTION_STD_CANCEL
:
1630 case ACTION_SETTINGS_DEC
:
1636 case ACTION_SETTINGS_INC
:
1643 action_signalscreenchange();
1646 #else /* !HAVE_MMC */
1647 static bool dbg_disk_info(void)
1653 const int max_page
= 11;
1654 unsigned short* identify_info
= ata_get_identify();
1655 bool timing_info_present
= false;
1656 char pio3
[2], pio4
[2];
1658 lcd_setmargins(0, 0);
1664 lcd_clear_display();
1665 #ifdef HAVE_LCD_BITMAP
1666 lcd_puts(0, y
++, "Disk info:");
1672 for (i
=0; i
< 20; i
++)
1673 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+27]);
1675 /* kill trailing space */
1676 for (i
=39; i
&& buf
[i
]==' '; i
--)
1678 lcd_puts(0, y
++, "Model");
1679 lcd_puts_scroll(0, y
++, buf
);
1683 for (i
=0; i
< 4; i
++)
1684 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+23]);
1686 lcd_puts(0, y
++, "Firmware");
1687 lcd_puts(0, y
++, buf
);
1691 snprintf(buf
, sizeof buf
, "%ld MB",
1692 ((unsigned long)identify_info
[61] << 16 |
1693 (unsigned long)identify_info
[60]) / 2048 );
1694 lcd_puts(0, y
++, "Size");
1695 lcd_puts(0, y
++, buf
);
1700 fat_size( IF_MV2(0,) NULL
, &free
);
1701 snprintf(buf
, sizeof buf
, "%ld MB", free
/ 1024 );
1702 lcd_puts(0, y
++, "Free");
1703 lcd_puts(0, y
++, buf
);
1708 snprintf(buf
, sizeof buf
, "%d ms", ata_spinup_time
* (1000/HZ
));
1709 lcd_puts(0, y
++, "Spinup time");
1710 lcd_puts(0, y
++, buf
);
1714 i
= identify_info
[83] & (1<<3);
1715 lcd_puts(0, y
++, "Power mgmt:");
1716 lcd_puts(0, y
++, i
? "enabled" : "unsupported");
1720 i
= identify_info
[83] & (1<<9);
1721 lcd_puts(0, y
++, "Noise mgmt:");
1722 lcd_puts(0, y
++, i
? "enabled" : "unsupported");
1726 i
= identify_info
[82] & (1<<6);
1727 lcd_puts(0, y
++, "Read-ahead:");
1728 lcd_puts(0, y
++, i
? "enabled" : "unsupported");
1732 timing_info_present
= identify_info
[53] & (1<<1);
1733 if(timing_info_present
) {
1736 lcd_puts(0, y
++, "PIO modes:");
1737 pio3
[0] = (identify_info
[64] & (1<<0)) ? '3' : 0;
1738 pio4
[0] = (identify_info
[64] & (1<<1)) ? '4' : 0;
1739 snprintf(buf
, 128, "0 1 2 %s %s", pio3
, pio4
);
1740 lcd_puts(0, y
++, buf
);
1742 lcd_puts(0, y
++, "No PIO mode info");
1747 timing_info_present
= identify_info
[53] & (1<<1);
1748 if(timing_info_present
) {
1749 lcd_puts(0, y
++, "Cycle times");
1750 snprintf(buf
, 128, "%dns/%dns",
1753 lcd_puts(0, y
++, buf
);
1755 lcd_puts(0, y
++, "No timing info");
1760 timing_info_present
= identify_info
[53] & (1<<1);
1761 if(timing_info_present
) {
1762 i
= identify_info
[49] & (1<<11);
1763 snprintf(buf
, 128, "IORDY support: %s", i
? "yes" : "no");
1764 lcd_puts(0, y
++, buf
);
1765 i
= identify_info
[49] & (1<<10);
1766 snprintf(buf
, 128, "IORDY disable: %s", i
? "yes" : "no");
1767 lcd_puts(0, y
++, buf
);
1769 lcd_puts(0, y
++, "No timing info");
1774 lcd_puts(0, y
++, "Cluster size");
1775 snprintf(buf
, 128, "%d bytes", fat_get_cluster_size(IF_MV(0)));
1776 lcd_puts(0, y
++, buf
);
1781 /* Wait for a key to be pushed */
1782 key
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1784 case ACTION_STD_CANCEL
:
1788 case ACTION_SETTINGS_DEC
:
1793 case ACTION_SETTINGS_INC
:
1794 if (++page
> max_page
)
1800 action_signalscreenchange();
1803 #endif /* !HAVE_MMC */
1804 #endif /* !SIMULATOR */
1806 #ifdef HAVE_DIRCACHE
1807 static bool dbg_dircache_info(void)
1813 lcd_setmargins(0, 0);
1814 lcd_setfont(FONT_SYSFIXED
);
1820 lcd_clear_display();
1821 snprintf(buf
, sizeof(buf
), "Cache initialized: %s",
1822 dircache_is_enabled() ? "Yes" : "No");
1823 lcd_puts(0, line
++, buf
);
1825 snprintf(buf
, sizeof(buf
), "Cache size: %d B",
1826 dircache_get_cache_size());
1827 lcd_puts(0, line
++, buf
);
1829 snprintf(buf
, sizeof(buf
), "Last size: %d B",
1830 global_status
.dircache_size
);
1831 lcd_puts(0, line
++, buf
);
1833 snprintf(buf
, sizeof(buf
), "Limit: %d B", DIRCACHE_LIMIT
);
1834 lcd_puts(0, line
++, buf
);
1836 snprintf(buf
, sizeof(buf
), "Reserve: %d/%d B",
1837 dircache_get_reserve_used(), DIRCACHE_RESERVE
);
1838 lcd_puts(0, line
++, buf
);
1840 snprintf(buf
, sizeof(buf
), "Scanning took: %d s",
1841 dircache_get_build_ticks() / HZ
);
1842 lcd_puts(0, line
++, buf
);
1844 snprintf(buf
, sizeof(buf
), "Entry count: %d",
1845 dircache_get_entry_count());
1846 lcd_puts(0, line
++, buf
);
1850 if (action_userabort(HZ
/2))
1857 #endif /* HAVE_DIRCACHE */
1859 #ifdef HAVE_LCD_BITMAP
1860 #ifdef HAVE_TAGCACHE
1861 static bool dbg_tagcache_info(void)
1866 struct tagcache_stat
*stat
;
1868 lcd_setmargins(0, 0);
1869 lcd_setfont(FONT_SYSFIXED
);
1875 lcd_clear_display();
1876 stat
= tagcache_get_stat();
1877 snprintf(buf
, sizeof(buf
), "Initialized: %s", stat
->initialized
? "Yes" : "No");
1878 lcd_puts(0, line
++, buf
);
1879 snprintf(buf
, sizeof(buf
), "DB Ready: %s", stat
->ready
? "Yes" : "No");
1880 lcd_puts(0, line
++, buf
);
1881 snprintf(buf
, sizeof(buf
), "RAM Cache: %s", stat
->ramcache
? "Yes" : "No");
1882 lcd_puts(0, line
++, buf
);
1883 snprintf(buf
, sizeof(buf
), "RAM: %d/%d B",
1884 stat
->ramcache_used
, stat
->ramcache_allocated
);
1885 lcd_puts(0, line
++, buf
);
1886 snprintf(buf
, sizeof(buf
), "Progress: %d%% (%d entries)",
1887 stat
->progress
, stat
->processed_entries
);
1888 lcd_puts(0, line
++, buf
);
1889 snprintf(buf
, sizeof(buf
), "Commit step: %d", stat
->commit_step
);
1890 lcd_puts(0, line
++, buf
);
1891 snprintf(buf
, sizeof(buf
), "Commit delayed: %s",
1892 stat
->commit_delayed
? "Yes" : "No");
1893 lcd_puts(0, line
++, buf
);
1897 if (action_userabort(HZ
/2))
1906 #if CONFIG_CPU == SH7034
1907 static bool dbg_save_roms(void)
1910 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
1912 fd
= creat("/internal_rom_0000-FFFF.bin");
1915 write(fd
, (void *)0, 0x10000);
1919 fd
= creat("/internal_rom_2000000-203FFFF.bin");
1922 write(fd
, (void *)0x2000000, 0x40000);
1926 system_memory_guard(oldmode
);
1929 #elif defined CPU_COLDFIRE
1930 static bool dbg_save_roms(void)
1933 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
1935 #if defined(IRIVER_H100_SERIES)
1936 fd
= creat("/internal_rom_000000-1FFFFF.bin");
1937 #elif defined(IRIVER_H300_SERIES)
1938 fd
= creat("/internal_rom_000000-3FFFFF.bin");
1939 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
1940 fd
= creat("/internal_rom_000000-3FFFFF.bin");
1944 write(fd
, (void *)0, FLASH_SIZE
);
1947 system_memory_guard(oldmode
);
1950 fd
= creat("/internal_eeprom.bin");
1954 char buf
[EEPROM_SIZE
];
1957 old_irq_level
= set_irq_level(HIGHEST_IRQ_LEVEL
);
1959 err
= eeprom_24cxx_read(0, buf
, sizeof buf
);
1961 gui_syncsplash(HZ
*3, "Eeprom read failure (%d)",err
);
1964 write(fd
, buf
, sizeof buf
);
1967 set_irq_level(old_irq_level
);
1975 #elif defined(CPU_PP) && !defined(SANSA_E200)
1976 static bool dbg_save_roms(void)
1980 fd
= creat("/internal_rom_000000-0FFFFF.bin");
1983 write(fd
, (void *)0x20000000, FLASH_SIZE
);
1993 static bool dbg_fm_radio(void)
1998 lcd_setmargins(0, 0);
2004 lcd_clear_display();
2005 fm_detected
= radio_hardware_present();
2007 snprintf(buf
, sizeof buf
, "HW detected: %s", fm_detected
?"yes":"no");
2008 lcd_puts(0, row
++, buf
);
2010 #if (CONFIG_TUNER & S1A0903X01)
2011 snprintf(buf
, sizeof buf
, "Samsung regs: %08X",
2012 samsung_get(RADIO_ALL
));
2013 lcd_puts(0, row
++, buf
);
2015 #if (CONFIG_TUNER & TEA5767)
2017 struct philips_dbg_info info
;
2018 philips_dbg_info(&info
);
2020 snprintf(buf
, sizeof buf
, "Philips regs:");
2021 lcd_puts(0, row
++, buf
);
2023 snprintf(buf
, sizeof buf
, " Read: %02X %02X %02X %02X %02X",
2024 (unsigned)info
.read_regs
[0], (unsigned)info
.read_regs
[1],
2025 (unsigned)info
.read_regs
[2], (unsigned)info
.read_regs
[3],
2026 (unsigned)info
.read_regs
[4]);
2027 lcd_puts(0, row
++, buf
);
2029 snprintf(buf
, sizeof buf
, " Write: %02X %02X %02X %02X %02X",
2030 (unsigned)info
.write_regs
[0], (unsigned)info
.write_regs
[1],
2031 (unsigned)info
.write_regs
[2], (unsigned)info
.write_regs
[3],
2032 (unsigned)info
.write_regs
[4]);
2033 lcd_puts(0, row
++, buf
);
2038 if (action_userabort(HZ
))
2043 #endif /* CONFIG_TUNER */
2044 #endif /* !SIMULATOR */
2046 #ifdef HAVE_LCD_BITMAP
2047 extern bool do_screendump_instead_of_usb
;
2049 static bool dbg_screendump(void)
2051 do_screendump_instead_of_usb
= !do_screendump_instead_of_usb
;
2052 gui_syncsplash(HZ
, "Screendump %s",
2053 do_screendump_instead_of_usb
?"enabled":"disabled");
2056 #endif /* HAVE_LCD_BITMAP */
2058 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2059 static bool dbg_set_memory_guard(void)
2061 static const struct opt_items names
[MAXMEMGUARD
] = {
2063 { "Flash ROM writes", -1 },
2064 { "Zero area (all)", -1 }
2066 int mode
= system_memory_guard(MEMGUARD_KEEP
);
2068 set_option( "Catch mem accesses", &mode
, INT
, names
, MAXMEMGUARD
, NULL
);
2069 system_memory_guard(mode
);
2073 #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
2075 #if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
2077 extern volatile bool lcd_poweroff
;
2079 static bool dbg_lcd_power_off(void)
2081 lcd_setmargins(0, 0);
2087 lcd_clear_display();
2088 lcd_puts(0, 0, "LCD Power Off");
2090 lcd_puts(1, 1, "Yes");
2092 lcd_puts(1, 1, "No");
2096 button
= get_action(CONTEXT_STD
,HZ
/5);
2099 case ACTION_STD_PREV
:
2100 case ACTION_STD_NEXT
:
2101 lcd_poweroff
= !lcd_poweroff
;
2104 case ACTION_STD_CANCEL
:
2105 action_signalscreenchange();
2115 #include "backlight-target.h"
2117 static bool dbg_buttonlights(void)
2119 unsigned short mode_changed
= 1, mode
= 0;
2120 enum buttonlight_selection which_led
= BUTTONLIGHT_LED_ALL
;
2121 unsigned short brightness
= DEFAULT_BRIGHTNESS_SETTING
;
2123 lcd_setmargins(0, 0);
2130 lcd_clear_display();
2131 lcd_puts(0, 0, "Button light support");
2132 lcd_puts(0, 1, "Press UP for mode change");
2133 lcd_puts(0, 2, "Press DOWN for buttonlight selection");
2138 lcd_puts(1, 3, "Off");
2139 __buttonlight_mode(BUTTONLIGHT_OFF
, which_led
, brightness
);
2143 lcd_puts(1, 3, "On - Set to brightness");
2144 __buttonlight_mode(BUTTONLIGHT_ON
, which_led
, brightness
);
2148 lcd_puts(1, 3, "Faint - Always on at lowest brightness");
2149 __buttonlight_mode(BUTTONLIGHT_FAINT
, which_led
, brightness
);
2153 lcd_puts(1, 3, "Flicker on disk access");
2154 __buttonlight_mode(BUTTONLIGHT_FLICKER
, which_led
, brightness
);
2158 lcd_puts(1, 3, "Solid on disk access");
2159 __buttonlight_mode(BUTTONLIGHT_SIGNAL
, which_led
, brightness
);
2163 lcd_puts(1, 3, "Follows backlight");
2164 __buttonlight_mode(BUTTONLIGHT_FOLLOW
, which_led
, brightness
);
2168 lcd_puts(1, 3, "Shows 'battery charging'");
2169 __buttonlight_mode(BUTTONLIGHT_CHARGING
, which_led
, brightness
);
2179 /* does nothing unless in flicker mode */
2180 /* the parameter sets the brightness */
2181 __buttonlight_trigger();
2182 button
= get_action(CONTEXT_STD
,HZ
/5);
2185 case ACTION_STD_PREV
:
2186 if (++mode
> 6) mode
= 0;
2190 case ACTION_STD_NEXT
:
2191 if (which_led
== BUTTONLIGHT_LED_ALL
)
2193 which_led
= BUTTONLIGHT_LED_MENU
;
2197 which_led
= BUTTONLIGHT_LED_ALL
;
2205 case ACTION_STD_CANCEL
:
2206 action_signalscreenchange();
2222 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2223 static bool dbg_write_eeprom(void)
2228 char buf
[EEPROM_SIZE
];
2231 fd
= open("/internal_eeprom.bin", O_RDONLY
);
2235 rc
= read(fd
, buf
, EEPROM_SIZE
);
2237 if(rc
== EEPROM_SIZE
)
2239 old_irq_level
= set_irq_level(HIGHEST_IRQ_LEVEL
);
2241 err
= eeprom_24cxx_write(0, buf
, sizeof buf
);
2243 gui_syncsplash(HZ
*3, "Eeprom write failure (%d)",err
);
2245 gui_syncsplash(HZ
*3, "Eeprom written successfully");
2247 set_irq_level(old_irq_level
);
2251 gui_syncsplash(HZ
*3, "File read error (%d)",rc
);
2257 gui_syncsplash(HZ
*3, "Failed to open 'internal_eeprom.bin'");
2262 #endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
2263 #ifdef CPU_BOOST_LOGGING
2264 static bool cpu_boost_log(void)
2267 int count
= cpu_boost_log_getcount();
2268 int lines
= LCD_HEIGHT
/SYSFONT_HEIGHT
;
2271 lcd_setmargins(0, 0);
2272 lcd_setfont(FONT_SYSFIXED
);
2273 str
= cpu_boost_log_getlog_first();
2276 lcd_clear_display();
2277 for(j
=0; j
<lines
; j
++,i
++)
2280 str
= cpu_boost_log_getlog_next();
2289 action_signalscreenchange();
2292 switch(get_action(CONTEXT_STD
,TIMEOUT_BLOCK
))
2295 case ACTION_STD_PREV
:
2296 case ACTION_STD_NEXT
:
2299 case ACTION_STD_CANCEL
:
2306 get_action(CONTEXT_STD
,TIMEOUT_BLOCK
);
2307 lcd_setfont(FONT_UI
);
2308 action_signalscreenchange();
2312 bool debug_menu(void)
2317 static const struct menu_item items
[] = {
2318 #if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
2319 { "LCD Power Off", dbg_lcd_power_off
},
2320 { "Button Light modes", dbg_buttonlights
},
2323 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2324 (defined(CPU_PP) && !defined(SANSA_E200))
2325 { "Dump ROM contents", dbg_save_roms
},
2327 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP)
2328 { "View I/O ports", dbg_ports
},
2330 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
2331 { "CPU frequency", dbg_cpufreq
},
2333 #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
2334 { "S/PDIF analyzer", dbg_spdif
},
2336 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2337 { "Catch mem accesses", dbg_set_memory_guard
},
2340 { "View OS stacks", dbg_os
},
2342 #ifdef HAVE_LCD_BITMAP
2344 { "View battery", view_battery
},
2346 { "Screendump", dbg_screendump
},
2349 { "View HW info", dbg_hw_info
},
2352 { "View partitions", dbg_partitions
},
2356 { "View MMC info", dbg_mmc_info
},
2358 { "View disk info", dbg_disk_info
},
2361 #ifdef HAVE_DIRCACHE
2362 { "View dircache info", dbg_dircache_info
},
2364 #ifdef HAVE_LCD_BITMAP
2365 #ifdef HAVE_TAGCACHE
2366 { "View database info", dbg_tagcache_info
},
2368 #if CONFIG_CODEC == SWCODEC || !defined(SIMULATOR)
2369 { "View audio thread", dbg_audio_thread
},
2372 { "pm histogram", peak_meter_histogram
},
2373 #endif /* PM_DEBUG */
2374 #endif /* HAVE_LCD_BITMAP */
2377 { "FM Radio", dbg_fm_radio
},
2380 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2381 { "Write back EEPROM", dbg_write_eeprom
},
2383 #ifdef ROCKBOX_HAS_LOGF
2384 {"logf", logfdisplay
},
2385 {"logfdump", logfdump
},
2387 #ifdef CPU_BOOST_LOGGING
2388 {"cpu_boost log",cpu_boost_log
},
2392 m
=menu_init( items
, sizeof items
/ sizeof(struct menu_item
), NULL
,
2393 "Debug Menu", NULL
, NULL
);
2394 result
= menu_run(m
);