1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Heikki Hannikainen
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
29 #include "debug_menu.h"
36 #include "powermgmt.h"
40 #include "mp3_playback.h"
43 #include "statusbar.h"
54 #include "lcd-remote.h"
66 #include "eeprom_24cxx.h"
67 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
70 #if (CONFIG_STORAGE & STORAGE_ATA)
79 #ifdef HAVE_LCD_BITMAP
80 #include "scrollbar.h"
81 #include "peakmeter.h"
84 #if CONFIG_CODEC == SWCODEC
86 #include "buffering.h"
88 #if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
92 #ifdef IRIVER_H300_SERIES
93 #include "pcf50606.h" /* for pcf50606_read */
100 #if CONFIG_RTC == RTC_PCF50605
101 #include "pcf50605.h"
104 #if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 \
105 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525
106 #include "debug-target.h"
109 #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \
110 || defined(SANSA_CLIP)
115 #if defined(HAVE_USBSTACK)
116 #include "usb_core.h"
119 #include "usbstack/usb_storage.h"
122 /*---------------------------------------------------*/
123 /* SPECIAL DEBUG STUFF */
124 /*---------------------------------------------------*/
125 extern struct thread_entry threads
[MAXTHREADS
];
127 static char thread_status_char(unsigned status
)
129 static const char thread_status_chars
[THREAD_NUM_STATES
+1] =
131 [0 ... THREAD_NUM_STATES
] = '?',
132 [STATE_RUNNING
] = 'R',
133 [STATE_BLOCKED
] = 'B',
134 [STATE_SLEEPING
] = 'S',
135 [STATE_BLOCKED_W_TMO
] = 'T',
136 [STATE_FROZEN
] = 'F',
137 [STATE_KILLED
] = 'K',
140 if (status
> THREAD_NUM_STATES
)
141 status
= THREAD_NUM_STATES
;
143 return thread_status_chars
[status
];
146 static char* threads_getname(int selected_item
, void *data
,
147 char *buffer
, size_t buffer_len
)
150 struct thread_entry
*thread
;
154 if (selected_item
< (int)NUM_CORES
)
156 snprintf(buffer
, buffer_len
, "Idle (%d): %2d%%", selected_item
,
157 idle_stack_usage(selected_item
));
161 selected_item
-= NUM_CORES
;
164 thread
= &threads
[selected_item
];
166 if (thread
->state
== STATE_KILLED
)
168 snprintf(buffer
, buffer_len
, "%2d: ---", selected_item
);
172 thread_get_name(name
, 32, thread
);
174 snprintf(buffer
, buffer_len
,
175 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s",
177 IF_COP(thread
->core
,)
178 #ifdef HAVE_SCHEDULER_BOOSTCTRL
179 (thread
->cpu_boost
) ? '+' :
181 ((thread
->state
== STATE_RUNNING
) ? '*' : ' '),
182 thread_status_char(thread
->state
),
183 IF_PRIO(thread
->base_priority
, thread
->priority
, )
184 thread_stack_usage(thread
), name
);
188 static int dbg_threads_action_callback(int action
, struct gui_synclist
*lists
)
191 #ifdef ROCKBOX_HAS_LOGF
192 if (action
== ACTION_STD_OK
)
194 int selpos
= gui_synclist_get_sel_pos(lists
);
196 if (selpos
>= NUM_CORES
)
197 remove_thread(&threads
[selpos
- NUM_CORES
]);
199 remove_thread(&threads
[selpos
]);
201 return ACTION_REDRAW
;
203 #endif /* ROCKBOX_HAS_LOGF */
204 if (action
== ACTION_NONE
)
205 action
= ACTION_REDRAW
;
209 static bool dbg_os(void)
211 struct simplelist_info info
;
212 simplelist_info_init(&info
, IF_COP("Core and ") "Stack usage:",
216 MAXTHREADS
+NUM_CORES
,
219 #ifndef ROCKBOX_HAS_LOGF
220 info
.hide_selection
= true;
221 info
.scroll_all
= true;
223 info
.action_callback
= dbg_threads_action_callback
;
224 info
.get_name
= threads_getname
;
225 return simplelist_show_list(&info
);
228 #ifdef HAVE_LCD_BITMAP
229 #if CONFIG_CODEC != SWCODEC
231 static bool dbg_audio_thread(void)
234 struct audio_debug d
;
236 lcd_setfont(FONT_SYSFIXED
);
240 if (action_userabort(HZ
/5))
243 audio_get_debugdata(&d
);
247 snprintf(buf
, sizeof(buf
), "read: %x", d
.audiobuf_read
);
249 snprintf(buf
, sizeof(buf
), "write: %x", d
.audiobuf_write
);
251 snprintf(buf
, sizeof(buf
), "swap: %x", d
.audiobuf_swapwrite
);
253 snprintf(buf
, sizeof(buf
), "playing: %d", d
.playing
);
255 snprintf(buf
, sizeof(buf
), "playable: %x", d
.playable_space
);
257 snprintf(buf
, sizeof(buf
), "unswapped: %x", d
.unswapped_space
);
260 /* Playable space left */
261 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8, 112, 4, d
.audiobuflen
, 0,
262 d
.playable_space
, HORIZONTAL
);
264 /* Show the watermark limit */
265 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, 6*8+4, 112, 4, d
.audiobuflen
, 0,
266 d
.low_watermark_level
, HORIZONTAL
);
268 snprintf(buf
, sizeof(buf
), "wm: %x - %x",
269 d
.low_watermark_level
, d
.lowest_watermark_level
);
274 lcd_setfont(FONT_UI
);
277 #endif /* !SIMULATOR */
278 #else /* CONFIG_CODEC == SWCODEC */
279 extern size_t filebuflen
;
280 /* This is a size_t, but call it a long so it puts a - when it's bad. */
282 static unsigned int ticks
, boost_ticks
, freq_sum
;
284 static void dbg_audio_task(void)
287 if(FREQ
> CPUFREQ_NORMAL
)
289 freq_sum
+= FREQ
/1000000; /* in MHz */
294 static bool dbg_buffering_thread(void)
301 size_t bufsize
= pcmbuf_get_bufsize();
302 int pcmbufdescs
= pcmbuf_descs();
303 struct buffering_debug d
;
305 ticks
= boost_ticks
= freq_sum
= 0;
307 tick_add_task(dbg_audio_task
);
309 lcd_setfont(FONT_SYSFIXED
);
312 button
= get_action(CONTEXT_STD
,HZ
/5);
315 case ACTION_STD_NEXT
:
318 case ACTION_STD_PREV
:
321 case ACTION_STD_CANCEL
:
326 buffering_get_debugdata(&d
);
331 bufused
= bufsize
- pcmbuf_free();
333 snprintf(buf
, sizeof(buf
), "pcm: %6ld/%ld", (long) bufused
, (long) bufsize
);
334 lcd_puts(0, line
++, buf
);
336 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
337 bufsize
, 0, bufused
, HORIZONTAL
);
340 snprintf(buf
, sizeof(buf
), "alloc: %6ld/%ld", audio_filebufused(),
342 lcd_puts(0, line
++, buf
);
345 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
346 filebuflen
, 0, audio_filebufused(), HORIZONTAL
);
349 snprintf(buf
, sizeof(buf
), "real: %6ld/%ld", (long)d
.buffered_data
,
351 lcd_puts(0, line
++, buf
);
353 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
354 filebuflen
, 0, (long)d
.buffered_data
, HORIZONTAL
);
358 snprintf(buf
, sizeof(buf
), "usefl: %6ld/%ld", (long)(d
.useful_data
),
360 lcd_puts(0, line
++, buf
);
363 gui_scrollbar_draw(&screens
[SCREEN_MAIN
],0, line
*8, LCD_WIDTH
, 6,
364 filebuflen
, 0, d
.useful_data
, HORIZONTAL
);
368 snprintf(buf
, sizeof(buf
), "data_rem: %ld", (long)d
.data_rem
);
369 lcd_puts(0, line
++, buf
);
371 snprintf(buf
, sizeof(buf
), "track count: %2d", audio_track_count());
372 lcd_puts(0, line
++, buf
);
374 snprintf(buf
, sizeof(buf
), "handle count: %d", (int)d
.num_handles
);
375 lcd_puts(0, line
++, buf
);
378 snprintf(buf
, sizeof(buf
), "cpu freq: %3dMHz",
379 (int)((FREQ
+ 500000) / 1000000));
380 lcd_puts(0, line
++, buf
);
385 int boostquota
= boost_ticks
* 1000 / ticks
; /* in 0.1 % */
386 int avgclock
= freq_sum
* 10 / ticks
; /* in 100 kHz */
387 snprintf(buf
, sizeof(buf
), "boost:%3d.%d%% (%d.%dMHz)",
388 boostquota
/10, boostquota
%10, avgclock
/10, avgclock
%10);
389 lcd_puts(0, line
++, buf
);
392 snprintf(buf
, sizeof(buf
), "pcmbufdesc: %2d/%2d",
393 pcmbuf_used_descs(), pcmbufdescs
);
394 lcd_puts(0, line
++, buf
);
395 snprintf(buf
, sizeof(buf
), "watermark: %6d",
397 lcd_puts(0, line
++, buf
);
402 tick_remove_task(dbg_audio_task
);
403 lcd_setfont(FONT_UI
);
407 #endif /* CONFIG_CODEC */
408 #endif /* HAVE_LCD_BITMAP */
411 #if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE))
412 /* Tool function to read the flash manufacturer and type, if available.
413 Only chips which could be reprogrammed in system will return values.
414 (The mode switch addresses vary between flash manufacturers, hence addr1/2) */
415 /* In IRAM to avoid problems when running directly from Flash */
416 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
417 unsigned addr1
, unsigned addr2
)
418 ICODE_ATTR
__attribute__((noinline
));
419 static bool dbg_flash_id(unsigned* p_manufacturer
, unsigned* p_device
,
420 unsigned addr1
, unsigned addr2
)
423 unsigned not_manu
, not_id
; /* read values before switching to ID mode */
424 unsigned manu
, id
; /* read values when in ID mode */
426 #if CONFIG_CPU == SH7034
427 volatile unsigned char* flash
= (unsigned char*)0x2000000; /* flash mapping */
428 #elif defined(CPU_COLDFIRE)
429 volatile unsigned short* flash
= (unsigned short*)0; /* flash mapping */
431 int old_level
; /* saved interrupt level */
433 not_manu
= flash
[0]; /* read the normal content */
434 not_id
= flash
[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */
436 /* disable interrupts, prevent any stray flash access */
437 old_level
= disable_irq_save();
439 flash
[addr1
] = 0xAA; /* enter command mode */
441 flash
[addr1
] = 0x90; /* ID command */
442 /* Atmel wants 20ms pause here */
443 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
445 manu
= flash
[0]; /* read the IDs */
448 flash
[0] = 0xF0; /* reset flash (back to normal read mode) */
449 /* Atmel wants 20ms pause here */
450 /* sleep(HZ/50); no sleeping possible while interrupts are disabled */
452 restore_irq(old_level
); /* enable interrupts again */
454 /* I assume success if the obtained values are different from
455 the normal flash content. This is not perfectly bulletproof, they
456 could theoretically be the same by chance, causing us to fail. */
457 if (not_manu
!= manu
|| not_id
!= id
) /* a value has changed */
459 *p_manufacturer
= manu
; /* return the results */
461 return true; /* success */
463 return false; /* fail */
465 #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
469 static int perfcheck(void)
475 "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */
478 "ldr r0, [%[timr]] \n"
479 "add r0, r0, %[tmo] \n"
481 "add %[res], %[res], #1 \n"
482 "ldr r1, [%[timr]] \n"
485 "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */
489 [timr
]"r"(&USEC_TIMER
),
491 #if CONFIG_CPU == PP5002
493 #else /* PP5020/5022/5024 */
504 #ifdef HAVE_LCD_BITMAP
505 static bool dbg_hw_info(void)
507 #if CONFIG_CPU == SH7034
509 int bitmask
= HW_MASK
;
510 int rom_version
= ROM_VERSION
;
511 unsigned manu
, id
; /* flash IDs */
512 bool got_id
; /* flag if we managed to get the flash IDs */
513 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
514 bool has_bootrom
; /* flag for boot ROM present */
515 int oldmode
; /* saved memory guard mode */
517 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
519 /* get flash ROM type */
520 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
522 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
524 /* check if the boot ROM area is a flash mirror */
525 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
526 if (has_bootrom
) /* if ROM and Flash different */
528 /* calculate CRC16 checksum of boot ROM */
529 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
532 system_memory_guard(oldmode
); /* re-enable memory guard */
534 lcd_setfont(FONT_SYSFIXED
);
537 lcd_puts(0, 0, "[Hardware info]");
539 snprintf(buf
, 32, "ROM: %d.%02d", rom_version
/100, rom_version
%100);
542 snprintf(buf
, 32, "Mask: 0x%04x", bitmask
);
546 snprintf(buf
, 32, "Flash: M=%02x D=%02x", manu
, id
);
548 snprintf(buf
, 32, "Flash: M=?? D=??"); /* unknown, sorry */
553 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
554 snprintf(buf
, 32, "Boot ROM: V1");
556 snprintf(buf
, 32, "ROMcrc: 0x%08x", rom_crc
);
560 snprintf(buf
, 32, "Boot ROM: none");
566 while (!(action_userabort(TIMEOUT_BLOCK
)));
568 #elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
570 unsigned manu
, id
; /* flash IDs */
571 int got_id
; /* flag if we managed to get the flash IDs */
572 int oldmode
; /* saved memory guard mode */
575 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
577 /* get flash ROM type */
578 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
580 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
582 system_memory_guard(oldmode
); /* re-enable memory guard */
584 lcd_setfont(FONT_SYSFIXED
);
587 lcd_puts(0, line
++, "[Hardware info]");
590 snprintf(buf
, 32, "Flash: M=%04x D=%04x", manu
, id
);
592 snprintf(buf
, 32, "Flash: M=???? D=????"); /* unknown, sorry */
593 lcd_puts(0, line
++, buf
);
599 lcd_puts(0, ++line
, "Serial Number:");
601 got_id
= ds2411_read_id(&id
);
603 if (got_id
== DS2411_OK
)
605 snprintf(buf
, 32, " FC=%02x", (unsigned)id
.family_code
);
606 lcd_puts(0, ++line
, buf
);
607 snprintf(buf
, 32, " ID=%02X %02X %02X %02X %02X %02X",
608 (unsigned)id
.uid
[0], (unsigned)id
.uid
[1], (unsigned)id
.uid
[2],
609 (unsigned)id
.uid
[3], (unsigned)id
.uid
[4], (unsigned)id
.uid
[5]);
610 lcd_puts(0, ++line
, buf
);
611 snprintf(buf
, 32, " CRC=%02X", (unsigned)id
.crc
);
615 snprintf(buf
, 32, "READ ERR=%d", got_id
);
618 lcd_puts(0, ++line
, buf
);
624 while (!(action_userabort(TIMEOUT_BLOCK
)));
626 #elif defined(CPU_PP502x)
629 char pp_version
[] = { (PP_VER2
>> 24) & 0xff, (PP_VER2
>> 16) & 0xff,
630 (PP_VER2
>> 8) & 0xff, (PP_VER2
) & 0xff,
631 (PP_VER1
>> 24) & 0xff, (PP_VER1
>> 16) & 0xff,
632 (PP_VER1
>> 8) & 0xff, (PP_VER1
) & 0xff, '\0' };
634 lcd_setfont(FONT_SYSFIXED
);
637 lcd_puts(0, line
++, "[Hardware info]");
640 snprintf(buf
, sizeof(buf
), "HW rev: 0x%08lx", IPOD_HW_REVISION
);
641 lcd_puts(0, line
++, buf
);
645 extern int lcd_type
; /* Defined in lcd-colornano.c */
647 snprintf(buf
, sizeof(buf
), "LCD type: %d", lcd_type
);
648 lcd_puts(0, line
++, buf
);
651 snprintf(buf
, sizeof(buf
), "PP version: %s", pp_version
);
652 lcd_puts(0, line
++, buf
);
654 snprintf(buf
, sizeof(buf
), "Est. clock (kHz): %d", perfcheck());
655 lcd_puts(0, line
++, buf
);
659 while (!(action_userabort(TIMEOUT_BLOCK
)));
661 #elif CONFIG_CPU == PP5002
664 char pp_version
[] = { (PP_VER4
>> 8) & 0xff, PP_VER4
& 0xff,
665 (PP_VER3
>> 8) & 0xff, PP_VER3
& 0xff,
666 (PP_VER2
>> 8) & 0xff, PP_VER2
& 0xff,
667 (PP_VER1
>> 8) & 0xff, PP_VER1
& 0xff, '\0' };
670 lcd_setfont(FONT_SYSFIXED
);
673 lcd_puts(0, line
++, "[Hardware info]");
676 snprintf(buf
, sizeof(buf
), "HW rev: 0x%08lx", IPOD_HW_REVISION
);
677 lcd_puts(0, line
++, buf
);
680 snprintf(buf
, sizeof(buf
), "PP version: %s", pp_version
);
681 lcd_puts(0, line
++, buf
);
683 snprintf(buf
, sizeof(buf
), "Est. clock (kHz): %d", perfcheck());
684 lcd_puts(0, line
++, buf
);
688 while (!(action_userabort(TIMEOUT_BLOCK
)));
691 /* Define this function in your target tree */
692 return __dbg_hw_info();
693 #endif /* CONFIG_CPU */
694 lcd_setfont(FONT_UI
);
697 #else /* !HAVE_LCD_BITMAP */
698 static bool dbg_hw_info(void)
703 int rom_version
= ROM_VERSION
;
704 unsigned manu
, id
; /* flash IDs */
705 bool got_id
; /* flag if we managed to get the flash IDs */
706 unsigned rom_crc
= 0xffffffff; /* CRC32 of the boot ROM */
707 bool has_bootrom
; /* flag for boot ROM present */
708 int oldmode
; /* saved memory guard mode */
710 oldmode
= system_memory_guard(MEMGUARD_NONE
); /* disable memory guard */
712 /* get flash ROM type */
713 got_id
= dbg_flash_id(&manu
, &id
, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
715 got_id
= dbg_flash_id(&manu
, &id
, 0x555, 0x2AA); /* try AMD, Macronix */
717 /* check if the boot ROM area is a flash mirror */
718 has_bootrom
= (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
719 if (has_bootrom
) /* if ROM and Flash different */
721 /* calculate CRC16 checksum of boot ROM */
722 rom_crc
= crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
725 system_memory_guard(oldmode
); /* re-enable memory guard */
729 lcd_puts(0, 0, "[HW Info]");
735 snprintf(buf
, 32, "ROM: %d.%02d",
736 rom_version
/100, rom_version
%100);
740 snprintf(buf
, 32, "Flash:%02x,%02x", manu
, id
);
742 snprintf(buf
, 32, "Flash:??,??"); /* unknown, sorry */
747 if (rom_crc
== 0x56DBA4EE) /* known Version 1 */
748 snprintf(buf
, 32, "BootROM: V1");
749 else if (rom_crc
== 0x358099E8)
750 snprintf(buf
, 32, "BootROM: V2");
751 /* alternative boot ROM found in one single player so far */
753 snprintf(buf
, 32, "R: %08x", rom_crc
);
756 snprintf(buf
, 32, "BootROM: no");
762 button
= get_action(CONTEXT_SETTINGS
,TIMEOUT_BLOCK
);
766 case ACTION_STD_CANCEL
:
769 case ACTION_SETTINGS_DEC
:
775 case ACTION_SETTINGS_INC
:
784 #endif /* !HAVE_LCD_BITMAP */
785 #endif /* !SIMULATOR */
788 static char* dbg_partitions_getname(int selected_item
, void *data
,
789 char *buffer
, size_t buffer_len
)
792 int partition
= selected_item
/2;
793 struct partinfo
* p
= disk_partinfo(partition
);
796 snprintf(buffer
, buffer_len
, " T:%x %ld MB", p
->type
, p
->size
/ 2048);
800 snprintf(buffer
, buffer_len
, "P%d: S:%lx", partition
, p
->start
);
805 bool dbg_partitions(void)
807 struct simplelist_info info
;
808 simplelist_info_init(&info
, "Partition Info", 4, NULL
);
809 info
.selection_size
= 2;
810 info
.hide_selection
= true;
811 info
.scroll_all
= true;
812 info
.get_name
= dbg_partitions_getname
;
813 return simplelist_show_list(&info
);
817 #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
818 static bool dbg_spdif(void)
822 unsigned int control
;
827 unsigned int interruptstat
;
828 bool valnogood
, symbolerr
, parityerr
;
831 int spdif_source
= spdif_get_output_source(&spdif_src_on
);
832 spdif_set_output_source(AUDIO_SRC_SPDIF
IF_SPDIF_POWER_(, true));
835 lcd_setfont(FONT_SYSFIXED
);
837 #ifdef HAVE_SPDIF_POWER
838 spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
845 control
= EBU1RCVCCHANNEL1
;
846 interruptstat
= INTERRUPTSTAT
;
847 INTERRUPTCLEAR
= 0x03c00000;
849 valnogood
= (interruptstat
& 0x01000000)?true:false;
850 symbolerr
= (interruptstat
& 0x00800000)?true:false;
851 parityerr
= (interruptstat
& 0x00400000)?true:false;
853 snprintf(buf
, sizeof(buf
), "Val: %s Sym: %s Par: %s",
856 parityerr
?"--":"OK");
857 lcd_puts(0, line
++, buf
);
859 snprintf(buf
, sizeof(buf
), "Status word: %08x", (int)control
);
860 lcd_puts(0, line
++, buf
);
865 snprintf(buf
, sizeof(buf
), "PRO: %d (%s)",
866 x
, x
?"Professional":"Consumer");
867 lcd_puts(0, line
++, buf
);
869 x
= (control
>> 30) & 1;
870 snprintf(buf
, sizeof(buf
), "Audio: %d (%s)",
871 x
, x
?"Non-PCM":"PCM");
872 lcd_puts(0, line
++, buf
);
874 x
= (control
>> 29) & 1;
875 snprintf(buf
, sizeof(buf
), "Copy: %d (%s)",
876 x
, x
?"Permitted":"Inhibited");
877 lcd_puts(0, line
++, buf
);
879 x
= (control
>> 27) & 7;
892 snprintf(buf
, sizeof(buf
), "Preemphasis: %d (%s)", x
, s
);
893 lcd_puts(0, line
++, buf
);
895 x
= (control
>> 24) & 3;
896 snprintf(buf
, sizeof(buf
), "Mode: %d", x
);
897 lcd_puts(0, line
++, buf
);
899 category
= (control
>> 17) & 127;
911 snprintf(buf
, sizeof(buf
), "Category: 0x%02x (%s)", category
, s
);
912 lcd_puts(0, line
++, buf
);
914 x
= (control
>> 16) & 1;
916 if(((category
& 0x70) == 0x10) ||
917 ((category
& 0x70) == 0x40) ||
918 ((category
& 0x78) == 0x38))
920 generation
= !generation
;
922 snprintf(buf
, sizeof(buf
), "Generation: %d (%s)",
923 x
, generation
?"Original":"No ind.");
924 lcd_puts(0, line
++, buf
);
926 x
= (control
>> 12) & 15;
927 snprintf(buf
, sizeof(buf
), "Source: %d", x
);
928 lcd_puts(0, line
++, buf
);
930 x
= (control
>> 8) & 15;
946 snprintf(buf
, sizeof(buf
), "Channel: %d (%s)", x
, s
);
947 lcd_puts(0, line
++, buf
);
949 x
= (control
>> 4) & 15;
962 snprintf(buf
, sizeof(buf
), "Frequency: %d (%s)", x
, s
);
963 lcd_puts(0, line
++, buf
);
965 x
= (control
>> 2) & 3;
966 snprintf(buf
, sizeof(buf
), "Clock accuracy: %d", x
);
967 lcd_puts(0, line
++, buf
);
971 snprintf(buf
, sizeof(buf
), "Measured freq: %ldHz",
972 spdif_measure_frequency());
973 lcd_puts(0, line
++, buf
);
978 if (action_userabort(HZ
/10))
982 spdif_set_output_source(spdif_source
IF_SPDIF_POWER_(, spdif_src_on
));
984 #ifdef HAVE_SPDIF_POWER
985 spdif_power_enable(global_settings
.spdif_enable
);
988 lcd_setfont(FONT_UI
);
991 #endif /* CPU_COLDFIRE */
994 #ifdef HAVE_LCD_BITMAP
995 /* button definitions */
996 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
997 (CONFIG_KEYPAD == IRIVER_H300_PAD)
998 # define DEBUG_CANCEL BUTTON_OFF
1000 #elif CONFIG_KEYPAD == RECORDER_PAD
1001 # define DEBUG_CANCEL BUTTON_OFF
1003 #elif CONFIG_KEYPAD == ONDIO_PAD
1004 # define DEBUG_CANCEL BUTTON_MENU
1006 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
1007 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
1008 (CONFIG_KEYPAD == IPOD_4G_PAD)
1009 # define DEBUG_CANCEL BUTTON_MENU
1011 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
1012 # define DEBUG_CANCEL BUTTON_PLAY
1014 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
1015 # define DEBUG_CANCEL BUTTON_REC
1017 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
1018 # define DEBUG_CANCEL BUTTON_RC_REC
1020 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
1021 # define DEBUG_CANCEL BUTTON_REW
1023 #elif (CONFIG_KEYPAD == MROBE100_PAD)
1024 # define DEBUG_CANCEL BUTTON_MENU
1026 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
1027 (CONFIG_KEYPAD == SANSA_C200_PAD)
1028 # define DEBUG_CANCEL BUTTON_LEFT
1030 /* This is temporary until the SA9200 touchpad works */
1031 #elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
1032 (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
1033 # define DEBUG_CANCEL BUTTON_POWER
1035 #endif /* key definitions */
1038 bool dbg_ports(void)
1040 #if CONFIG_CPU == SH7034
1042 int adc_battery_voltage
, adc_battery_level
;
1044 lcd_setfont(FONT_SYSFIXED
);
1045 lcd_clear_display();
1049 snprintf(buf
, 32, "PADR: %04x", (unsigned short)PADR
);
1050 lcd_puts(0, 0, buf
);
1051 snprintf(buf
, 32, "PBDR: %04x", (unsigned short)PBDR
);
1052 lcd_puts(0, 1, buf
);
1054 snprintf(buf
, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
1055 lcd_puts(0, 2, buf
);
1056 snprintf(buf
, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
1057 lcd_puts(0, 3, buf
);
1058 snprintf(buf
, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
1059 lcd_puts(0, 4, buf
);
1060 snprintf(buf
, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
1061 lcd_puts(0, 5, buf
);
1063 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1064 snprintf(buf
, 32, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1065 adc_battery_voltage
% 1000, adc_battery_level
);
1066 lcd_puts(0, 6, buf
);
1069 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1071 lcd_setfont(FONT_UI
);
1075 #elif defined(CPU_COLDFIRE)
1076 unsigned int gpio_out
;
1077 unsigned int gpio1_out
;
1078 unsigned int gpio_read
;
1079 unsigned int gpio1_read
;
1080 unsigned int gpio_function
;
1081 unsigned int gpio1_function
;
1082 unsigned int gpio_enable
;
1083 unsigned int gpio1_enable
;
1084 int adc_buttons
, adc_remote
;
1085 int adc_battery_voltage
, adc_battery_level
;
1089 lcd_clear_display();
1090 lcd_setfont(FONT_SYSFIXED
);
1095 gpio_read
= GPIO_READ
;
1096 gpio1_read
= GPIO1_READ
;
1097 gpio_out
= GPIO_OUT
;
1098 gpio1_out
= GPIO1_OUT
;
1099 gpio_function
= GPIO_FUNCTION
;
1100 gpio1_function
= GPIO1_FUNCTION
;
1101 gpio_enable
= GPIO_ENABLE
;
1102 gpio1_enable
= GPIO1_ENABLE
;
1104 snprintf(buf
, sizeof(buf
), "GPIO_READ: %08x", gpio_read
);
1105 lcd_puts(0, line
++, buf
);
1106 snprintf(buf
, sizeof(buf
), "GPIO_OUT: %08x", gpio_out
);
1107 lcd_puts(0, line
++, buf
);
1108 snprintf(buf
, sizeof(buf
), "GPIO_FUNC: %08x", gpio_function
);
1109 lcd_puts(0, line
++, buf
);
1110 snprintf(buf
, sizeof(buf
), "GPIO_ENA: %08x", gpio_enable
);
1111 lcd_puts(0, line
++, buf
);
1113 snprintf(buf
, sizeof(buf
), "GPIO1_READ: %08x", gpio1_read
);
1114 lcd_puts(0, line
++, buf
);
1115 snprintf(buf
, sizeof(buf
), "GPIO1_OUT: %08x", gpio1_out
);
1116 lcd_puts(0, line
++, buf
);
1117 snprintf(buf
, sizeof(buf
), "GPIO1_FUNC: %08x", gpio1_function
);
1118 lcd_puts(0, line
++, buf
);
1119 snprintf(buf
, sizeof(buf
), "GPIO1_ENA: %08x", gpio1_enable
);
1120 lcd_puts(0, line
++, buf
);
1122 adc_buttons
= adc_read(ADC_BUTTONS
);
1123 adc_remote
= adc_read(ADC_REMOTE
);
1124 battery_read_info(&adc_battery_voltage
, &adc_battery_level
);
1125 #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
1126 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS (%c): %02x",
1127 button_scan_enabled() ? '+' : '-', adc_buttons
);
1129 snprintf(buf
, sizeof(buf
), "ADC_BUTTONS: %02x", adc_buttons
);
1131 lcd_puts(0, line
++, buf
);
1132 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
1133 snprintf(buf
, sizeof(buf
), "ADC_REMOTE (%c): %02x",
1134 remote_detect() ? '+' : '-', adc_remote
);
1136 snprintf(buf
, sizeof(buf
), "ADC_REMOTE: %02x", adc_remote
);
1138 lcd_puts(0, line
++, buf
);
1139 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1140 snprintf(buf
, sizeof(buf
), "ADC_REMOTEDETECT: %02x",
1141 adc_read(ADC_REMOTEDETECT
));
1142 lcd_puts(0, line
++, buf
);
1145 snprintf(buf
, 32, "Batt: %d.%03dV %d%% ", adc_battery_voltage
/ 1000,
1146 adc_battery_voltage
% 1000, adc_battery_level
);
1147 lcd_puts(0, line
++, buf
);
1149 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1150 snprintf(buf
, sizeof(buf
), "remotetype: %d", remote_type());
1151 lcd_puts(0, line
++, buf
);
1155 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1157 lcd_setfont(FONT_UI
);
1162 #elif defined(CPU_PP502x)
1167 lcd_clear_display();
1168 lcd_setfont(FONT_SYSFIXED
);
1173 lcd_puts(0, line
++, "GPIO STATES:");
1174 snprintf(buf
, sizeof(buf
), "A: %02x E: %02x I: %02x",
1175 (unsigned int)GPIOA_INPUT_VAL
,
1176 (unsigned int)GPIOE_INPUT_VAL
,
1177 (unsigned int)GPIOI_INPUT_VAL
);
1178 lcd_puts(0, line
++, buf
);
1179 snprintf(buf
, sizeof(buf
), "B: %02x F: %02x J: %02x",
1180 (unsigned int)GPIOB_INPUT_VAL
,
1181 (unsigned int)GPIOF_INPUT_VAL
,
1182 (unsigned int)GPIOJ_INPUT_VAL
);
1183 lcd_puts(0, line
++, buf
);
1184 snprintf(buf
, sizeof(buf
), "C: %02x G: %02x K: %02x",
1185 (unsigned int)GPIOC_INPUT_VAL
,
1186 (unsigned int)GPIOG_INPUT_VAL
,
1187 (unsigned int)GPIOK_INPUT_VAL
);
1188 lcd_puts(0, line
++, buf
);
1189 snprintf(buf
, sizeof(buf
), "D: %02x H: %02x L: %02x",
1190 (unsigned int)GPIOD_INPUT_VAL
,
1191 (unsigned int)GPIOH_INPUT_VAL
,
1192 (unsigned int)GPIOL_INPUT_VAL
);
1193 lcd_puts(0, line
++, buf
);
1195 snprintf(buf
, sizeof(buf
), "GPO32_VAL: %08lx", GPO32_VAL
);
1196 lcd_puts(0, line
++, buf
);
1197 snprintf(buf
, sizeof(buf
), "GPO32_EN: %08lx", GPO32_ENABLE
);
1198 lcd_puts(0, line
++, buf
);
1199 snprintf(buf
, sizeof(buf
), "DEV_EN: %08lx", DEV_EN
);
1200 lcd_puts(0, line
++, buf
);
1201 snprintf(buf
, sizeof(buf
), "DEV_EN2: %08lx", DEV_EN2
);
1202 lcd_puts(0, line
++, buf
);
1203 snprintf(buf
, sizeof(buf
), "DEV_EN3: %08lx", inl(0x60006044));
1204 lcd_puts(0, line
++, buf
); /* to be verified */
1205 snprintf(buf
, sizeof(buf
), "DEV_INIT1: %08lx", DEV_INIT1
);
1206 lcd_puts(0, line
++, buf
);
1207 snprintf(buf
, sizeof(buf
), "DEV_INIT2: %08lx", DEV_INIT2
);
1208 lcd_puts(0, line
++, buf
);
1209 #ifdef ADC_ACCESSORY
1210 snprintf(buf
, sizeof(buf
), "ACCESSORY: %d", adc_read(ADC_ACCESSORY
));
1211 lcd_puts(0, line
++, buf
);
1214 #if defined(IPOD_ACCESSORY_PROTOCOL)
1215 extern unsigned char serbuf
[];
1216 snprintf(buf
, sizeof(buf
), "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
1217 serbuf
[0], serbuf
[1], serbuf
[2], serbuf
[3], serbuf
[4], serbuf
[5],
1218 serbuf
[6], serbuf
[7]);
1219 lcd_puts(0, line
++, buf
);
1222 #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1224 snprintf(buf
, sizeof(buf
), "BATT: %03x UNK1: %03x",
1225 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1226 lcd_puts(0, line
++, buf
);
1227 snprintf(buf
, sizeof(buf
), "REM: %03x PAD: %03x",
1228 adc_read(ADC_REMOTE
), adc_read(ADC_SCROLLPAD
));
1229 lcd_puts(0, line
++, buf
);
1230 #elif defined(PHILIPS_HDD1630)
1232 snprintf(buf
, sizeof(buf
), "BATT: %03x UNK1: %03x",
1233 adc_read(ADC_BATTERY
), adc_read(ADC_UNKNOWN_1
));
1234 lcd_puts(0, line
++, buf
);
1235 #elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
1236 snprintf(buf
, sizeof(buf
), "ADC_BVDD: %4d", adc_read(ADC_BVDD
));
1237 lcd_puts(0, line
++, buf
);
1238 snprintf(buf
, sizeof(buf
), "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP
));
1239 lcd_puts(0, line
++, buf
);
1240 snprintf(buf
, sizeof(buf
), "ADC_UVDD: %4d", adc_read(ADC_UVDD
));
1241 lcd_puts(0, line
++, buf
);
1242 snprintf(buf
, sizeof(buf
), "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN
));
1243 lcd_puts(0, line
++, buf
);
1244 snprintf(buf
, sizeof(buf
), "ADC_CVDD: %4d", adc_read(ADC_CVDD
));
1245 lcd_puts(0, line
++, buf
);
1246 snprintf(buf
, sizeof(buf
), "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP
));
1247 lcd_puts(0, line
++, buf
);
1248 snprintf(buf
, sizeof(buf
), "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1
));
1249 lcd_puts(0, line
++, buf
);
1250 snprintf(buf
, sizeof(buf
), "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2
));
1251 lcd_puts(0, line
++, buf
);
1252 snprintf(buf
, sizeof(buf
), "ADC_VBE1: %4d", adc_read(ADC_VBE1
));
1253 lcd_puts(0, line
++, buf
);
1254 snprintf(buf
, sizeof(buf
), "ADC_VBE2: %4d", adc_read(ADC_VBE2
));
1255 lcd_puts(0, line
++, buf
);
1256 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1
));
1257 lcd_puts(0, line
++, buf
);
1258 #if !defined(PHILIPS_SA9200)
1259 snprintf(buf
, sizeof(buf
), "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2
));
1260 lcd_puts(0, line
++, buf
);
1261 snprintf(buf
, sizeof(buf
), "ADC_VBAT: %4d", adc_read(ADC_VBAT
));
1262 lcd_puts(0, line
++, buf
);
1266 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1268 lcd_setfont(FONT_UI
);
1273 #elif CONFIG_CPU == PP5002
1277 lcd_clear_display();
1278 lcd_setfont(FONT_SYSFIXED
);
1283 snprintf(buf
, sizeof(buf
), "GPIO_A: %02x GPIO_B: %02x",
1284 (unsigned int)GPIOA_INPUT_VAL
, (unsigned int)GPIOB_INPUT_VAL
);
1285 lcd_puts(0, line
++, buf
);
1286 snprintf(buf
, sizeof(buf
), "GPIO_C: %02x GPIO_D: %02x",
1287 (unsigned int)GPIOC_INPUT_VAL
, (unsigned int)GPIOD_INPUT_VAL
);
1288 lcd_puts(0, line
++, buf
);
1290 snprintf(buf
, sizeof(buf
), "DEV_EN: %08lx", DEV_EN
);
1291 lcd_puts(0, line
++, buf
);
1292 snprintf(buf
, sizeof(buf
), "CLOCK_ENABLE: %08lx", CLOCK_ENABLE
);
1293 lcd_puts(0, line
++, buf
);
1294 snprintf(buf
, sizeof(buf
), "CLOCK_SOURCE: %08lx", CLOCK_SOURCE
);
1295 lcd_puts(0, line
++, buf
);
1296 snprintf(buf
, sizeof(buf
), "PLL_CONTROL: %08lx", PLL_CONTROL
);
1297 lcd_puts(0, line
++, buf
);
1298 snprintf(buf
, sizeof(buf
), "PLL_DIV: %08lx", PLL_DIV
);
1299 lcd_puts(0, line
++, buf
);
1300 snprintf(buf
, sizeof(buf
), "PLL_MULT: %08lx", PLL_MULT
);
1301 lcd_puts(0, line
++, buf
);
1302 snprintf(buf
, sizeof(buf
), "TIMING1_CTL: %08lx", TIMING1_CTL
);
1303 lcd_puts(0, line
++, buf
);
1304 snprintf(buf
, sizeof(buf
), "TIMING2_CTL: %08lx", TIMING2_CTL
);
1305 lcd_puts(0, line
++, buf
);
1308 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1310 lcd_setfont(FONT_UI
);
1314 lcd_setfont(FONT_UI
);
1316 return __dbg_ports();
1320 #else /* !HAVE_LCD_BITMAP */
1321 bool dbg_ports(void)
1325 int adc_battery_voltage
;
1328 lcd_clear_display();
1335 snprintf(buf
, 32, "PADR: %04x", (unsigned short)PADR
);
1338 snprintf(buf
, 32, "PBDR: %04x", (unsigned short)PBDR
);
1341 snprintf(buf
, 32, "AN0: %03x", adc_read(0));
1344 snprintf(buf
, 32, "AN1: %03x", adc_read(1));
1347 snprintf(buf
, 32, "AN2: %03x", adc_read(2));
1350 snprintf(buf
, 32, "AN3: %03x", adc_read(3));
1353 snprintf(buf
, 32, "AN4: %03x", adc_read(4));
1356 snprintf(buf
, 32, "AN5: %03x", adc_read(5));
1359 snprintf(buf
, 32, "AN6: %03x", adc_read(6));
1362 snprintf(buf
, 32, "AN7: %03x", adc_read(7));
1365 lcd_puts(0, 0, buf
);
1367 battery_read_info(&adc_battery_voltage
, NULL
);
1368 snprintf(buf
, 32, "Batt: %d.%03dV", adc_battery_voltage
/ 1000,
1369 adc_battery_voltage
% 1000);
1370 lcd_puts(0, 1, buf
);
1373 button
= get_action(CONTEXT_SETTINGS
,HZ
/5);
1377 case ACTION_STD_CANCEL
:
1380 case ACTION_SETTINGS_DEC
:
1386 case ACTION_SETTINGS_INC
:
1395 #endif /* !HAVE_LCD_BITMAP */
1396 #endif /* !SIMULATOR */
1398 #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
1399 static bool dbg_pcf(void)
1404 #ifdef HAVE_LCD_BITMAP
1405 lcd_setfont(FONT_SYSFIXED
);
1407 lcd_clear_display();
1413 snprintf(buf
, sizeof(buf
), "DCDC1: %02x", pcf50605_read(0x1b));
1414 lcd_puts(0, line
++, buf
);
1415 snprintf(buf
, sizeof(buf
), "DCDC2: %02x", pcf50605_read(0x1c));
1416 lcd_puts(0, line
++, buf
);
1417 snprintf(buf
, sizeof(buf
), "DCDC3: %02x", pcf50605_read(0x1d));
1418 lcd_puts(0, line
++, buf
);
1419 snprintf(buf
, sizeof(buf
), "DCDC4: %02x", pcf50605_read(0x1e));
1420 lcd_puts(0, line
++, buf
);
1421 snprintf(buf
, sizeof(buf
), "DCDEC1: %02x", pcf50605_read(0x1f));
1422 lcd_puts(0, line
++, buf
);
1423 snprintf(buf
, sizeof(buf
), "DCDEC2: %02x", pcf50605_read(0x20));
1424 lcd_puts(0, line
++, buf
);
1425 snprintf(buf
, sizeof(buf
), "DCUDC1: %02x", pcf50605_read(0x21));
1426 lcd_puts(0, line
++, buf
);
1427 snprintf(buf
, sizeof(buf
), "DCUDC2: %02x", pcf50605_read(0x22));
1428 lcd_puts(0, line
++, buf
);
1429 snprintf(buf
, sizeof(buf
), "IOREGC: %02x", pcf50605_read(0x23));
1430 lcd_puts(0, line
++, buf
);
1431 snprintf(buf
, sizeof(buf
), "D1REGC: %02x", pcf50605_read(0x24));
1432 lcd_puts(0, line
++, buf
);
1433 snprintf(buf
, sizeof(buf
), "D2REGC: %02x", pcf50605_read(0x25));
1434 lcd_puts(0, line
++, buf
);
1435 snprintf(buf
, sizeof(buf
), "D3REGC: %02x", pcf50605_read(0x26));
1436 lcd_puts(0, line
++, buf
);
1437 snprintf(buf
, sizeof(buf
), "LPREG1: %02x", pcf50605_read(0x27));
1438 lcd_puts(0, line
++, buf
);
1441 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
1443 lcd_setfont(FONT_UI
);
1448 lcd_setfont(FONT_UI
);
1453 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
1454 static bool dbg_cpufreq(void)
1460 #ifdef HAVE_LCD_BITMAP
1461 lcd_setfont(FONT_SYSFIXED
);
1463 lcd_clear_display();
1469 snprintf(buf
, sizeof(buf
), "Frequency: %ld", FREQ
);
1470 lcd_puts(0, line
++, buf
);
1472 snprintf(buf
, sizeof(buf
), "boost_counter: %d", get_cpu_boost_counter());
1473 lcd_puts(0, line
++, buf
);
1476 button
= get_action(CONTEXT_STD
,HZ
/10);
1480 case ACTION_STD_PREV
:
1484 case ACTION_STD_NEXT
:
1489 while (get_cpu_boost_counter() > 0)
1491 set_cpu_frequency(CPUFREQ_DEFAULT
);
1494 case ACTION_STD_CANCEL
:
1495 lcd_setfont(FONT_UI
);
1499 lcd_setfont(FONT_UI
);
1502 #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1504 #if defined(HAVE_TSC2100) && !defined(SIMULATOR)
1505 #include "tsc2100.h"
1506 static char *itob(int n
, int len
)
1508 static char binary
[64];
1510 for (i
=1, j
=0;i
<=len
;i
++)
1512 binary
[j
++] = n
&(1<<(len
-i
))?'1':'0';
1519 static char* tsc2100_debug_getname(int selected_item
, void * data
,
1520 char *buffer
, size_t buffer_len
)
1522 int *page
= (int*)data
;
1523 bool reserved
= false;
1527 if ((selected_item
> 0x0a) ||
1528 (selected_item
== 0x04) ||
1529 (selected_item
== 0x08))
1533 if ((selected_item
> 0x05) ||
1534 (selected_item
== 0x02))
1538 if (selected_item
> 0x1e)
1543 snprintf(buffer
, buffer_len
, "%02x: RESERVED", selected_item
);
1545 snprintf(buffer
, buffer_len
, "%02x: %s", selected_item
,
1546 itob(tsc2100_readreg(*page
, selected_item
)&0xffff,16));
1549 static int tsc2100debug_action_callback(int action
, struct gui_synclist
*lists
)
1551 int *page
= (int*)lists
->data
;
1552 if (action
== ACTION_STD_OK
)
1554 *page
= (*page
+1)%3;
1555 snprintf(lists
->title
, 32,
1556 "tsc2100 registers - Page %d", *page
);
1557 return ACTION_REDRAW
;
1561 static bool tsc2100_debug(void)
1564 char title
[32] = "tsc2100 registers - Page 0";
1565 struct simplelist_info info
;
1566 simplelist_info_init(&info
, title
, 32, &page
);
1567 info
.timeout
= HZ
/100;
1568 info
.get_name
= tsc2100_debug_getname
;
1569 info
.action_callback
= tsc2100debug_action_callback
;
1570 return simplelist_show_list(&info
);
1574 #ifdef HAVE_LCD_BITMAP
1576 * view_battery() shows a automatically scaled graph of the battery voltage
1577 * over time. Usable for estimating battery life / charging rate.
1578 * The power_history array is updated in power_thread of powermgmt.c.
1581 #define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
1582 #define BAT_YSPACE (LCD_HEIGHT - 20)
1584 static bool view_battery(void)
1588 unsigned short maxv
, minv
;
1591 lcd_setfont(FONT_SYSFIXED
);
1595 lcd_clear_display();
1597 case 0: /* voltage history graph */
1598 /* Find maximum and minimum voltage for scaling */
1599 minv
= power_history
[0];
1601 for (i
= 1; i
< BAT_LAST_VAL
&& power_history
[i
]; i
++) {
1602 if (power_history
[i
] > maxv
)
1603 maxv
= power_history
[i
];
1604 if (power_history
[i
] < minv
)
1605 minv
= power_history
[i
];
1608 snprintf(buf
, 30, "Battery %d.%03d", power_history
[0] / 1000,
1609 power_history
[0] % 1000);
1610 lcd_puts(0, 0, buf
);
1611 snprintf(buf
, 30, "scale %d.%03d-%d.%03dV",
1612 minv
/ 1000, minv
% 1000, maxv
/ 1000, maxv
% 1000);
1613 lcd_puts(0, 1, buf
);
1616 for (i
= BAT_LAST_VAL
- 1; i
>= 0; i
--) {
1617 y
= (power_history
[i
] - minv
) * BAT_YSPACE
/ (maxv
- minv
);
1618 lcd_set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
1619 lcd_vline(x
, LCD_HEIGHT
-1, 20);
1620 lcd_set_drawmode(DRMODE_SOLID
);
1621 lcd_vline(x
, LCD_HEIGHT
-1,
1622 MIN(MAX(LCD_HEIGHT
-1 - y
, 20), LCD_HEIGHT
-1));
1628 case 1: /* status: */
1629 lcd_puts(0, 0, "Power status:");
1631 battery_read_info(&y
, NULL
);
1632 snprintf(buf
, 30, "Battery: %d.%03d V", y
/ 1000, y
% 1000);
1633 lcd_puts(0, 1, buf
);
1634 #ifdef ADC_EXT_POWER
1635 y
= (adc_read(ADC_EXT_POWER
) * EXT_SCALE_FACTOR
) / 1000;
1636 snprintf(buf
, 30, "External: %d.%03d V", y
/ 1000, y
% 1000);
1637 lcd_puts(0, 2, buf
);
1640 #if defined ARCHOS_RECORDER
1641 snprintf(buf
, 30, "Chgr: %s %s",
1642 charger_inserted() ? "present" : "absent",
1643 charger_enabled() ? "on" : "off");
1644 lcd_puts(0, 3, buf
);
1645 snprintf(buf
, 30, "short delta: %d", short_delta
);
1646 lcd_puts(0, 5, buf
);
1647 snprintf(buf
, 30, "long delta: %d", long_delta
);
1648 lcd_puts(0, 6, buf
);
1649 lcd_puts(0, 7, power_message
);
1650 snprintf(buf
, 30, "USB Inserted: %s",
1651 usb_inserted() ? "yes" : "no");
1652 lcd_puts(0, 8, buf
);
1653 #elif defined IRIVER_H300_SERIES
1654 snprintf(buf
, 30, "USB Charging Enabled: %s",
1655 usb_charging_enabled() ? "yes" : "no");
1656 lcd_puts(0, 9, buf
);
1657 #elif defined IPOD_NANO || defined IPOD_VIDEO
1658 int usb_pwr
= (GPIOL_INPUT_VAL
& 0x10)?true:false;
1659 int ext_pwr
= (GPIOL_INPUT_VAL
& 0x08)?false:true;
1660 int dock
= (GPIOA_INPUT_VAL
& 0x10)?true:false;
1661 int charging
= (GPIOB_INPUT_VAL
& 0x01)?false:true;
1662 int headphone
= (GPIOA_INPUT_VAL
& 0x80)?true:false;
1664 snprintf(buf
, 30, "USB pwr: %s",
1665 usb_pwr
? "present" : "absent");
1666 lcd_puts(0, 3, buf
);
1667 snprintf(buf
, 30, "EXT pwr: %s",
1668 ext_pwr
? "present" : "absent");
1669 lcd_puts(0, 4, buf
);
1670 snprintf(buf
, 30, "Battery: %s",
1671 charging
? "charging" : (usb_pwr
||ext_pwr
) ? "charged" : "discharging");
1672 lcd_puts(0, 5, buf
);
1673 snprintf(buf
, 30, "Dock mode: %s",
1674 dock
? "enabled" : "disabled");
1675 lcd_puts(0, 6, buf
);
1676 snprintf(buf
, 30, "Headphone: %s",
1677 headphone
? "connected" : "disconnected");
1678 lcd_puts(0, 7, buf
);
1679 #elif defined TOSHIBA_GIGABEAT_S
1683 static const unsigned char * const chrgstate_strings
[] =
1694 snprintf(buf
, 30, "Charger: %s",
1695 charger_inserted() ? "present" : "absent");
1696 lcd_puts(0, line
++, buf
);
1698 st
= power_input_status() &
1699 (POWER_INPUT_CHARGER
| POWER_INPUT_BATTERY
);
1700 snprintf(buf
, 30, "%s%s",
1701 (st
& POWER_INPUT_MAIN_CHARGER
) ? " Main" : "",
1702 (st
& POWER_INPUT_USB_CHARGER
) ? " USB" : "");
1703 lcd_puts(0, line
++, buf
);
1705 snprintf(buf
, 30, "IUSB Max: %d", usb_allowed_current());
1706 lcd_puts(0, line
++, buf
);
1708 y
= ARRAYLEN(chrgstate_strings
) - 1;
1710 switch (charge_state
)
1712 case CHARGE_STATE_DISABLED
: y
--;
1713 case CHARGE_STATE_ERROR
: y
--;
1714 case DISCHARGING
: y
--;
1721 snprintf(buf
, 30, "State: %s", chrgstate_strings
[y
]);
1722 lcd_puts(0, line
++, buf
);
1724 snprintf(buf
, 30, "Battery Switch: %s",
1725 (st
& POWER_INPUT_BATTERY
) ? "On" : "Off");
1726 lcd_puts(0, line
++, buf
);
1728 y
= chrgraw_adc_voltage();
1729 snprintf(buf
, 30, "CHRGRAW: %d.%03d V",
1730 y
/ 1000, y
% 1000);
1731 lcd_puts(0, line
++, buf
);
1733 y
= application_supply_adc_voltage();
1734 snprintf(buf
, 30, "BP : %d.%03d V",
1735 y
/ 1000, y
% 1000);
1736 lcd_puts(0, line
++, buf
);
1738 y
= battery_adc_charge_current();
1739 if (y
< 0) x
= '-', y
= -y
;
1741 snprintf(buf
, 30, "CHRGISN:%c%d mA", x
, y
);
1742 lcd_puts(0, line
++, buf
);
1744 y
= cccv_regulator_dissipation();
1745 snprintf(buf
, 30, "P CCCV : %d mW", y
);
1746 lcd_puts(0, line
++, buf
);
1748 y
= battery_charge_current();
1749 if (y
< 0) x
= '-', y
= -y
;
1751 snprintf(buf
, 30, "I Charge:%c%d mA", x
, y
);
1752 lcd_puts(0, line
++, buf
);
1754 y
= battery_adc_temp();
1757 snprintf(buf
, 30, "T Battery: %dC (%dF)", y
,
1760 /* Conversion disabled */
1761 snprintf(buf
, 30, "T Battery: ?");
1764 lcd_puts(0, line
++, buf
);
1765 #elif defined(SANSA_E200) || defined(SANSA_C200) || defined(SANSA_CLIP)
1766 const int first
= CHARGE_STATE_DISABLED
;
1767 static const char * const chrgstate_strings
[] =
1769 [CHARGE_STATE_DISABLED
-first
] = "Disabled",
1770 [CHARGE_STATE_ERROR
-first
] = "Error",
1771 [DISCHARGING
-first
] = "Discharging",
1772 [CHARGING
-first
] = "Charging",
1774 const char *str
= NULL
;
1776 snprintf(buf
, 30, "Charger: %s",
1777 charger_inserted() ? "present" : "absent");
1778 lcd_puts(0, 3, buf
);
1780 y
= charge_state
- first
;
1781 if ((unsigned)y
< ARRAYLEN(chrgstate_strings
))
1782 str
= chrgstate_strings
[y
];
1784 snprintf(buf
, sizeof(buf
), "State: %s",
1785 str
? str
: "<unknown>");
1786 lcd_puts(0, 4, buf
);
1788 snprintf(buf
, sizeof(buf
), "CHARGER: %02X",
1789 ascodec_read(AS3514_CHARGER
));
1790 lcd_puts(0, 5, buf
);
1792 snprintf(buf
, 30, "Charger: %s",
1793 charger_inserted() ? "present" : "absent");
1794 lcd_puts(0, 3, buf
);
1795 #endif /* target type */
1796 #endif /* CONFIG_CHARGING */
1799 case 2: /* voltage deltas: */
1800 lcd_puts(0, 0, "Voltage deltas:");
1802 for (i
= 0; i
<= 6; i
++) {
1803 y
= power_history
[i
] - power_history
[i
+1];
1804 snprintf(buf
, 30, "-%d min: %s%d.%03d V", i
,
1805 (y
< 0) ? "-" : "", ((y
< 0) ? y
* -1 : y
) / 1000,
1806 ((y
< 0) ? y
* -1 : y
) % 1000);
1807 lcd_puts(0, i
+1, buf
);
1811 case 3: /* remaining time estimation: */
1813 #ifdef ARCHOS_RECORDER
1814 snprintf(buf
, 30, "charge_state: %d", charge_state
);
1815 lcd_puts(0, 0, buf
);
1817 snprintf(buf
, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min
);
1818 lcd_puts(0, 1, buf
);
1820 snprintf(buf
, 30, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level
);
1821 lcd_puts(0, 2, buf
);
1823 snprintf(buf
, 30, "P=%2d I=%2d", pid_p
, pid_i
);
1824 lcd_puts(0, 3, buf
);
1826 snprintf(buf
, 30, "Trickle sec: %d/60", trickle_sec
);
1827 lcd_puts(0, 4, buf
);
1828 #endif /* ARCHOS_RECORDER */
1830 snprintf(buf
, 30, "Last PwrHist: %d.%03dV",
1831 power_history
[0] / 1000,
1832 power_history
[0] % 1000);
1833 lcd_puts(0, 5, buf
);
1835 snprintf(buf
, 30, "battery level: %d%%", battery_level());
1836 lcd_puts(0, 6, buf
);
1838 snprintf(buf
, 30, "Est. remain: %d m", battery_time());
1839 lcd_puts(0, 7, buf
);
1845 switch(get_action(CONTEXT_STD
,HZ
/2))
1847 case ACTION_STD_PREV
:
1852 case ACTION_STD_NEXT
:
1857 case ACTION_STD_CANCEL
:
1858 lcd_setfont(FONT_UI
);
1862 lcd_setfont(FONT_UI
);
1866 #endif /* HAVE_LCD_BITMAP */
1870 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
1872 #if (CONFIG_STORAGE & STORAGE_MMC)
1873 #define CARDTYPE "MMC"
1874 #elif (CONFIG_STORAGE & STORAGE_SD)
1875 #define CARDTYPE "microSD"
1878 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1881 int *cardnum
= (int*)lists
->data
;
1882 unsigned char card_name
[7];
1883 unsigned char pbuf
[32];
1884 char *title
= lists
->title
;
1885 static const unsigned char i_vmin
[] = { 0, 1, 5, 10, 25, 35, 60, 100 };
1886 static const unsigned char i_vmax
[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
1887 static const unsigned char *kbit_units
[] = { "kBit/s", "MBit/s", "GBit/s" };
1888 static const unsigned char *nsec_units
[] = { "ns", "µs", "ms" };
1889 static const char *spec_vers
[] = { "1.0-1.2", "1.4", "2.0-2.2",
1890 "3.1-3.31", "4.0" };
1891 if ((btn
== ACTION_STD_OK
) || (btn
== SYS_FS_CHANGED
) || (btn
== ACTION_REDRAW
))
1894 if (btn
== ACTION_STD_OK
)
1896 *cardnum
^= 0x1; /* change cards */
1900 simplelist_set_line_count(0);
1902 card
= card_get_info(*cardnum
);
1904 if (card
->initialized
> 0)
1906 card_name
[6] = '\0';
1907 strncpy(card_name
, ((unsigned char*)card
->cid
) + 3, 6);
1908 simplelist_addline(SIMPLELIST_ADD_LINE
,
1909 "%s Rev %d.%d", card_name
,
1910 (int) card_extract_bits(card
->cid
, 72, 4),
1911 (int) card_extract_bits(card
->cid
, 76, 4));
1912 simplelist_addline(SIMPLELIST_ADD_LINE
,
1914 (int) card_extract_bits(card
->cid
, 112, 4),
1915 (int) card_extract_bits(card
->cid
, 116, 4) + 1997);
1916 simplelist_addline(SIMPLELIST_ADD_LINE
,
1918 card_extract_bits(card
->cid
, 80, 32));
1919 simplelist_addline(SIMPLELIST_ADD_LINE
,
1921 (int) card_extract_bits(card
->cid
, 0, 8),
1922 (int) card_extract_bits(card
->cid
, 8, 16));
1923 int temp
= card_extract_bits(card
->csd
, 2, 4);
1924 simplelist_addline(SIMPLELIST_ADD_LINE
,
1925 CARDTYPE
" v%s", temp
< 5 ?
1926 spec_vers
[temp
] : "?.?");
1927 simplelist_addline(SIMPLELIST_ADD_LINE
,
1928 "Blocks: 0x%08lx", card
->numblocks
);
1929 output_dyn_value(pbuf
, sizeof pbuf
, card
->speed
/ 1000,
1931 simplelist_addline(SIMPLELIST_ADD_LINE
,
1933 output_dyn_value(pbuf
, sizeof pbuf
, card
->tsac
,
1935 simplelist_addline(SIMPLELIST_ADD_LINE
,
1937 simplelist_addline(SIMPLELIST_ADD_LINE
,
1938 "Nsac: %d clk", card
->nsac
);
1939 simplelist_addline(SIMPLELIST_ADD_LINE
,
1940 "R2W: *%d", card
->r2w_factor
);
1941 simplelist_addline(SIMPLELIST_ADD_LINE
,
1943 i_vmin
[card_extract_bits(card
->csd
, 66, 3)],
1944 i_vmax
[card_extract_bits(card
->csd
, 69, 3)]);
1945 simplelist_addline(SIMPLELIST_ADD_LINE
,
1947 i_vmin
[card_extract_bits(card
->csd
, 72, 3)],
1948 i_vmax
[card_extract_bits(card
->csd
, 75, 3)]);
1950 else if (card
->initialized
== 0)
1952 simplelist_addline(SIMPLELIST_ADD_LINE
, "Not Found!");
1954 #if (CONFIG_STORAGE & STORAGE_SD)
1955 else /* card->initialized < 0 */
1957 simplelist_addline(SIMPLELIST_ADD_LINE
, "Init Error! (%d)", card
->initialized
);
1960 snprintf(title
, 16, "[" CARDTYPE
" %d]", *cardnum
);
1961 gui_synclist_set_title(lists
, title
, Icon_NOICON
);
1962 gui_synclist_set_nb_items(lists
, simplelist_get_line_count());
1963 gui_synclist_select_item(lists
, 0);
1964 btn
= ACTION_REDRAW
;
1968 #elif (CONFIG_STORAGE & STORAGE_ATA)
1969 static int disk_callback(int btn
, struct gui_synclist
*lists
)
1974 unsigned short* identify_info
= ata_get_identify();
1975 bool timing_info_present
= false;
1978 simplelist_set_line_count(0);
1980 for (i
=0; i
< 20; i
++)
1981 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+27]);
1983 /* kill trailing space */
1984 for (i
=39; i
&& buf
[i
]==' '; i
--)
1986 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", buf
);
1987 for (i
=0; i
< 4; i
++)
1988 ((unsigned short*)buf
)[i
]=htobe16(identify_info
[i
+23]);
1990 simplelist_addline(SIMPLELIST_ADD_LINE
,
1991 "Firmware: %s", buf
);
1992 snprintf(buf
, sizeof buf
, "%ld MB",
1993 ((unsigned long)identify_info
[61] << 16 |
1994 (unsigned long)identify_info
[60]) / 2048 );
1995 simplelist_addline(SIMPLELIST_ADD_LINE
,
1998 fat_size( IF_MV2(0,) NULL
, &free
);
1999 simplelist_addline(SIMPLELIST_ADD_LINE
,
2000 "Free: %ld MB", free
/ 1024);
2001 simplelist_addline(SIMPLELIST_ADD_LINE
,
2002 "Spinup time: %d ms", storage_spinup_time() * (1000/HZ
));
2003 i
= identify_info
[83] & (1<<3);
2004 simplelist_addline(SIMPLELIST_ADD_LINE
,
2005 "Power mgmt: %s", i
? "enabled" : "unsupported");
2006 i
= identify_info
[83] & (1<<9);
2007 simplelist_addline(SIMPLELIST_ADD_LINE
,
2008 "Noise mgmt: %s", i
? "enabled" : "unsupported");
2009 i
= identify_info
[82] & (1<<6);
2010 simplelist_addline(SIMPLELIST_ADD_LINE
,
2011 "Read-ahead: %s", i
? "enabled" : "unsupported");
2012 timing_info_present
= identify_info
[53] & (1<<1);
2013 if(timing_info_present
) {
2014 char pio3
[2], pio4
[2];pio3
[1] = 0;
2016 pio3
[0] = (identify_info
[64] & (1<<0)) ? '3' : 0;
2017 pio4
[0] = (identify_info
[64] & (1<<1)) ? '4' : 0;
2018 simplelist_addline(SIMPLELIST_ADD_LINE
,
2019 "PIO modes: 0 1 2 %s %s", pio3
, pio4
);
2022 simplelist_addline(SIMPLELIST_ADD_LINE
,
2023 "No PIO mode info");
2025 timing_info_present
= identify_info
[53] & (1<<1);
2026 if(timing_info_present
) {
2027 simplelist_addline(SIMPLELIST_ADD_LINE
,
2028 "Cycle times %dns/%dns",
2030 identify_info
[68] );
2032 simplelist_addline(SIMPLELIST_ADD_LINE
,
2035 #if defined (TOSHIBA_GIGABEAT_F) || defined (TOSHIBA_GIGABEAT_S)
2036 if (identify_info
[63] & (1<<0)) {
2037 char mdma0
[2], mdma1
[2], mdma2
[2];
2038 mdma0
[1] = mdma1
[1] = mdma2
[1] = 0;
2039 mdma0
[0] = (identify_info
[63] & (1<<0)) ? '0' : 0;
2040 mdma1
[0] = (identify_info
[63] & (1<<1)) ? '1' : 0;
2041 mdma2
[0] = (identify_info
[63] & (1<<2)) ? '2' : 0;
2042 simplelist_addline(SIMPLELIST_ADD_LINE
,
2043 "MDMA modes: %s %s %s", mdma0
, mdma1
, mdma2
);
2044 simplelist_addline(SIMPLELIST_ADD_LINE
,
2045 "MDMA Cycle times %dns/%dns",
2047 identify_info
[66] );
2050 simplelist_addline(SIMPLELIST_ADD_LINE
,
2051 "No MDMA mode info");
2053 if (identify_info
[88] & (1<<0)) {
2054 char udma0
[2], udma1
[2], udma2
[2], udma3
[2], udma4
[2], udma5
[2];
2055 udma0
[1] = udma1
[1] = udma2
[1] = udma3
[1] = udma4
[1] = udma5
[1] = 0;
2056 udma0
[0] = (identify_info
[88] & (1<<0)) ? '0' : 0;
2057 udma1
[0] = (identify_info
[88] & (1<<1)) ? '1' : 0;
2058 udma2
[0] = (identify_info
[88] & (1<<2)) ? '2' : 0;
2059 udma3
[0] = (identify_info
[88] & (1<<3)) ? '3' : 0;
2060 udma4
[0] = (identify_info
[88] & (1<<4)) ? '4' : 0;
2061 udma5
[0] = (identify_info
[88] & (1<<5)) ? '5' : 0;
2062 simplelist_addline(SIMPLELIST_ADD_LINE
,
2063 "UDMA modes: %s %s %s %s %s %s", udma0
, udma1
, udma2
,
2064 udma3
, udma4
, udma5
);
2067 simplelist_addline(SIMPLELIST_ADD_LINE
,
2068 "No UDMA mode info");
2070 #endif /* defined (TOSHIBA_GIGABEAT_F) || defined (TOSHIBA_GIGABEAT_S) */
2071 timing_info_present
= identify_info
[53] & (1<<1);
2072 if(timing_info_present
) {
2073 i
= identify_info
[49] & (1<<11);
2074 simplelist_addline(SIMPLELIST_ADD_LINE
,
2075 "IORDY support: %s", i
? "yes" : "no");
2076 i
= identify_info
[49] & (1<<10);
2077 simplelist_addline(SIMPLELIST_ADD_LINE
,
2078 "IORDY disable: %s", i
? "yes" : "no");
2080 simplelist_addline(SIMPLELIST_ADD_LINE
,
2083 simplelist_addline(SIMPLELIST_ADD_LINE
,
2084 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2087 #else /* No SD, MMC or ATA */
2088 static int disk_callback(int btn
, struct gui_synclist
*lists
)
2092 struct storage_info info
;
2093 storage_get_info(0,&info
);
2094 simplelist_addline(SIMPLELIST_ADD_LINE
, "Vendor: %s", info
.vendor
);
2095 simplelist_addline(SIMPLELIST_ADD_LINE
, "Model: %s", info
.product
);
2096 simplelist_addline(SIMPLELIST_ADD_LINE
, "Firmware: %s", info
.revision
);
2097 simplelist_addline(SIMPLELIST_ADD_LINE
,
2098 "Size: %ld MB", info
.num_sectors
*(info
.sector_size
/512)/2024);
2100 fat_size( IF_MV2(0,) NULL
, &free
);
2101 simplelist_addline(SIMPLELIST_ADD_LINE
,
2102 "Free: %ld MB", free
/ 1024);
2103 simplelist_addline(SIMPLELIST_ADD_LINE
,
2104 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
2109 #if (CONFIG_STORAGE & STORAGE_ATA)
2110 static bool dbg_identify_info(void)
2112 int fd
= creat("/identify_info.bin");
2115 #ifdef ROCKBOX_LITTLE_ENDIAN
2116 ecwrite(fd
, ata_get_identify(), SECTOR_SIZE
/2, "s", true);
2118 write(fd
, ata_get_identify(), SECTOR_SIZE
);
2126 static bool dbg_disk_info(void)
2128 struct simplelist_info info
;
2129 simplelist_info_init(&info
, "Disk Info", 1, NULL
);
2130 #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
2133 info
.callback_data
= (void*)&card
;
2136 info
.action_callback
= disk_callback
;
2137 info
.hide_selection
= true;
2138 info
.scroll_all
= true;
2139 return simplelist_show_list(&info
);
2141 #endif /* !SIMULATOR */
2143 #ifdef HAVE_DIRCACHE
2144 static int dircache_callback(int btn
, struct gui_synclist
*lists
)
2146 (void)btn
; (void)lists
;
2147 simplelist_set_line_count(0);
2148 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache initialized: %s",
2149 dircache_is_enabled() ? "Yes" : "No");
2150 simplelist_addline(SIMPLELIST_ADD_LINE
, "Cache size: %d B",
2151 dircache_get_cache_size());
2152 simplelist_addline(SIMPLELIST_ADD_LINE
, "Last size: %d B",
2153 global_status
.dircache_size
);
2154 simplelist_addline(SIMPLELIST_ADD_LINE
, "Limit: %d B",
2156 simplelist_addline(SIMPLELIST_ADD_LINE
, "Reserve: %d/%d B",
2157 dircache_get_reserve_used(), DIRCACHE_RESERVE
);
2158 simplelist_addline(SIMPLELIST_ADD_LINE
, "Scanning took: %d s",
2159 dircache_get_build_ticks() / HZ
);
2160 simplelist_addline(SIMPLELIST_ADD_LINE
, "Entry count: %d",
2161 dircache_get_entry_count());
2165 static bool dbg_dircache_info(void)
2167 struct simplelist_info info
;
2168 simplelist_info_init(&info
, "Dircache Info", 7, NULL
);
2169 info
.action_callback
= dircache_callback
;
2170 info
.hide_selection
= true;
2171 info
.scroll_all
= true;
2172 return simplelist_show_list(&info
);
2175 #endif /* HAVE_DIRCACHE */
2177 #ifdef HAVE_TAGCACHE
2178 static int database_callback(int btn
, struct gui_synclist
*lists
)
2181 struct tagcache_stat
*stat
= tagcache_get_stat();
2182 static bool synced
= false;
2184 simplelist_set_line_count(0);
2186 simplelist_addline(SIMPLELIST_ADD_LINE
, "Initialized: %s",
2187 stat
->initialized
? "Yes" : "No");
2188 simplelist_addline(SIMPLELIST_ADD_LINE
, "DB Ready: %s",
2189 stat
->ready
? "Yes" : "No");
2190 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM Cache: %s",
2191 stat
->ramcache
? "Yes" : "No");
2192 simplelist_addline(SIMPLELIST_ADD_LINE
, "RAM: %d/%d B",
2193 stat
->ramcache_used
, stat
->ramcache_allocated
);
2194 simplelist_addline(SIMPLELIST_ADD_LINE
, "Progress: %d%% (%d entries)",
2195 stat
->progress
, stat
->processed_entries
);
2196 simplelist_addline(SIMPLELIST_ADD_LINE
, "Curfile: %s",
2197 stat
->curentry
? stat
->curentry
: "---");
2198 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit step: %d",
2200 simplelist_addline(SIMPLELIST_ADD_LINE
, "Commit delayed: %s",
2201 stat
->commit_delayed
? "Yes" : "No");
2203 simplelist_addline(SIMPLELIST_ADD_LINE
, "Queue length: %d",
2204 stat
->queue_length
);
2209 tagcache_screensync_event();
2212 if (!btn
&& stat
->curentry
)
2215 return ACTION_REDRAW
;
2218 if (btn
== ACTION_STD_CANCEL
)
2219 tagcache_screensync_enable(false);
2223 static bool dbg_tagcache_info(void)
2225 struct simplelist_info info
;
2226 simplelist_info_init(&info
, "Database Info", 8, NULL
);
2227 info
.action_callback
= database_callback
;
2228 info
.hide_selection
= true;
2229 info
.scroll_all
= true;
2231 /* Don't do nonblock here, must give enough processing time
2232 for tagcache thread. */
2233 /* info.timeout = TIMEOUT_NOBLOCK; */
2235 tagcache_screensync_enable(true);
2236 return simplelist_show_list(&info
);
2240 #if CONFIG_CPU == SH7034
2241 static bool dbg_save_roms(void)
2244 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2246 fd
= creat("/internal_rom_0000-FFFF.bin");
2249 write(fd
, (void *)0, 0x10000);
2253 fd
= creat("/internal_rom_2000000-203FFFF.bin");
2256 write(fd
, (void *)0x2000000, 0x40000);
2260 system_memory_guard(oldmode
);
2263 #elif defined CPU_COLDFIRE
2264 static bool dbg_save_roms(void)
2267 int oldmode
= system_memory_guard(MEMGUARD_NONE
);
2269 #if defined(IRIVER_H100_SERIES)
2270 fd
= creat("/internal_rom_000000-1FFFFF.bin");
2271 #elif defined(IRIVER_H300_SERIES)
2272 fd
= creat("/internal_rom_000000-3FFFFF.bin");
2273 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3)
2274 fd
= creat("/internal_rom_000000-3FFFFF.bin");
2278 write(fd
, (void *)0, FLASH_SIZE
);
2281 system_memory_guard(oldmode
);
2284 fd
= creat("/internal_eeprom.bin");
2288 char buf
[EEPROM_SIZE
];
2291 old_irq_level
= disable_irq_save();
2293 err
= eeprom_24cxx_read(0, buf
, sizeof buf
);
2295 restore_irq(old_irq_level
);
2298 splashf(HZ
*3, "Eeprom read failure (%d)", err
);
2301 write(fd
, buf
, sizeof buf
);
2310 #elif defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)
2311 static bool dbg_save_roms(void)
2315 fd
= creat("/internal_rom_000000-0FFFFF.bin");
2318 write(fd
, (void *)0x20000000, FLASH_SIZE
);
2328 static int radio_callback(int btn
, struct gui_synclist
*lists
)
2331 if (btn
== ACTION_STD_CANCEL
)
2333 simplelist_set_line_count(1);
2335 #if (CONFIG_TUNER & LV24020LP)
2336 simplelist_addline(SIMPLELIST_ADD_LINE
,
2337 "CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT
) );
2338 simplelist_addline(SIMPLELIST_ADD_LINE
,
2339 "RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT
) );
2340 simplelist_addline(SIMPLELIST_ADD_LINE
,
2341 "MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM
) );
2342 simplelist_addline(SIMPLELIST_ADD_LINE
,
2343 "MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF
) );
2344 simplelist_addline(SIMPLELIST_ADD_LINE
,
2345 "MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD
) );
2346 simplelist_addline(SIMPLELIST_ADD_LINE
,
2347 "if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET
) );
2348 simplelist_addline(SIMPLELIST_ADD_LINE
,
2349 "sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET
) );
2350 #endif /* LV24020LP */
2351 #if (CONFIG_TUNER & S1A0903X01)
2352 simplelist_addline(SIMPLELIST_ADD_LINE
,
2353 "Samsung regs: %08X", s1a0903x01_get(RADIO_ALL
));
2354 /* This one doesn't return dynamic data atm */
2355 #endif /* S1A0903X01 */
2356 #if (CONFIG_TUNER & TEA5767)
2357 struct tea5767_dbg_info nfo
;
2358 tea5767_dbg_info(&nfo
);
2359 simplelist_addline(SIMPLELIST_ADD_LINE
, "Philips regs:");
2360 simplelist_addline(SIMPLELIST_ADD_LINE
,
2361 " Read: %02X %02X %02X %02X %02X",
2362 (unsigned)nfo
.read_regs
[0], (unsigned)nfo
.read_regs
[1],
2363 (unsigned)nfo
.read_regs
[2], (unsigned)nfo
.read_regs
[3],
2364 (unsigned)nfo
.read_regs
[4]);
2365 simplelist_addline(SIMPLELIST_ADD_LINE
,
2366 " Write: %02X %02X %02X %02X %02X",
2367 (unsigned)nfo
.write_regs
[0], (unsigned)nfo
.write_regs
[1],
2368 (unsigned)nfo
.write_regs
[2], (unsigned)nfo
.write_regs
[3],
2369 (unsigned)nfo
.write_regs
[4]);
2370 #endif /* TEA5767 */
2371 #if (CONFIG_TUNER & SI4700)
2372 struct si4700_dbg_info nfo
;
2373 si4700_dbg_info(&nfo
);
2374 simplelist_addline(SIMPLELIST_ADD_LINE
, "SI4700 regs:");
2376 simplelist_addline(SIMPLELIST_ADD_LINE
,
2377 "%04X %04X %04X %04X",
2378 (unsigned)nfo
.regs
[0], (unsigned)nfo
.regs
[1],
2379 (unsigned)nfo
.regs
[2], (unsigned)nfo
.regs
[3]);
2380 simplelist_addline(SIMPLELIST_ADD_LINE
,
2381 "%04X %04X %04X %04X",
2382 (unsigned)nfo
.regs
[4], (unsigned)nfo
.regs
[5],
2383 (unsigned)nfo
.regs
[6], (unsigned)nfo
.regs
[7]);
2384 simplelist_addline(SIMPLELIST_ADD_LINE
,
2385 "%04X %04X %04X %04X",
2386 (unsigned)nfo
.regs
[8], (unsigned)nfo
.regs
[9],
2387 (unsigned)nfo
.regs
[10], (unsigned)nfo
.regs
[11]);
2388 simplelist_addline(SIMPLELIST_ADD_LINE
,
2389 "%04X %04X %04X %04X",
2390 (unsigned)nfo
.regs
[12], (unsigned)nfo
.regs
[13],
2391 (unsigned)nfo
.regs
[14], (unsigned)nfo
.regs
[15]);
2393 return ACTION_REDRAW
;
2395 static bool dbg_fm_radio(void)
2397 struct simplelist_info info
;
2398 info
.scroll_all
= true;
2399 simplelist_info_init(&info
, "FM Radio", 1, NULL
);
2400 simplelist_set_line_count(0);
2401 simplelist_addline(SIMPLELIST_ADD_LINE
, "HW detected: %s",
2402 radio_hardware_present() ? "yes" : "no");
2404 info
.action_callback
= radio_hardware_present()?radio_callback
: NULL
;
2405 info
.hide_selection
= true;
2406 return simplelist_show_list(&info
);
2408 #endif /* CONFIG_TUNER */
2409 #endif /* !SIMULATOR */
2411 #ifdef HAVE_LCD_BITMAP
2412 extern bool do_screendump_instead_of_usb
;
2414 static bool dbg_screendump(void)
2416 do_screendump_instead_of_usb
= !do_screendump_instead_of_usb
;
2417 splashf(HZ
, "Screendump %s",
2418 do_screendump_instead_of_usb
?"enabled":"disabled");
2421 #endif /* HAVE_LCD_BITMAP */
2423 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2424 static bool dbg_set_memory_guard(void)
2426 static const struct opt_items names
[MAXMEMGUARD
] = {
2428 { "Flash ROM writes", -1 },
2429 { "Zero area (all)", -1 }
2431 int mode
= system_memory_guard(MEMGUARD_KEEP
);
2433 set_option( "Catch mem accesses", &mode
, INT
, names
, MAXMEMGUARD
, NULL
);
2434 system_memory_guard(mode
);
2438 #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
2440 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2441 static bool dbg_write_eeprom(void)
2446 char buf
[EEPROM_SIZE
];
2449 fd
= open("/internal_eeprom.bin", O_RDONLY
);
2453 rc
= read(fd
, buf
, EEPROM_SIZE
);
2455 if(rc
== EEPROM_SIZE
)
2457 old_irq_level
= disable_irq_save();
2459 err
= eeprom_24cxx_write(0, buf
, sizeof buf
);
2461 splashf(HZ
*3, "Eeprom write failure (%d)", err
);
2463 splash(HZ
*3, "Eeprom written successfully");
2465 restore_irq(old_irq_level
);
2469 splashf(HZ
*3, "File read error (%d)",rc
);
2475 splash(HZ
*3, "Failed to open 'internal_eeprom.bin'");
2480 #endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
2481 #ifdef CPU_BOOST_LOGGING
2482 static bool cpu_boost_log(void)
2485 int count
= cpu_boost_log_getcount();
2486 int lines
= LCD_HEIGHT
/SYSFONT_HEIGHT
;
2489 lcd_setfont(FONT_SYSFIXED
);
2490 str
= cpu_boost_log_getlog_first();
2493 lcd_clear_display();
2494 for(j
=0; j
<lines
; j
++,i
++)
2497 str
= cpu_boost_log_getlog_next();
2508 switch(get_action(CONTEXT_STD
,TIMEOUT_BLOCK
))
2511 case ACTION_STD_PREV
:
2512 case ACTION_STD_NEXT
:
2515 case ACTION_STD_CANCEL
:
2522 get_action(CONTEXT_STD
,TIMEOUT_BLOCK
);
2523 lcd_setfont(FONT_UI
);
2528 #if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR))
2529 extern bool wheel_is_touched
;
2530 extern int old_wheel_value
;
2531 extern int new_wheel_value
;
2532 extern int wheel_delta
;
2533 extern unsigned int accumulated_wheel_delta
;
2534 extern unsigned int wheel_velocity
;
2536 static bool dbg_scrollwheel(void)
2541 lcd_setfont(FONT_SYSFIXED
);
2545 if (action_userabort(HZ
/10))
2548 lcd_clear_display();
2550 /* show internal variables of scrollwheel driver */
2551 snprintf(buf
, sizeof(buf
), "wheel touched: %s", (wheel_is_touched
) ? "true" : "false");
2552 lcd_puts(0, 0, buf
);
2553 snprintf(buf
, sizeof(buf
), "new position: %2d", new_wheel_value
);
2554 lcd_puts(0, 1, buf
);
2555 snprintf(buf
, sizeof(buf
), "old position: %2d", old_wheel_value
);
2556 lcd_puts(0, 2, buf
);
2557 snprintf(buf
, sizeof(buf
), "wheel delta: %2d", wheel_delta
);
2558 lcd_puts(0, 3, buf
);
2559 snprintf(buf
, sizeof(buf
), "accumulated delta: %2d", accumulated_wheel_delta
);
2560 lcd_puts(0, 4, buf
);
2561 snprintf(buf
, sizeof(buf
), "velo [deg/s]: %4d", (int)wheel_velocity
);
2562 lcd_puts(0, 5, buf
);
2564 /* show effective accelerated scrollspeed */
2565 speed
= button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity
);
2566 snprintf(buf
, sizeof(buf
), "accel. speed: %4d", speed
);
2567 lcd_puts(0, 6, buf
);
2571 lcd_setfont(FONT_UI
);
2576 #if defined(HAVE_USBSTACK) && defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
2577 static bool logf_usb_serial(void)
2579 bool serial_enabled
= !usb_core_driver_enabled(USB_DRIVER_SERIAL
);
2580 usb_core_enable_driver(USB_DRIVER_SERIAL
,serial_enabled
);
2581 splashf(HZ
, "USB logf %s",
2582 serial_enabled
?"enabled":"disabled");
2587 #if 0 && defined(HAVE_USBSTACK) && defined(USB_STORAGE)
2588 static bool usb_reconnect(void)
2590 splash(HZ
, "Reconnect mass storage");
2591 usb_storage_reconnect();
2596 #if CONFIG_USBOTG == USBOTG_ISP1583
2597 extern int dbg_usb_num_items(void);
2598 extern char* dbg_usb_item(int selected_item
, void *data
, char *buffer
, size_t buffer_len
);
2600 static int isp1583_action_callback(int action
, struct gui_synclist
*lists
)
2603 if (action
== ACTION_NONE
)
2604 action
= ACTION_REDRAW
;
2608 static bool dbg_isp1583(void)
2610 struct simplelist_info isp1583
;
2611 isp1583
.scroll_all
= true;
2612 simplelist_info_init(&isp1583
, "ISP1583", dbg_usb_num_items(), NULL
);
2613 isp1583
.timeout
= HZ
/100;
2614 isp1583
.hide_selection
= true;
2615 isp1583
.get_name
= dbg_usb_item
;
2616 isp1583
.action_callback
= isp1583_action_callback
;
2617 return simplelist_show_list(&isp1583
);
2621 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2622 extern int pic_dbg_num_items(void);
2623 extern char* pic_dbg_item(int selected_item
, void *data
, char *buffer
, size_t buffer_len
);
2625 static int pic_action_callback(int action
, struct gui_synclist
*lists
)
2628 if (action
== ACTION_NONE
)
2629 action
= ACTION_REDRAW
;
2633 static bool dbg_pic(void)
2635 struct simplelist_info pic
;
2636 pic
.scroll_all
= true;
2637 simplelist_info_init(&pic
, "PIC", pic_dbg_num_items(), NULL
);
2638 pic
.timeout
= HZ
/100;
2639 pic
.hide_selection
= true;
2640 pic
.get_name
= pic_dbg_item
;
2641 pic
.action_callback
= pic_action_callback
;
2642 return simplelist_show_list(&pic
);
2647 /****** The menu *********/
2648 struct the_menu_item
{
2649 unsigned char *desc
; /* string or ID */
2650 bool (*function
) (void); /* return true if USB was connected */
2652 static const struct the_menu_item menuitems
[] = {
2653 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2654 (defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD))
2655 { "Dump ROM contents", dbg_save_roms
},
2657 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \
2658 || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525
2659 { "View I/O ports", dbg_ports
},
2661 #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
2662 { "View PCF registers", dbg_pcf
},
2664 #if defined(HAVE_TSC2100) && !defined(SIMULATOR)
2665 { "TSC2100 debug", tsc2100_debug
},
2667 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
2668 { "CPU frequency", dbg_cpufreq
},
2670 #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
2671 { "S/PDIF analyzer", dbg_spdif
},
2673 #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2674 { "Catch mem accesses", dbg_set_memory_guard
},
2676 { "View OS stacks", dbg_os
},
2677 #ifdef HAVE_LCD_BITMAP
2679 { "View battery", view_battery
},
2681 { "Screendump", dbg_screendump
},
2684 { "View HW info", dbg_hw_info
},
2687 { "View partitions", dbg_partitions
},
2690 { "View disk info", dbg_disk_info
},
2691 #if (CONFIG_STORAGE & STORAGE_ATA)
2692 { "Dump ATA identify info", dbg_identify_info
},
2695 #ifdef HAVE_DIRCACHE
2696 { "View dircache info", dbg_dircache_info
},
2698 #ifdef HAVE_TAGCACHE
2699 { "View database info", dbg_tagcache_info
},
2701 #ifdef HAVE_LCD_BITMAP
2702 #if CONFIG_CODEC == SWCODEC
2703 { "View buffering thread", dbg_buffering_thread
},
2704 #elif !defined(SIMULATOR)
2705 { "View audio thread", dbg_audio_thread
},
2708 { "pm histogram", peak_meter_histogram
},
2709 #endif /* PM_DEBUG */
2710 #endif /* HAVE_LCD_BITMAP */
2713 { "FM Radio", dbg_fm_radio
},
2716 #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2717 { "Write back EEPROM", dbg_write_eeprom
},
2719 #if CONFIG_USBOTG == USBOTG_ISP1583
2720 { "View ISP1583 info", dbg_isp1583
},
2722 #if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
2723 { "View PIC info", dbg_pic
},
2725 #ifdef ROCKBOX_HAS_LOGF
2726 {"logf", logfdisplay
},
2727 {"logfdump", logfdump
},
2729 #if defined(HAVE_USBSTACK) && defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
2730 {"logf over usb",logf_usb_serial
},
2732 #if 0 && defined(HAVE_USBSTACK) && defined(USB_STORAGE)
2733 {"reconnect usb storage",usb_reconnect
},
2735 #ifdef CPU_BOOST_LOGGING
2736 {"cpu_boost log",cpu_boost_log
},
2738 #if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD) && !defined(SIMULATOR))
2739 {"Debug scrollwheel", dbg_scrollwheel
},
2742 static int menu_action_callback(int btn
, struct gui_synclist
*lists
)
2744 if (btn
== ACTION_STD_OK
)
2746 int oldbars
= viewportmanager_set_statusbar(VP_SB_HIDE_ALL
);
2747 menuitems
[gui_synclist_get_sel_pos(lists
)].function();
2748 btn
= ACTION_REDRAW
;
2749 viewportmanager_set_statusbar(oldbars
);
2753 static char* dbg_menu_getname(int item
, void * data
,
2754 char *buffer
, size_t buffer_len
)
2756 (void)data
; (void)buffer
; (void)buffer_len
;
2757 return menuitems
[item
].desc
;
2759 bool debug_menu(void)
2761 struct simplelist_info info
;
2763 simplelist_info_init(&info
, "Debug Menu", ARRAYLEN(menuitems
), NULL
);
2764 info
.action_callback
= menu_action_callback
;
2765 info
.get_name
= dbg_menu_getname
;
2766 return simplelist_show_list(&info
);