2002-07-15 11:23:24 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002 Heikki Hannikainen
|
|
|
|
|
*
|
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
|
* KIND, either express or implied.
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdbool.h>
|
2003-08-01 16:05:40 +00:00
|
|
|
|
#include <string.h>
|
2002-07-15 11:23:24 +00:00
|
|
|
|
#include "lcd.h"
|
|
|
|
|
#include "menu.h"
|
|
|
|
|
#include "debug_menu.h"
|
|
|
|
|
#include "kernel.h"
|
|
|
|
|
#include "sprintf.h"
|
2006-08-15 12:27:07 +00:00
|
|
|
|
#include "action.h"
|
2002-07-15 11:23:24 +00:00
|
|
|
|
#include "debug.h"
|
2002-07-15 22:25:45 +00:00
|
|
|
|
#include "thread.h"
|
2002-08-06 10:52:51 +00:00
|
|
|
|
#include "powermgmt.h"
|
|
|
|
|
#include "system.h"
|
2002-10-08 10:52:46 +00:00
|
|
|
|
#include "font.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
|
#include "audio.h"
|
2004-03-22 11:48:13 +00:00
|
|
|
|
#include "mp3_playback.h"
|
2002-12-02 16:07:56 +00:00
|
|
|
|
#include "settings.h"
|
2007-03-26 12:09:08 +00:00
|
|
|
|
#include "list.h"
|
|
|
|
|
#include "statusbar.h"
|
2004-02-16 12:04:55 +00:00
|
|
|
|
#include "dir.h"
|
|
|
|
|
#include "panic.h"
|
2004-03-25 12:29:34 +00:00
|
|
|
|
#include "screens.h"
|
2004-07-26 16:06:59 +00:00
|
|
|
|
#include "misc.h"
|
2005-11-16 15:12:15 +00:00
|
|
|
|
#include "splash.h"
|
2006-03-26 11:33:42 +00:00
|
|
|
|
#include "dircache.h"
|
2006-10-25 10:17:57 +00:00
|
|
|
|
#ifdef HAVE_TAGCACHE
|
2006-03-26 11:33:42 +00:00
|
|
|
|
#include "tagcache.h"
|
2006-10-25 10:17:57 +00:00
|
|
|
|
#endif
|
2006-02-17 22:38:38 +00:00
|
|
|
|
#include "lcd-remote.h"
|
2006-05-07 22:19:29 +00:00
|
|
|
|
#include "crc32.h"
|
2006-08-05 20:19:10 +00:00
|
|
|
|
#include "logf.h"
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
|
|
|
|
#include "disk.h"
|
|
|
|
|
#include "adc.h"
|
|
|
|
|
#include "power.h"
|
|
|
|
|
#include "usb.h"
|
|
|
|
|
#include "rtc.h"
|
|
|
|
|
#include "ata.h"
|
|
|
|
|
#include "fat.h"
|
|
|
|
|
#include "mas.h"
|
|
|
|
|
#include "eeprom_24cxx.h"
|
2007-06-30 02:08:27 +00:00
|
|
|
|
#if defined(HAVE_MMC) || defined(HAVE_HOTSWAP)
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#include "ata_mmc.h"
|
2002-10-15 08:08:35 +00:00
|
|
|
|
#endif
|
2007-02-18 02:04:47 +00:00
|
|
|
|
#if CONFIG_TUNER
|
2006-08-11 17:39:34 +00:00
|
|
|
|
#include "tuner.h"
|
2004-02-05 10:59:51 +00:00
|
|
|
|
#include "radio.h"
|
|
|
|
|
#endif
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-11-19 14:11:42 +00:00
|
|
|
|
#include "scrollbar.h"
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#include "peakmeter.h"
|
2004-10-06 20:43:12 +00:00
|
|
|
|
#endif
|
2005-05-30 13:00:43 +00:00
|
|
|
|
#include "logfdisp.h"
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2005-07-13 13:13:10 +00:00
|
|
|
|
#include "pcmbuf.h"
|
2006-11-13 23:21:54 +00:00
|
|
|
|
#if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN)
|
|
|
|
|
#include "spdif.h"
|
|
|
|
|
#endif
|
2005-06-22 14:03:04 +00:00
|
|
|
|
#endif
|
2007-02-01 10:47:22 +00:00
|
|
|
|
#ifdef IRIVER_H300_SERIES
|
|
|
|
|
#include "pcf50606.h" /* for pcf50606_read */
|
|
|
|
|
#endif
|
2007-03-11 13:59:31 +00:00
|
|
|
|
#ifdef IAUDIO_X5
|
|
|
|
|
#include "ds2411.h"
|
|
|
|
|
#endif
|
2007-04-11 23:51:00 +00:00
|
|
|
|
#include "hwcompat.h"
|
2002-07-15 11:23:24 +00:00
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------*/
|
|
|
|
|
/* SPECIAL DEBUG STUFF */
|
|
|
|
|
/*---------------------------------------------------*/
|
2007-03-26 16:55:17 +00:00
|
|
|
|
extern struct thread_entry threads[MAXTHREADS];
|
2002-07-15 22:25:45 +00:00
|
|
|
|
|
2007-10-16 01:25:17 +00:00
|
|
|
|
static char thread_status_char(unsigned status)
|
2006-09-16 16:18:11 +00:00
|
|
|
|
{
|
2007-10-16 01:25:17 +00:00
|
|
|
|
static const char thread_status_chars[THREAD_NUM_STATES+1] =
|
2006-09-16 16:18:11 +00:00
|
|
|
|
{
|
2007-10-16 01:25:17 +00:00
|
|
|
|
[0 ... THREAD_NUM_STATES] = '?',
|
|
|
|
|
[STATE_RUNNING] = 'R',
|
|
|
|
|
[STATE_BLOCKED] = 'B',
|
|
|
|
|
[STATE_SLEEPING] = 'S',
|
|
|
|
|
[STATE_BLOCKED_W_TMO] = 'T',
|
|
|
|
|
[STATE_FROZEN] = 'F',
|
|
|
|
|
[STATE_KILLED] = 'K',
|
|
|
|
|
};
|
2006-10-27 05:31:28 +00:00
|
|
|
|
|
2007-10-16 01:25:17 +00:00
|
|
|
|
#if NUM_CORES > 1
|
|
|
|
|
if (status == STATE_BUSY) /* Not a state index */
|
|
|
|
|
return '.';
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (status > THREAD_NUM_STATES)
|
|
|
|
|
status = THREAD_NUM_STATES;
|
|
|
|
|
|
|
|
|
|
return thread_status_chars[status];
|
2006-09-16 16:18:11 +00:00
|
|
|
|
}
|
2007-09-28 10:20:02 +00:00
|
|
|
|
|
2007-04-05 04:52:53 +00:00
|
|
|
|
static char* threads_getname(int selected_item, void * data, char *buffer)
|
2007-03-26 12:09:08 +00:00
|
|
|
|
{
|
|
|
|
|
(void)data;
|
2007-09-28 10:20:02 +00:00
|
|
|
|
char name[32];
|
2007-03-26 12:09:08 +00:00
|
|
|
|
struct thread_entry *thread = NULL;
|
2007-09-28 10:20:02 +00:00
|
|
|
|
unsigned status;
|
|
|
|
|
int usage;
|
|
|
|
|
|
|
|
|
|
#if NUM_CORES > 1
|
|
|
|
|
if (selected_item < (int)NUM_CORES)
|
|
|
|
|
{
|
|
|
|
|
usage = idle_stack_usage(selected_item);
|
|
|
|
|
snprintf(buffer, MAX_PATH, "Idle (%d): %2d%%", selected_item, usage);
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selected_item -= NUM_CORES;
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-03-26 16:55:17 +00:00
|
|
|
|
thread = &threads[selected_item];
|
2007-09-28 10:20:02 +00:00
|
|
|
|
status = thread_get_status(thread);
|
2007-03-26 16:55:17 +00:00
|
|
|
|
|
2007-10-16 01:25:17 +00:00
|
|
|
|
if (status == STATE_KILLED)
|
2007-03-26 16:55:17 +00:00
|
|
|
|
{
|
|
|
|
|
snprintf(buffer, MAX_PATH, "%2d: ---", selected_item);
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
2007-09-28 10:20:02 +00:00
|
|
|
|
|
|
|
|
|
thread_get_name(name, 32, thread);
|
2007-03-26 12:09:08 +00:00
|
|
|
|
usage = thread_stack_usage(thread);
|
2007-09-28 10:20:02 +00:00
|
|
|
|
|
|
|
|
|
snprintf(buffer, MAX_PATH,
|
|
|
|
|
"%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d ") "%2d%% %s",
|
2007-03-26 16:55:17 +00:00
|
|
|
|
selected_item,
|
2007-09-28 10:20:02 +00:00
|
|
|
|
IF_COP(thread->core,)
|
2007-03-26 12:09:08 +00:00
|
|
|
|
(status == STATE_RUNNING) ? '*' : ' ',
|
|
|
|
|
thread_status_char(status),
|
2007-09-28 10:20:02 +00:00
|
|
|
|
IF_PRIO(thread->priority,)
|
|
|
|
|
usage, name);
|
|
|
|
|
|
2007-03-26 12:09:08 +00:00
|
|
|
|
return buffer;
|
|
|
|
|
}
|
2007-10-20 12:32:55 +00:00
|
|
|
|
static int dbg_threads_action_callback(int action, struct gui_synclist *lists)
|
2002-07-15 22:25:45 +00:00
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
(void)lists;
|
2007-03-28 07:33:40 +00:00
|
|
|
|
#ifdef ROCKBOX_HAS_LOGF
|
2007-04-05 04:52:53 +00:00
|
|
|
|
if (action == ACTION_STD_OK)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
int selpos = gui_synclist_get_sel_pos(lists);
|
2007-09-28 10:20:02 +00:00
|
|
|
|
#if NUM_CORES > 1
|
|
|
|
|
if (selpos >= NUM_CORES)
|
|
|
|
|
remove_thread(&threads[selpos - NUM_CORES]);
|
|
|
|
|
#else
|
|
|
|
|
remove_thread(&threads[selpos]);
|
2007-04-05 04:52:53 +00:00
|
|
|
|
#endif
|
2007-10-20 12:32:55 +00:00
|
|
|
|
return ACTION_REDRAW;
|
2007-09-28 10:20:02 +00:00
|
|
|
|
}
|
|
|
|
|
#endif /* ROCKBOX_HAS_LOGF */
|
2007-04-05 04:52:53 +00:00
|
|
|
|
return action;
|
|
|
|
|
}
|
|
|
|
|
/* Test code!!! */
|
|
|
|
|
static bool dbg_os(void)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
struct simplelist_info info;
|
2007-10-21 06:42:52 +00:00
|
|
|
|
simplelist_info_init(&info, IF_COP("Core and ") "Stack usage:",
|
2007-09-28 10:20:02 +00:00
|
|
|
|
#if NUM_CORES == 1
|
2007-10-21 01:27:17 +00:00
|
|
|
|
MAXTHREADS,
|
2007-09-28 10:20:02 +00:00
|
|
|
|
#else
|
2007-10-21 01:27:17 +00:00
|
|
|
|
MAXTHREADS+NUM_CORES,
|
2007-09-28 10:20:02 +00:00
|
|
|
|
#endif
|
2007-10-21 01:27:17 +00:00
|
|
|
|
NULL);
|
|
|
|
|
#ifndef ROCKBOX_HAS_LOGF
|
2007-10-20 12:32:55 +00:00
|
|
|
|
info.hide_selection = true;
|
|
|
|
|
#endif
|
2007-07-15 18:25:39 +00:00
|
|
|
|
info.action_callback = dbg_threads_action_callback;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
info.get_name = threads_getname;
|
|
|
|
|
return simplelist_show_list(&info);
|
2002-07-15 22:25:45 +00:00
|
|
|
|
}
|
2007-03-26 12:09:08 +00:00
|
|
|
|
|
2005-06-22 14:03:04 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_audio_thread(void)
|
2002-10-14 14:13:48 +00:00
|
|
|
|
{
|
|
|
|
|
char buf[32];
|
2005-04-04 12:06:29 +00:00
|
|
|
|
struct audio_debug d;
|
2002-10-14 14:13:48 +00:00
|
|
|
|
|
2002-10-15 07:23:18 +00:00
|
|
|
|
lcd_setmargins(0, 0);
|
2005-06-22 21:37:00 +00:00
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-10-14 14:13:48 +00:00
|
|
|
|
while(1)
|
|
|
|
|
{
|
2006-08-15 12:27:07 +00:00
|
|
|
|
if (action_userabort(HZ/5))
|
|
|
|
|
return false;
|
2002-10-14 14:13:48 +00:00
|
|
|
|
|
2005-04-04 12:06:29 +00:00
|
|
|
|
audio_get_debugdata(&d);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-10-14 14:13:48 +00:00
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
2005-04-05 11:33:58 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "read: %x", d.audiobuf_read);
|
2002-10-14 14:13:48 +00:00
|
|
|
|
lcd_puts(0, 0, buf);
|
2005-04-05 11:33:58 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "write: %x", d.audiobuf_write);
|
2002-10-14 14:13:48 +00:00
|
|
|
|
lcd_puts(0, 1, buf);
|
2005-04-05 11:33:58 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "swap: %x", d.audiobuf_swapwrite);
|
2002-10-14 14:13:48 +00:00
|
|
|
|
lcd_puts(0, 2, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "playing: %d", d.playing);
|
|
|
|
|
lcd_puts(0, 3, buf);
|
2002-12-05 14:11:48 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "playable: %x", d.playable_space);
|
2002-10-14 14:13:48 +00:00
|
|
|
|
lcd_puts(0, 4, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "unswapped: %x", d.unswapped_space);
|
|
|
|
|
lcd_puts(0, 5, buf);
|
2002-10-15 07:23:18 +00:00
|
|
|
|
|
2004-07-08 13:14:44 +00:00
|
|
|
|
/* Playable space left */
|
2006-11-19 14:11:42 +00:00
|
|
|
|
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8, 112, 4, d.audiobuflen, 0,
|
2004-07-08 13:14:44 +00:00
|
|
|
|
d.playable_space, HORIZONTAL);
|
2002-10-15 07:23:18 +00:00
|
|
|
|
|
2004-07-08 13:14:44 +00:00
|
|
|
|
/* Show the watermark limit */
|
2006-11-19 14:11:42 +00:00
|
|
|
|
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8+4, 112, 4, d.audiobuflen, 0,
|
2004-07-08 13:14:44 +00:00
|
|
|
|
d.low_watermark_level, HORIZONTAL);
|
2002-10-15 07:23:18 +00:00
|
|
|
|
|
2002-12-05 13:09:51 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "wm: %x - %x",
|
|
|
|
|
d.low_watermark_level, d.lowest_watermark_level);
|
2002-10-15 07:23:18 +00:00
|
|
|
|
lcd_puts(0, 7, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-10-14 14:13:48 +00:00
|
|
|
|
lcd_update();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif /* !SIMULATOR */
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#else /* CONFIG_CODEC == SWCODEC */
|
2006-04-14 04:46:05 +00:00
|
|
|
|
extern size_t filebuflen;
|
|
|
|
|
/* This is a size_t, but call it a long so it puts a - when it's bad. */
|
2005-06-22 14:03:04 +00:00
|
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
|
static unsigned int ticks, boost_ticks;
|
2005-06-22 14:03:04 +00:00
|
|
|
|
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static void dbg_audio_task(void)
|
2005-06-22 14:03:04 +00:00
|
|
|
|
{
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2005-06-22 14:03:04 +00:00
|
|
|
|
if(FREQ > CPUFREQ_NORMAL)
|
|
|
|
|
boost_ticks++;
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
2005-06-22 14:03:04 +00:00
|
|
|
|
|
|
|
|
|
ticks++;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_audio_thread(void)
|
2005-06-22 14:03:04 +00:00
|
|
|
|
{
|
|
|
|
|
char buf[32];
|
|
|
|
|
int button;
|
|
|
|
|
int line;
|
2005-06-22 14:09:07 +00:00
|
|
|
|
bool done = false;
|
2006-04-25 20:32:38 +00:00
|
|
|
|
size_t bufused;
|
2006-02-07 20:38:55 +00:00
|
|
|
|
size_t bufsize = pcmbuf_get_bufsize();
|
|
|
|
|
int pcmbufdescs = pcmbuf_descs();
|
2005-06-22 14:03:04 +00:00
|
|
|
|
|
|
|
|
|
ticks = boost_ticks = 0;
|
|
|
|
|
|
|
|
|
|
tick_add_task(dbg_audio_task);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-06-22 14:03:04 +00:00
|
|
|
|
lcd_setmargins(0, 0);
|
2005-06-22 21:37:00 +00:00
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2005-06-22 14:09:07 +00:00
|
|
|
|
while(!done)
|
2005-06-22 14:03:04 +00:00
|
|
|
|
{
|
2006-08-15 12:27:07 +00:00
|
|
|
|
button = get_action(CONTEXT_STD,HZ/5);
|
2005-06-22 14:03:04 +00:00
|
|
|
|
switch(button)
|
|
|
|
|
{
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_NEXT:
|
2006-02-07 20:38:55 +00:00
|
|
|
|
audio_next();
|
|
|
|
|
break;
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_PREV:
|
2006-02-07 20:38:55 +00:00
|
|
|
|
audio_prev();
|
|
|
|
|
break;
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_CANCEL:
|
2005-06-22 14:09:07 +00:00
|
|
|
|
done = true;
|
2006-10-30 11:33:38 +00:00
|
|
|
|
break;
|
2005-06-22 14:03:04 +00:00
|
|
|
|
}
|
|
|
|
|
line = 0;
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
2006-04-25 20:32:38 +00:00
|
|
|
|
bufused = bufsize - pcmbuf_free();
|
|
|
|
|
|
2006-10-04 07:29:50 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "pcm: %7ld/%7ld", (long) bufused, (long) bufsize);
|
2005-06-22 14:03:04 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
/* Playable space left */
|
2006-11-19 14:11:42 +00:00
|
|
|
|
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6, bufsize, 0, bufused, HORIZONTAL);
|
2005-06-22 14:03:04 +00:00
|
|
|
|
line++;
|
2002-10-14 14:13:48 +00:00
|
|
|
|
|
2006-10-12 16:51:22 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "codec: %8ld/%8ld", audio_filebufused(), (long) filebuflen);
|
2005-06-22 14:03:04 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
/* Playable space left */
|
2006-11-19 14:11:42 +00:00
|
|
|
|
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6, filebuflen, 0,
|
2006-10-12 16:51:22 +00:00
|
|
|
|
audio_filebufused(), HORIZONTAL);
|
2005-06-22 14:03:04 +00:00
|
|
|
|
line++;
|
|
|
|
|
|
2006-04-09 02:15:35 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "track count: %2d", audio_track_count());
|
2005-06-22 20:37:31 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2006-02-07 20:38:55 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "cpu freq: %3dMHz",
|
2005-10-03 09:24:36 +00:00
|
|
|
|
(int)((FREQ + 500000) / 1000000));
|
2005-06-22 14:03:04 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
2005-06-22 14:03:04 +00:00
|
|
|
|
|
2007-05-14 09:56:55 +00:00
|
|
|
|
if (ticks > 0)
|
|
|
|
|
{
|
|
|
|
|
snprintf(buf, sizeof(buf), "boost ratio: %3d%%",
|
|
|
|
|
boost_ticks * 100 / ticks);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
}
|
2005-06-22 14:03:04 +00:00
|
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "pcmbufdesc: %2d/%2d",
|
|
|
|
|
pcmbuf_used_descs(), pcmbufdescs);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-06-22 14:03:04 +00:00
|
|
|
|
lcd_update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tick_remove_task(dbg_audio_task);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-06-22 14:03:04 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* CONFIG_CODEC */
|
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2003-08-01 08:00:54 +00:00
|
|
|
|
|
|
|
|
|
|
2007-05-10 13:16:08 +00:00
|
|
|
|
#if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE))
|
2003-05-17 20:40:30 +00:00
|
|
|
|
/* Tool function to read the flash manufacturer and type, if available.
|
|
|
|
|
Only chips which could be reprogrammed in system will return values.
|
|
|
|
|
(The mode switch addresses vary between flash manufacturers, hence addr1/2) */
|
2004-07-19 21:21:34 +00:00
|
|
|
|
/* In IRAM to avoid problems when running directly from Flash */
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
|
|
|
|
|
unsigned addr1, unsigned addr2)
|
|
|
|
|
ICODE_ATTR __attribute__((noinline));
|
|
|
|
|
static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
|
|
|
|
|
unsigned addr1, unsigned addr2)
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2003-05-17 20:40:30 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned not_manu, not_id; /* read values before switching to ID mode */
|
|
|
|
|
unsigned manu, id; /* read values when in ID mode */
|
2005-10-10 19:43:07 +00:00
|
|
|
|
|
|
|
|
|
#if CONFIG_CPU == SH7034
|
2003-05-17 20:40:30 +00:00
|
|
|
|
volatile unsigned char* flash = (unsigned char*)0x2000000; /* flash mapping */
|
2006-03-18 23:07:34 +00:00
|
|
|
|
#elif defined(CPU_COLDFIRE)
|
2005-10-10 19:43:07 +00:00
|
|
|
|
volatile unsigned short* flash = (unsigned short*)0; /* flash mapping */
|
2005-02-08 15:12:25 +00:00
|
|
|
|
#endif
|
2004-07-19 21:21:34 +00:00
|
|
|
|
int old_level; /* saved interrupt level */
|
2003-05-17 20:40:30 +00:00
|
|
|
|
|
2006-11-10 20:26:01 +00:00
|
|
|
|
not_manu = flash[0]; /* read the normal content */
|
|
|
|
|
not_id = flash[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */
|
2003-05-17 20:40:30 +00:00
|
|
|
|
|
2004-07-19 21:21:34 +00:00
|
|
|
|
/* disable interrupts, prevent any stray flash access */
|
|
|
|
|
old_level = set_irq_level(HIGHEST_IRQ_LEVEL);
|
|
|
|
|
|
2006-11-10 20:26:01 +00:00
|
|
|
|
flash[addr1] = 0xAA; /* enter command mode */
|
|
|
|
|
flash[addr2] = 0x55;
|
|
|
|
|
flash[addr1] = 0x90; /* ID command */
|
2004-07-19 21:21:34 +00:00
|
|
|
|
/* Atmel wants 20ms pause here */
|
|
|
|
|
/* sleep(HZ/50); no sleeping possible while interrupts are disabled */
|
2003-05-17 20:40:30 +00:00
|
|
|
|
|
2006-11-10 20:26:01 +00:00
|
|
|
|
manu = flash[0]; /* read the IDs */
|
|
|
|
|
id = flash[1];
|
2003-05-17 20:40:30 +00:00
|
|
|
|
|
2006-11-10 20:26:01 +00:00
|
|
|
|
flash[0] = 0xF0; /* reset flash (back to normal read mode) */
|
2004-07-19 21:21:34 +00:00
|
|
|
|
/* Atmel wants 20ms pause here */
|
|
|
|
|
/* sleep(HZ/50); no sleeping possible while interrupts are disabled */
|
|
|
|
|
|
|
|
|
|
set_irq_level(old_level); /* enable interrupts again */
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2003-05-17 20:40:30 +00:00
|
|
|
|
/* I assume success if the obtained values are different from
|
2006-08-21 17:35:35 +00:00
|
|
|
|
the normal flash content. This is not perfectly bulletproof, they
|
2003-05-17 20:40:30 +00:00
|
|
|
|
could theoretically be the same by chance, causing us to fail. */
|
|
|
|
|
if (not_manu != manu || not_id != id) /* a value has changed */
|
|
|
|
|
{
|
|
|
|
|
*p_manufacturer = manu; /* return the results */
|
|
|
|
|
*p_device = id;
|
|
|
|
|
return true; /* success */
|
|
|
|
|
}
|
|
|
|
|
return false; /* fail */
|
|
|
|
|
}
|
2007-05-10 13:16:08 +00:00
|
|
|
|
#endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
|
2003-05-17 20:40:30 +00:00
|
|
|
|
|
2006-10-04 07:42:45 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2007-07-10 20:47:01 +00:00
|
|
|
|
#ifdef CPU_PP
|
2007-07-02 05:16:40 +00:00
|
|
|
|
static int perfcheck(void)
|
|
|
|
|
{
|
|
|
|
|
int result;
|
|
|
|
|
|
|
|
|
|
asm (
|
2007-07-07 05:59:35 +00:00
|
|
|
|
"mrs r2, CPSR \n"
|
|
|
|
|
"orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */
|
|
|
|
|
"msr CPSR_c, r0 \n"
|
2007-07-02 05:16:40 +00:00
|
|
|
|
"mov %[res], #0 \n"
|
|
|
|
|
"ldr r0, [%[timr]] \n"
|
|
|
|
|
"add r0, r0, %[tmo] \n"
|
|
|
|
|
"1: \n"
|
|
|
|
|
"add %[res], %[res], #1 \n"
|
|
|
|
|
"ldr r1, [%[timr]] \n"
|
|
|
|
|
"cmp r1, r0 \n"
|
|
|
|
|
"bmi 1b \n"
|
2007-07-07 05:59:35 +00:00
|
|
|
|
"msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */
|
2007-07-02 05:16:40 +00:00
|
|
|
|
:
|
|
|
|
|
[res]"=&r"(result)
|
|
|
|
|
:
|
|
|
|
|
[timr]"r"(&USEC_TIMER),
|
2007-07-10 20:47:01 +00:00
|
|
|
|
[tmo]"r"(
|
|
|
|
|
#if CONFIG_CPU == PP5002
|
|
|
|
|
16000
|
|
|
|
|
#else /* PP5020/5022/5024 */
|
|
|
|
|
10226
|
|
|
|
|
#endif
|
|
|
|
|
)
|
2007-07-02 05:16:40 +00:00
|
|
|
|
:
|
2007-07-07 05:59:35 +00:00
|
|
|
|
"r0", "r1", "r2"
|
2007-07-02 05:16:40 +00:00
|
|
|
|
);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-10-08 10:52:46 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_hw_info(void)
|
2002-10-08 10:52:46 +00:00
|
|
|
|
{
|
2005-02-02 21:57:40 +00:00
|
|
|
|
#if CONFIG_CPU == SH7034
|
2002-10-08 10:52:46 +00:00
|
|
|
|
char buf[32];
|
2007-04-11 23:51:00 +00:00
|
|
|
|
int bitmask = HW_MASK;
|
|
|
|
|
int rom_version = ROM_VERSION;
|
2003-05-17 20:40:30 +00:00
|
|
|
|
unsigned manu, id; /* flash IDs */
|
|
|
|
|
bool got_id; /* flag if we managed to get the flash IDs */
|
2006-05-07 22:19:29 +00:00
|
|
|
|
unsigned rom_crc = 0xffffffff; /* CRC32 of the boot ROM */
|
2003-10-29 22:10:13 +00:00
|
|
|
|
bool has_bootrom; /* flag for boot ROM present */
|
2004-08-30 19:52:45 +00:00
|
|
|
|
int oldmode; /* saved memory guard mode */
|
2002-10-08 10:52:46 +00:00
|
|
|
|
|
2004-08-30 19:52:45 +00:00
|
|
|
|
oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */
|
|
|
|
|
|
2003-05-17 20:40:30 +00:00
|
|
|
|
/* get flash ROM type */
|
|
|
|
|
got_id = dbg_flash_id(&manu, &id, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
|
|
|
|
|
if (!got_id)
|
|
|
|
|
got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2003-10-29 22:10:13 +00:00
|
|
|
|
/* check if the boot ROM area is a flash mirror */
|
|
|
|
|
has_bootrom = (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
|
|
|
|
|
if (has_bootrom) /* if ROM and Flash different */
|
|
|
|
|
{
|
|
|
|
|
/* calculate CRC16 checksum of boot ROM */
|
2006-05-07 22:19:29 +00:00
|
|
|
|
rom_crc = crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
|
2003-10-29 22:10:13 +00:00
|
|
|
|
}
|
2003-08-01 08:00:54 +00:00
|
|
|
|
|
2004-08-30 19:52:45 +00:00
|
|
|
|
system_memory_guard(oldmode); /* re-enable memory guard */
|
|
|
|
|
|
2002-10-08 10:52:46 +00:00
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
2002-10-08 12:08:30 +00:00
|
|
|
|
lcd_puts(0, 0, "[Hardware info]");
|
|
|
|
|
|
2002-10-08 10:52:46 +00:00
|
|
|
|
snprintf(buf, 32, "ROM: %d.%02d", rom_version/100, rom_version%100);
|
|
|
|
|
lcd_puts(0, 1, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-10-08 12:08:30 +00:00
|
|
|
|
snprintf(buf, 32, "Mask: 0x%04x", bitmask);
|
2002-10-08 10:52:46 +00:00
|
|
|
|
lcd_puts(0, 2, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2003-05-17 20:40:30 +00:00
|
|
|
|
if (got_id)
|
|
|
|
|
snprintf(buf, 32, "Flash: M=%02x D=%02x", manu, id);
|
|
|
|
|
else
|
|
|
|
|
snprintf(buf, 32, "Flash: M=?? D=??"); /* unknown, sorry */
|
2007-04-11 21:26:58 +00:00
|
|
|
|
lcd_puts(0, 3, buf);
|
2003-08-01 08:00:54 +00:00
|
|
|
|
|
2003-10-29 22:10:13 +00:00
|
|
|
|
if (has_bootrom)
|
|
|
|
|
{
|
2006-05-07 22:19:29 +00:00
|
|
|
|
if (rom_crc == 0x56DBA4EE) /* known Version 1 */
|
|
|
|
|
snprintf(buf, 32, "Boot ROM: V1");
|
|
|
|
|
else
|
|
|
|
|
snprintf(buf, 32, "ROMcrc: 0x%08x", rom_crc);
|
2003-10-29 22:10:13 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
snprintf(buf, 32, "Boot ROM: none");
|
|
|
|
|
}
|
2007-04-11 21:26:58 +00:00
|
|
|
|
lcd_puts(0, 4, buf);
|
2004-10-22 20:44:26 +00:00
|
|
|
|
|
2002-10-08 10:52:46 +00:00
|
|
|
|
lcd_update();
|
2002-10-14 14:25:25 +00:00
|
|
|
|
|
2007-07-27 22:34:15 +00:00
|
|
|
|
while (!(action_userabort(TIMEOUT_BLOCK)));
|
|
|
|
|
|
2006-08-11 17:39:34 +00:00
|
|
|
|
#elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
|
2005-10-10 19:43:07 +00:00
|
|
|
|
char buf[32];
|
|
|
|
|
unsigned manu, id; /* flash IDs */
|
2007-03-11 13:59:31 +00:00
|
|
|
|
int got_id; /* flag if we managed to get the flash IDs */
|
2005-10-10 19:43:07 +00:00
|
|
|
|
int oldmode; /* saved memory guard mode */
|
2007-03-11 13:59:31 +00:00
|
|
|
|
int line = 0;
|
2005-10-10 19:43:07 +00:00
|
|
|
|
|
|
|
|
|
oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */
|
|
|
|
|
|
|
|
|
|
/* get flash ROM type */
|
|
|
|
|
got_id = dbg_flash_id(&manu, &id, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
|
|
|
|
|
if (!got_id)
|
|
|
|
|
got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-10-10 19:43:07 +00:00
|
|
|
|
system_memory_guard(oldmode); /* re-enable memory guard */
|
|
|
|
|
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
2007-03-11 13:59:31 +00:00
|
|
|
|
lcd_puts(0, line++, "[Hardware info]");
|
2005-10-10 19:43:07 +00:00
|
|
|
|
|
|
|
|
|
if (got_id)
|
|
|
|
|
snprintf(buf, 32, "Flash: M=%04x D=%04x", manu, id);
|
|
|
|
|
else
|
|
|
|
|
snprintf(buf, 32, "Flash: M=???? D=????"); /* unknown, sorry */
|
2007-03-11 13:59:31 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
#ifdef IAUDIO_X5
|
|
|
|
|
{
|
|
|
|
|
struct ds2411_id id;
|
|
|
|
|
|
2007-03-11 15:33:59 +00:00
|
|
|
|
lcd_puts(0, ++line, "Serial Number:");
|
2007-03-11 13:59:31 +00:00
|
|
|
|
|
|
|
|
|
got_id = ds2411_read_id(&id);
|
|
|
|
|
|
|
|
|
|
if (got_id == DS2411_OK)
|
|
|
|
|
{
|
|
|
|
|
snprintf(buf, 32, " FC=%02x", (unsigned)id.family_code);
|
2007-03-11 15:33:59 +00:00
|
|
|
|
lcd_puts(0, ++line, buf);
|
2007-03-11 13:59:31 +00:00
|
|
|
|
snprintf(buf, 32, " ID=%02X %02X %02X %02X %02X %02X",
|
|
|
|
|
(unsigned)id.uid[0], (unsigned)id.uid[1], (unsigned)id.uid[2],
|
|
|
|
|
(unsigned)id.uid[3], (unsigned)id.uid[4], (unsigned)id.uid[5]);
|
2007-03-11 15:33:59 +00:00
|
|
|
|
lcd_puts(0, ++line, buf);
|
2007-03-11 13:59:31 +00:00
|
|
|
|
snprintf(buf, 32, " CRC=%02X", (unsigned)id.crc);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
snprintf(buf, 32, "READ ERR=%d", got_id);
|
|
|
|
|
}
|
2007-03-11 15:33:59 +00:00
|
|
|
|
|
|
|
|
|
lcd_puts(0, ++line, buf);
|
2007-03-11 13:59:31 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2005-10-10 19:43:07 +00:00
|
|
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
|
|
2007-07-27 22:34:15 +00:00
|
|
|
|
while (!(action_userabort(TIMEOUT_BLOCK)));
|
|
|
|
|
|
2007-07-02 05:16:40 +00:00
|
|
|
|
#elif defined(CPU_PP502x)
|
2007-07-25 13:12:38 +00:00
|
|
|
|
int line = 0;
|
2006-05-07 22:56:44 +00:00
|
|
|
|
char buf[32];
|
2007-03-04 16:06:54 +00:00
|
|
|
|
char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff,
|
|
|
|
|
(PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff,
|
|
|
|
|
(PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff,
|
|
|
|
|
(PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' };
|
|
|
|
|
|
2006-05-07 22:56:44 +00:00
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
2007-07-25 13:12:38 +00:00
|
|
|
|
lcd_puts(0, line++, "[Hardware info]");
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2007-07-25 13:12:38 +00:00
|
|
|
|
#ifdef IPOD_ARCH
|
|
|
|
|
snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef IPOD_COLOR
|
|
|
|
|
extern int lcd_type; /* Defined in lcd-colornano.c */
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "LCD type: %d", lcd_type);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
#endif
|
2006-05-07 22:56:44 +00:00
|
|
|
|
|
2007-03-03 23:37:17 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "PP version: %s", pp_version);
|
2007-07-25 13:12:38 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-07-02 05:16:40 +00:00
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck());
|
2007-07-25 13:12:38 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-07-10 20:47:01 +00:00
|
|
|
|
|
2006-05-07 22:56:44 +00:00
|
|
|
|
lcd_update();
|
|
|
|
|
|
2007-07-27 22:34:15 +00:00
|
|
|
|
while (!(action_userabort(TIMEOUT_BLOCK)));
|
|
|
|
|
|
|
|
|
|
#elif CONFIG_CPU == PP5002
|
|
|
|
|
int line = 0;
|
|
|
|
|
char buf[32];
|
|
|
|
|
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
|
|
lcd_puts(0, line++, "[Hardware info]");
|
|
|
|
|
|
|
|
|
|
#ifdef IPOD_ARCH
|
|
|
|
|
snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck());
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
|
|
|
|
|
|
while (!(action_userabort(TIMEOUT_BLOCK)));
|
|
|
|
|
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* CONFIG_CPU */
|
2002-10-08 10:52:46 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#else /* !HAVE_LCD_BITMAP */
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_hw_info(void)
|
2002-10-08 12:08:30 +00:00
|
|
|
|
{
|
|
|
|
|
char buf[32];
|
|
|
|
|
int button;
|
|
|
|
|
int currval = 0;
|
2007-04-11 23:51:00 +00:00
|
|
|
|
int rom_version = ROM_VERSION;
|
2003-05-20 21:30:53 +00:00
|
|
|
|
unsigned manu, id; /* flash IDs */
|
|
|
|
|
bool got_id; /* flag if we managed to get the flash IDs */
|
2006-05-07 22:19:29 +00:00
|
|
|
|
unsigned rom_crc = 0xffffffff; /* CRC32 of the boot ROM */
|
2003-10-29 22:10:13 +00:00
|
|
|
|
bool has_bootrom; /* flag for boot ROM present */
|
2004-08-30 19:52:45 +00:00
|
|
|
|
int oldmode; /* saved memory guard mode */
|
2002-10-08 12:08:30 +00:00
|
|
|
|
|
2004-08-30 19:52:45 +00:00
|
|
|
|
oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */
|
|
|
|
|
|
2003-05-20 21:30:53 +00:00
|
|
|
|
/* get flash ROM type */
|
|
|
|
|
got_id = dbg_flash_id(&manu, &id, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */
|
|
|
|
|
if (!got_id)
|
|
|
|
|
got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */
|
|
|
|
|
|
2003-10-29 22:10:13 +00:00
|
|
|
|
/* check if the boot ROM area is a flash mirror */
|
|
|
|
|
has_bootrom = (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
|
|
|
|
|
if (has_bootrom) /* if ROM and Flash different */
|
|
|
|
|
{
|
|
|
|
|
/* calculate CRC16 checksum of boot ROM */
|
2006-05-07 22:19:29 +00:00
|
|
|
|
rom_crc = crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff);
|
2003-10-29 22:10:13 +00:00
|
|
|
|
}
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2004-08-30 19:52:45 +00:00
|
|
|
|
system_memory_guard(oldmode); /* re-enable memory guard */
|
2003-08-01 08:00:54 +00:00
|
|
|
|
|
2002-10-08 12:08:30 +00:00
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
|
|
lcd_puts(0, 0, "[HW Info]");
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
switch(currval)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
snprintf(buf, 32, "ROM: %d.%02d",
|
|
|
|
|
rom_version/100, rom_version%100);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2003-05-20 21:30:53 +00:00
|
|
|
|
if (got_id)
|
|
|
|
|
snprintf(buf, 32, "Flash:%02x,%02x", manu, id);
|
|
|
|
|
else
|
|
|
|
|
snprintf(buf, 32, "Flash:??,??"); /* unknown, sorry */
|
|
|
|
|
break;
|
2007-04-11 21:26:58 +00:00
|
|
|
|
case 2:
|
2003-10-29 22:10:13 +00:00
|
|
|
|
if (has_bootrom)
|
2006-05-07 22:19:29 +00:00
|
|
|
|
{
|
|
|
|
|
if (rom_crc == 0x56DBA4EE) /* known Version 1 */
|
|
|
|
|
snprintf(buf, 32, "BootROM: V1");
|
2006-08-21 17:35:35 +00:00
|
|
|
|
else if (rom_crc == 0x358099E8)
|
2006-05-07 22:19:29 +00:00
|
|
|
|
snprintf(buf, 32, "BootROM: V2");
|
|
|
|
|
/* alternative boot ROM found in one single player so far */
|
|
|
|
|
else
|
|
|
|
|
snprintf(buf, 32, "R: %08x", rom_crc);
|
|
|
|
|
}
|
2003-10-29 22:10:13 +00:00
|
|
|
|
else
|
|
|
|
|
snprintf(buf, 32, "BootROM: no");
|
2002-10-08 12:08:30 +00:00
|
|
|
|
}
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-10-09 06:36:32 +00:00
|
|
|
|
lcd_puts(0, 1, buf);
|
2002-10-08 12:08:30 +00:00
|
|
|
|
lcd_update();
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
button = get_action(CONTEXT_SETTINGS,TIMEOUT_BLOCK);
|
2002-10-08 12:08:30 +00:00
|
|
|
|
|
|
|
|
|
switch(button)
|
|
|
|
|
{
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_CANCEL:
|
2002-10-08 12:08:30 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_SETTINGS_DEC:
|
2002-10-08 12:08:30 +00:00
|
|
|
|
currval--;
|
|
|
|
|
if(currval < 0)
|
2007-04-11 21:26:58 +00:00
|
|
|
|
currval = 2;
|
2002-10-08 12:08:30 +00:00
|
|
|
|
break;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_SETTINGS_INC:
|
2002-10-08 12:08:30 +00:00
|
|
|
|
currval++;
|
2007-04-11 21:26:58 +00:00
|
|
|
|
if(currval > 2)
|
2002-10-08 12:08:30 +00:00
|
|
|
|
currval = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* !HAVE_LCD_BITMAP */
|
2006-10-04 07:42:45 +00:00
|
|
|
|
#endif /* !SIMULATOR */
|
2002-10-08 10:52:46 +00:00
|
|
|
|
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2007-04-05 04:52:53 +00:00
|
|
|
|
static char* dbg_partitions_getname(int selected_item, void * data, char *buffer)
|
2002-10-10 12:01:58 +00:00
|
|
|
|
{
|
2007-04-05 04:52:53 +00:00
|
|
|
|
(void)data;
|
|
|
|
|
int partition = selected_item/2;
|
|
|
|
|
struct partinfo* p = disk_partinfo(partition);
|
|
|
|
|
if (selected_item%2)
|
2002-10-10 12:01:58 +00:00
|
|
|
|
{
|
2007-06-07 12:14:31 +00:00
|
|
|
|
snprintf(buffer, MAX_PATH, " T:%x %ld MB", p->type, p->size / 2048);
|
2002-10-10 12:01:58 +00:00
|
|
|
|
}
|
2007-04-05 04:52:53 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
snprintf(buffer, MAX_PATH, "P%d: S:%lx", partition, p->start);
|
|
|
|
|
}
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool dbg_partitions(void)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
struct simplelist_info info;
|
2007-10-21 06:42:52 +00:00
|
|
|
|
simplelist_info_init(&info, "Partition Info", 4, NULL);
|
|
|
|
|
info.selection_size = 2;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
info.hide_selection = true;
|
|
|
|
|
info.get_name = dbg_partitions_getname;
|
|
|
|
|
return simplelist_show_list(&info);
|
2002-10-10 12:01:58 +00:00
|
|
|
|
}
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
2002-10-10 12:01:58 +00:00
|
|
|
|
|
2006-03-18 23:42:34 +00:00
|
|
|
|
#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_spdif(void)
|
2005-07-18 18:28:49 +00:00
|
|
|
|
{
|
|
|
|
|
char buf[128];
|
|
|
|
|
int line;
|
|
|
|
|
unsigned int control;
|
|
|
|
|
int x;
|
|
|
|
|
char *s;
|
|
|
|
|
int category;
|
|
|
|
|
int generation;
|
|
|
|
|
unsigned int interruptstat;
|
|
|
|
|
bool valnogood, symbolerr, parityerr;
|
2006-05-12 01:10:18 +00:00
|
|
|
|
bool done = false;
|
2006-11-13 23:21:54 +00:00
|
|
|
|
bool spdif_src_on;
|
|
|
|
|
int spdif_source = spdif_get_output_source(&spdif_src_on);
|
2007-06-08 23:42:04 +00:00
|
|
|
|
spdif_set_output_source(AUDIO_SRC_SPDIF IF_SPDIF_POWER_(, true));
|
2005-07-18 18:28:49 +00:00
|
|
|
|
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2006-11-13 23:21:54 +00:00
|
|
|
|
|
2006-05-12 01:10:18 +00:00
|
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
|
spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
|
|
|
|
|
#endif
|
2005-07-18 18:28:49 +00:00
|
|
|
|
|
2006-05-12 01:10:18 +00:00
|
|
|
|
while (!done)
|
2005-07-18 18:28:49 +00:00
|
|
|
|
{
|
|
|
|
|
line = 0;
|
|
|
|
|
|
|
|
|
|
control = EBU1RCVCCHANNEL1;
|
|
|
|
|
interruptstat = INTERRUPTSTAT;
|
|
|
|
|
INTERRUPTCLEAR = 0x03c00000;
|
|
|
|
|
|
|
|
|
|
valnogood = (interruptstat & 0x01000000)?true:false;
|
|
|
|
|
symbolerr = (interruptstat & 0x00800000)?true:false;
|
|
|
|
|
parityerr = (interruptstat & 0x00400000)?true:false;
|
2005-10-03 09:24:36 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "Val: %s Sym: %s Par: %s",
|
|
|
|
|
valnogood?"--":"OK",
|
|
|
|
|
symbolerr?"--":"OK",
|
|
|
|
|
parityerr?"--":"OK");
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Status word: %08x", (int)control);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
line++;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = control >> 31;
|
|
|
|
|
snprintf(buf, sizeof(buf), "PRO: %d (%s)",
|
|
|
|
|
x, x?"Professional":"Consumer");
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = (control >> 30) & 1;
|
|
|
|
|
snprintf(buf, sizeof(buf), "Audio: %d (%s)",
|
|
|
|
|
x, x?"Non-PCM":"PCM");
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = (control >> 29) & 1;
|
|
|
|
|
snprintf(buf, sizeof(buf), "Copy: %d (%s)",
|
|
|
|
|
x, x?"Permitted":"Inhibited");
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = (control >> 27) & 7;
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
s = "None";
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
s = "50/15us";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
s = "Reserved";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
snprintf(buf, sizeof(buf), "Preemphasis: %d (%s)", x, s);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
x = (control >> 24) & 3;
|
|
|
|
|
snprintf(buf, sizeof(buf), "Mode: %d", x);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
category = (control >> 17) & 127;
|
|
|
|
|
switch(category)
|
|
|
|
|
{
|
|
|
|
|
case 0x00:
|
|
|
|
|
s = "General";
|
|
|
|
|
break;
|
|
|
|
|
case 0x40:
|
|
|
|
|
s = "Audio CD";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
s = "Unknown";
|
|
|
|
|
}
|
|
|
|
|
snprintf(buf, sizeof(buf), "Category: 0x%02x (%s)", category, s);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = (control >> 16) & 1;
|
|
|
|
|
generation = x;
|
|
|
|
|
if(((category & 0x70) == 0x10) ||
|
|
|
|
|
((category & 0x70) == 0x40) ||
|
|
|
|
|
((category & 0x78) == 0x38))
|
|
|
|
|
{
|
|
|
|
|
generation = !generation;
|
|
|
|
|
}
|
|
|
|
|
snprintf(buf, sizeof(buf), "Generation: %d (%s)",
|
|
|
|
|
x, generation?"Original":"No ind.");
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = (control >> 12) & 15;
|
|
|
|
|
snprintf(buf, sizeof(buf), "Source: %d", x);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = (control >> 8) & 15;
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
s = "Unspecified";
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
s = "A (Left)";
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
s = "B (Right)";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
s = "";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
snprintf(buf, sizeof(buf), "Channel: %d (%s)", x, s);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = (control >> 4) & 15;
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
s = "44.1kHz";
|
|
|
|
|
break;
|
|
|
|
|
case 0x4:
|
|
|
|
|
s = "48kHz";
|
|
|
|
|
break;
|
|
|
|
|
case 0xc:
|
|
|
|
|
s = "32kHz";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
snprintf(buf, sizeof(buf), "Frequency: %d (%s)", x, s);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-05-12 01:10:18 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
x = (control >> 2) & 3;
|
|
|
|
|
snprintf(buf, sizeof(buf), "Clock accuracy: %d", x);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-05-12 01:10:18 +00:00
|
|
|
|
line++;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2006-05-12 01:10:18 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "Measured freq: %ldHz",
|
2006-11-13 23:21:54 +00:00
|
|
|
|
spdif_measure_frequency());
|
2006-05-12 01:10:18 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
2006-05-12 01:10:18 +00:00
|
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
|
lcd_update();
|
|
|
|
|
|
2006-08-16 04:27:33 +00:00
|
|
|
|
if (action_userabort(HZ/10))
|
2006-11-13 23:21:54 +00:00
|
|
|
|
break;
|
2005-07-18 18:28:49 +00:00
|
|
|
|
}
|
2006-11-13 23:21:54 +00:00
|
|
|
|
|
2007-06-08 23:42:04 +00:00
|
|
|
|
spdif_set_output_source(spdif_source IF_SPDIF_POWER_(, spdif_src_on));
|
2006-11-13 23:21:54 +00:00
|
|
|
|
|
2006-05-12 01:10:18 +00:00
|
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
|
spdif_power_enable(global_settings.spdif_enable);
|
|
|
|
|
#endif
|
2005-07-18 18:28:49 +00:00
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* CPU_COLDFIRE */
|
2005-07-18 18:28:49 +00:00
|
|
|
|
|
2006-10-04 07:42:45 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2002-08-08 20:44:25 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-12-27 07:20:42 +00:00
|
|
|
|
/* button definitions */
|
|
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
|
|
|
|
# define DEBUG_CANCEL BUTTON_OFF
|
|
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == RECORDER_PAD
|
|
|
|
|
# define DEBUG_CANCEL BUTTON_OFF
|
|
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
|
|
|
|
# define DEBUG_CANCEL BUTTON_MENU
|
|
|
|
|
|
2007-07-26 22:42:31 +00:00
|
|
|
|
#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
|
|
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
2006-12-27 07:20:42 +00:00
|
|
|
|
(CONFIG_KEYPAD == IPOD_4G_PAD)
|
|
|
|
|
# define DEBUG_CANCEL BUTTON_MENU
|
|
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
|
|
|
|
|
# define DEBUG_CANCEL BUTTON_PLAY
|
|
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2006-12-27 07:20:42 +00:00
|
|
|
|
# define DEBUG_CANCEL BUTTON_REC
|
|
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
|
|
|
|
# define DEBUG_CANCEL BUTTON_A
|
|
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
|
|
|
|
# define DEBUG_CANCEL BUTTON_REW
|
|
|
|
|
|
2007-09-06 03:28:58 +00:00
|
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
|
|
|
|
|
(CONFIG_KEYPAD == SANSA_C200_PAD)
|
2006-12-27 07:20:42 +00:00
|
|
|
|
# define DEBUG_CANCEL BUTTON_LEFT
|
|
|
|
|
#endif /* key definitios */
|
|
|
|
|
|
2002-07-15 11:23:24 +00:00
|
|
|
|
/* Test code!!! */
|
2002-09-24 17:22:12 +00:00
|
|
|
|
bool dbg_ports(void)
|
2002-07-15 11:23:24 +00:00
|
|
|
|
{
|
2005-02-02 21:57:40 +00:00
|
|
|
|
#if CONFIG_CPU == SH7034
|
2002-07-15 11:23:24 +00:00
|
|
|
|
unsigned short porta;
|
|
|
|
|
unsigned short portb;
|
|
|
|
|
unsigned char portc;
|
|
|
|
|
char buf[32];
|
2006-10-30 11:33:38 +00:00
|
|
|
|
int adc_battery_voltage, adc_battery_level;
|
2002-07-15 11:23:24 +00:00
|
|
|
|
|
2005-08-14 08:43:05 +00:00
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2002-08-20 22:13:20 +00:00
|
|
|
|
lcd_setmargins(0, 0);
|
2002-07-15 11:23:24 +00:00
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
porta = PADR;
|
|
|
|
|
portb = PBDR;
|
|
|
|
|
portc = PCDR;
|
|
|
|
|
|
|
|
|
|
snprintf(buf, 32, "PADR: %04x", porta);
|
|
|
|
|
lcd_puts(0, 0, buf);
|
|
|
|
|
snprintf(buf, 32, "PBDR: %04x", portb);
|
|
|
|
|
lcd_puts(0, 1, buf);
|
|
|
|
|
|
|
|
|
|
snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
|
|
|
|
|
lcd_puts(0, 2, buf);
|
|
|
|
|
snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
|
|
|
|
|
lcd_puts(0, 3, buf);
|
|
|
|
|
snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
|
|
|
|
|
lcd_puts(0, 4, buf);
|
|
|
|
|
snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
|
|
|
|
|
lcd_puts(0, 5, buf);
|
|
|
|
|
|
2007-08-15 23:57:27 +00:00
|
|
|
|
battery_read_info(&adc_battery_voltage, &adc_battery_level);
|
|
|
|
|
snprintf(buf, 32, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
|
|
|
|
|
adc_battery_voltage % 1000, adc_battery_level);
|
2002-07-15 11:23:24 +00:00
|
|
|
|
lcd_puts(0, 6, buf);
|
2007-04-11 21:26:58 +00:00
|
|
|
|
|
2002-07-15 11:23:24 +00:00
|
|
|
|
lcd_update();
|
2006-12-27 07:20:42 +00:00
|
|
|
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
2006-08-15 12:27:07 +00:00
|
|
|
|
return false;
|
2002-07-15 11:23:24 +00:00
|
|
|
|
}
|
2005-07-18 12:40:29 +00:00
|
|
|
|
#elif defined(CPU_COLDFIRE)
|
2005-02-11 13:16:09 +00:00
|
|
|
|
unsigned int gpio_out;
|
|
|
|
|
unsigned int gpio1_out;
|
|
|
|
|
unsigned int gpio_read;
|
|
|
|
|
unsigned int gpio1_read;
|
|
|
|
|
unsigned int gpio_function;
|
|
|
|
|
unsigned int gpio1_function;
|
|
|
|
|
unsigned int gpio_enable;
|
|
|
|
|
unsigned int gpio1_enable;
|
2006-10-30 11:33:38 +00:00
|
|
|
|
int adc_buttons, adc_remote;
|
2007-08-15 23:57:27 +00:00
|
|
|
|
int adc_battery_voltage, adc_battery_level;
|
2005-03-01 14:40:27 +00:00
|
|
|
|
char buf[128];
|
2005-02-11 13:16:09 +00:00
|
|
|
|
int line;
|
|
|
|
|
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
line = 0;
|
|
|
|
|
gpio_read = GPIO_READ;
|
|
|
|
|
gpio1_read = GPIO1_READ;
|
|
|
|
|
gpio_out = GPIO_OUT;
|
|
|
|
|
gpio1_out = GPIO1_OUT;
|
|
|
|
|
gpio_function = GPIO_FUNCTION;
|
|
|
|
|
gpio1_function = GPIO1_FUNCTION;
|
|
|
|
|
gpio_enable = GPIO_ENABLE;
|
|
|
|
|
gpio1_enable = GPIO1_ENABLE;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_READ: %08x", gpio_read);
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_OUT: %08x", gpio_out);
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_FUNCTION: %08x", gpio_function);
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_ENABLE: %08x", gpio_enable);
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO1_READ: %08x", gpio1_read);
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO1_OUT: %08x", gpio1_out);
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO1_FUNCTION: %08x", gpio1_function);
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO1_ENABLE: %08x", gpio1_enable);
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
adc_buttons = adc_read(ADC_BUTTONS);
|
2006-10-30 11:33:38 +00:00
|
|
|
|
adc_remote = adc_read(ADC_REMOTE);
|
2007-08-15 23:57:27 +00:00
|
|
|
|
battery_read_info(&adc_battery_voltage, &adc_battery_level);
|
2007-03-05 01:31:26 +00:00
|
|
|
|
#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
|
2006-10-27 05:31:28 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_BUTTONS (%c): %02x",
|
2006-10-28 23:10:45 +00:00
|
|
|
|
button_scan_enabled() ? '+' : '-', adc_buttons);
|
2006-10-29 13:48:57 +00:00
|
|
|
|
#else
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_BUTTONS: %02x", adc_buttons);
|
|
|
|
|
#endif
|
2006-10-27 05:31:28 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-03-05 00:04:00 +00:00
|
|
|
|
#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
|
2006-10-27 05:31:28 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_REMOTE (%c): %02x",
|
|
|
|
|
remote_detect() ? '+' : '-', adc_remote);
|
|
|
|
|
#else
|
2005-03-01 14:40:27 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_REMOTE: %02x", adc_remote);
|
2006-10-27 05:31:28 +00:00
|
|
|
|
#endif
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-04-20 21:05:04 +00:00
|
|
|
|
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
|
2006-10-30 11:33:38 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_REMOTEDETECT: %02x",
|
|
|
|
|
adc_read(ADC_REMOTEDETECT));
|
2006-02-17 22:38:38 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-03-18 23:07:34 +00:00
|
|
|
|
#endif
|
2005-02-11 13:16:09 +00:00
|
|
|
|
|
2007-08-15 23:57:27 +00:00
|
|
|
|
snprintf(buf, 32, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
|
|
|
|
|
adc_battery_voltage % 1000, adc_battery_level);
|
2005-04-06 23:53:19 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-04-20 21:05:04 +00:00
|
|
|
|
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
|
2007-04-06 22:55:00 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "remotetype: %d", remote_type());
|
2006-02-17 22:38:38 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-03-18 23:07:34 +00:00
|
|
|
|
#endif
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-02-11 13:16:09 +00:00
|
|
|
|
lcd_update();
|
2006-12-27 07:20:42 +00:00
|
|
|
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
2006-08-15 12:27:07 +00:00
|
|
|
|
return false;
|
2005-02-11 13:16:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-07-02 05:16:40 +00:00
|
|
|
|
#elif defined(CPU_PP502x)
|
2006-01-31 01:50:10 +00:00
|
|
|
|
|
|
|
|
|
unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
|
2006-03-18 09:13:55 +00:00
|
|
|
|
unsigned int gpio_e, gpio_f, gpio_g, gpio_h;
|
|
|
|
|
unsigned int gpio_i, gpio_j, gpio_k, gpio_l;
|
2006-01-31 01:50:10 +00:00
|
|
|
|
|
|
|
|
|
char buf[128];
|
|
|
|
|
int line;
|
|
|
|
|
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
gpio_a = GPIOA_INPUT_VAL;
|
|
|
|
|
gpio_b = GPIOB_INPUT_VAL;
|
|
|
|
|
gpio_c = GPIOC_INPUT_VAL;
|
2006-05-07 22:56:44 +00:00
|
|
|
|
|
|
|
|
|
gpio_g = GPIOG_INPUT_VAL;
|
|
|
|
|
gpio_h = GPIOH_INPUT_VAL;
|
|
|
|
|
gpio_i = GPIOI_INPUT_VAL;
|
2006-01-31 01:50:10 +00:00
|
|
|
|
|
|
|
|
|
line = 0;
|
2006-09-29 12:20:04 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_G: %02x", gpio_a, gpio_g);
|
2006-01-31 01:50:10 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-09-29 12:20:04 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_B: %02x GPIO_H: %02x", gpio_b, gpio_h);
|
2006-01-31 01:50:10 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-09-29 12:20:04 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_I: %02x", gpio_c, gpio_i);
|
2006-01-31 01:50:10 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-03-18 09:13:55 +00:00
|
|
|
|
|
2006-05-07 22:56:44 +00:00
|
|
|
|
gpio_d = GPIOD_INPUT_VAL;
|
2006-03-18 09:13:55 +00:00
|
|
|
|
gpio_e = GPIOE_INPUT_VAL;
|
|
|
|
|
gpio_f = GPIOF_INPUT_VAL;
|
|
|
|
|
|
|
|
|
|
gpio_j = GPIOJ_INPUT_VAL;
|
|
|
|
|
gpio_k = GPIOK_INPUT_VAL;
|
|
|
|
|
gpio_l = GPIOL_INPUT_VAL;
|
|
|
|
|
|
2006-09-29 12:20:04 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_D: %02x GPIO_J: %02x", gpio_d, gpio_j);
|
2006-03-18 09:13:55 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-09-29 12:20:04 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_E: %02x GPIO_K: %02x", gpio_e, gpio_k);
|
2006-03-18 09:13:55 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-09-29 12:20:04 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l);
|
2006-03-18 09:13:55 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-07-02 05:16:40 +00:00
|
|
|
|
line++;
|
|
|
|
|
|
2007-08-03 20:03:40 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "DEV_EN: %08lx", DEV_EN);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-08-03 19:20:29 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "CLOCK_SRC: %08lx", CLOCK_SOURCE);
|
2007-07-02 05:16:40 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-08-03 19:20:29 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "CLCD_CLK_SRC: %08lx", CLCD_CLOCK_SRC);
|
2007-07-03 00:42:42 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-08-03 19:20:29 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "PLL_CONTROL: %08lx", PLL_CONTROL);
|
2007-07-03 00:42:42 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-08-03 19:20:29 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "PLL_STATUS: %08lx", PLL_STATUS);
|
2007-07-02 05:16:40 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-08-03 19:20:29 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "DEV_TIMING1: %08lx", DEV_TIMING1);
|
2007-07-02 05:16:40 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
2006-09-23 17:47:54 +00:00
|
|
|
|
#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
|
|
|
|
|
line++;
|
2007-08-22 20:43:47 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "BATT: %03x UNK1: %03x", adc_read(ADC_BATTERY),
|
2007-08-21 21:57:00 +00:00
|
|
|
|
adc_read(ADC_UNKNOWN_1));
|
2006-09-23 17:47:54 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-08-22 20:43:47 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "REM: %03x PAD: %03x", adc_read(ADC_REMOTE),
|
2007-08-21 21:57:00 +00:00
|
|
|
|
adc_read(ADC_SCROLLPAD));
|
2006-09-23 17:47:54 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-03-13 01:50:13 +00:00
|
|
|
|
#elif defined(SANSA_E200)
|
|
|
|
|
line++;
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_BVDD: %02x", adc_read(ADC_BVDD));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_RTCSUP: %02x", adc_read(ADC_RTCSUP));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_UVDD: %02x", adc_read(ADC_UVDD));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_CHG_IN: %02x", adc_read(ADC_CHG_IN));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_CVDD: %02x", adc_read(ADC_CVDD));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_BATTEMP: %02x", adc_read(ADC_BATTEMP));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_MICSUP1: %02x", adc_read(ADC_MICSUP1));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_MICSUP2: %02x", adc_read(ADC_MICSUP2));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_VBE1: %02x", adc_read(ADC_VBE1));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_VBE2: %02x", adc_read(ADC_VBE2));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_I_MICSUP1: %02x", adc_read(ADC_I_MICSUP1));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_I_MICSUP2: %02x", adc_read(ADC_I_MICSUP2));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "ADC_VBAT: %02x", adc_read(ADC_VBAT));
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2006-09-23 17:47:54 +00:00
|
|
|
|
#endif
|
2006-01-31 01:50:10 +00:00
|
|
|
|
lcd_update();
|
2006-12-27 07:20:42 +00:00
|
|
|
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
2006-08-15 12:27:07 +00:00
|
|
|
|
return false;
|
2006-01-31 01:50:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-25 18:34:59 +00:00
|
|
|
|
#elif CONFIG_CPU == PP5002
|
|
|
|
|
unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
|
|
|
|
|
|
|
|
|
|
char buf[128];
|
|
|
|
|
int line;
|
|
|
|
|
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
gpio_a = GPIOA_INPUT_VAL;
|
|
|
|
|
gpio_b = GPIOB_INPUT_VAL;
|
|
|
|
|
gpio_c = GPIOC_INPUT_VAL;
|
|
|
|
|
gpio_d = GPIOD_INPUT_VAL;
|
|
|
|
|
|
|
|
|
|
line = 0;
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_B: %02x", gpio_a, gpio_b);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_D: %02x", gpio_c, gpio_d);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
2007-08-03 19:20:29 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "DEV_EN: %08lx", DEV_EN);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-07-10 20:47:01 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "CLOCK_ENABLE: %08lx", CLOCK_ENABLE);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "CLOCK_SOURCE: %08lx", CLOCK_SOURCE);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-07-29 07:50:34 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "PLL_CONTROL: %08lx", PLL_CONTROL);
|
2007-07-10 20:47:01 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "PLL_DIV: %08lx", PLL_DIV);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "PLL_MULT: %08lx", PLL_MULT);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "TIMING1_CTL: %08lx", TIMING1_CTL);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "TIMING2_CTL: %08lx", TIMING2_CTL);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
2007-04-21 04:48:20 +00:00
|
|
|
|
lcd_update();
|
|
|
|
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#elif CONFIG_CPU == S3C2440
|
2007-05-07 19:34:34 +00:00
|
|
|
|
char buf[50];
|
2007-04-21 05:07:18 +00:00
|
|
|
|
int line;
|
2007-04-21 04:48:20 +00:00
|
|
|
|
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
line = 0;
|
2007-05-07 19:34:34 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "[Ports and Registers]"); lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPACON: %08x GPBCON: %08x", GPACON, GPBCON); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPADAT: %08x GPBDAT: %08x", GPADAT, GPBDAT); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPAUP: %08x GPBUP: %08x", 0, GPBUP); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPCCON: %08x GPDCON: %08x", GPCCON, GPDCON); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPCDAT: %08x GPDDAT: %08x", GPCDAT, GPDDAT); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPCUP: %08x GPDUP: %08x", GPCUP, GPDUP); lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPCCON: %08x GPDCON: %08x", GPCCON, GPDCON); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPCDAT: %08x GPDDAT: %08x", GPCDAT, GPDDAT); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPCUP: %08x GPDUP: %08x", GPCUP, GPDUP); lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPECON: %08x GPFCON: %08x", GPECON, GPFCON); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPEDAT: %08x GPFDAT: %08x", GPEDAT, GPFDAT); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPEUP: %08x GPFUP: %08x", GPEUP, GPFUP); lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPGCON: %08x GPHCON: %08x", GPGCON, GPHCON); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPGDAT: %08x GPHDAT: %08x", GPGDAT, GPHDAT); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPGUP: %08x GPHUP: %08x", GPGUP, GPHUP); lcd_puts(0, line++, buf);
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPJCON: %08x", GPJCON); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPJDAT: %08x", GPJDAT); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "GPJUP: %08x", GPJUP); lcd_puts(0, line++, buf);
|
2007-04-21 04:48:20 +00:00
|
|
|
|
|
2007-05-07 19:34:34 +00:00
|
|
|
|
line++;
|
|
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "SRCPND: %08x INTMOD: %08x", SRCPND, INTMOD); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "INTMSK: %08x INTPND: %08x", INTMSK, INTPND); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "CLKCON: %08x CLKSLOW: %08x", CLKCON, CLKSLOW); lcd_puts(0, line++, buf);
|
2007-06-26 02:11:30 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "MPLLCON: %08x UPLLCON: %08x", MPLLCON, UPLLCON); lcd_puts(0, line++, buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "CLKDIVN: %08x", CLKDIVN); lcd_puts(0, line++, buf);
|
|
|
|
|
|
2006-10-25 18:34:59 +00:00
|
|
|
|
lcd_update();
|
2006-12-27 07:20:42 +00:00
|
|
|
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
2006-10-25 18:34:59 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* CPU */
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return false;
|
2002-07-15 11:23:24 +00:00
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#else /* !HAVE_LCD_BITMAP */
|
2002-09-24 17:22:12 +00:00
|
|
|
|
bool dbg_ports(void)
|
2002-07-15 11:23:24 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned short porta;
|
|
|
|
|
unsigned short portb;
|
|
|
|
|
unsigned char portc;
|
|
|
|
|
char buf[32];
|
|
|
|
|
int button;
|
2006-10-30 11:33:38 +00:00
|
|
|
|
int adc_battery_voltage;
|
2002-07-15 11:23:24 +00:00
|
|
|
|
int currval = 0;
|
|
|
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
porta = PADR;
|
|
|
|
|
portb = PBDR;
|
|
|
|
|
portc = PCDR;
|
|
|
|
|
|
|
|
|
|
switch(currval)
|
|
|
|
|
{
|
2002-08-10 08:52:11 +00:00
|
|
|
|
case 0:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "PADR: %04x", porta);
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "PBDR: %04x", portb);
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "AN0: %03x", adc_read(0));
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "AN1: %03x", adc_read(1));
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "AN2: %03x", adc_read(2));
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 5:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "AN3: %03x", adc_read(3));
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 6:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "AN4: %03x", adc_read(4));
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 7:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "AN5: %03x", adc_read(5));
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 8:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "AN6: %03x", adc_read(6));
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case 9:
|
2007-04-11 21:26:58 +00:00
|
|
|
|
snprintf(buf, 32, "AN7: %03x", adc_read(7));
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
break;
|
2002-07-15 11:23:24 +00:00
|
|
|
|
}
|
|
|
|
|
lcd_puts(0, 0, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2007-08-15 23:57:27 +00:00
|
|
|
|
battery_read_info(&adc_battery_voltage, NULL);
|
|
|
|
|
snprintf(buf, 32, "Batt: %d.%03dV", adc_battery_voltage / 1000,
|
|
|
|
|
adc_battery_voltage % 1000);
|
2002-07-15 11:23:24 +00:00
|
|
|
|
lcd_puts(0, 1, buf);
|
2007-04-06 22:55:00 +00:00
|
|
|
|
lcd_update();
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
button = get_action(CONTEXT_SETTINGS,HZ/5);
|
2002-07-15 11:23:24 +00:00
|
|
|
|
|
|
|
|
|
switch(button)
|
|
|
|
|
{
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_CANCEL:
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return false;
|
2002-08-10 08:52:11 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_SETTINGS_DEC:
|
2002-08-10 08:52:11 +00:00
|
|
|
|
currval--;
|
|
|
|
|
if(currval < 0)
|
2007-04-11 21:26:58 +00:00
|
|
|
|
currval = 9;
|
2002-08-10 08:52:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_SETTINGS_INC:
|
2002-08-10 08:52:11 +00:00
|
|
|
|
currval++;
|
2007-04-11 21:26:58 +00:00
|
|
|
|
if(currval > 9)
|
2002-08-10 08:52:11 +00:00
|
|
|
|
currval = 0;
|
|
|
|
|
break;
|
2002-07-15 11:23:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return false;
|
2002-07-15 11:23:24 +00:00
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* !HAVE_LCD_BITMAP */
|
2006-10-04 07:42:45 +00:00
|
|
|
|
#endif /* !SIMULATOR */
|
2002-07-15 11:23:24 +00:00
|
|
|
|
|
2005-03-07 10:51:43 +00:00
|
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_cpufreq(void)
|
2005-03-07 10:51:43 +00:00
|
|
|
|
{
|
|
|
|
|
char buf[128];
|
|
|
|
|
int line;
|
|
|
|
|
int button;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
lcd_setmargins(0, 0);
|
2005-08-18 07:16:53 +00:00
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2005-03-07 10:51:43 +00:00
|
|
|
|
#endif
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
line = 0;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-03-07 10:51:43 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "Frequency: %ld", FREQ);
|
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
|
|
2006-10-05 10:07:03 +00:00
|
|
|
|
snprintf(buf, sizeof(buf), "boost_counter: %d", get_cpu_boost_counter());
|
2005-03-07 10:51:43 +00:00
|
|
|
|
lcd_puts(0, line++, buf);
|
2007-07-02 05:16:40 +00:00
|
|
|
|
|
2005-03-07 10:51:43 +00:00
|
|
|
|
lcd_update();
|
2006-08-15 12:27:07 +00:00
|
|
|
|
button = get_action(CONTEXT_STD,HZ/10);
|
2005-03-07 10:51:43 +00:00
|
|
|
|
|
|
|
|
|
switch(button)
|
|
|
|
|
{
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_PREV:
|
2006-12-05 20:01:48 +00:00
|
|
|
|
cpu_boost(true);
|
2006-08-15 12:27:07 +00:00
|
|
|
|
break;
|
2006-10-05 10:07:03 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_NEXT:
|
2006-12-05 20:01:48 +00:00
|
|
|
|
cpu_boost(false);
|
2006-08-15 12:27:07 +00:00
|
|
|
|
break;
|
2005-03-07 13:02:06 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_OK:
|
2006-10-05 10:07:03 +00:00
|
|
|
|
while (get_cpu_boost_counter() > 0)
|
2006-12-05 20:01:48 +00:00
|
|
|
|
cpu_boost(false);
|
2006-11-01 11:12:21 +00:00
|
|
|
|
set_cpu_frequency(CPUFREQ_DEFAULT);
|
2006-08-15 12:27:07 +00:00
|
|
|
|
break;
|
2006-03-17 02:02:13 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
|
return false;
|
2005-03-07 10:51:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2002-08-08 20:44:25 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2002-08-06 10:52:51 +00:00
|
|
|
|
/*
|
|
|
|
|
* view_battery() shows a automatically scaled graph of the battery voltage
|
|
|
|
|
* over time. Usable for estimating battery life / charging rate.
|
|
|
|
|
* The power_history array is updated in power_thread of powermgmt.c.
|
|
|
|
|
*/
|
|
|
|
|
|
2005-03-03 07:25:43 +00:00
|
|
|
|
#define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
|
2002-08-06 10:52:51 +00:00
|
|
|
|
#define BAT_YSPACE (LCD_HEIGHT - 20)
|
|
|
|
|
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool view_battery(void)
|
2002-08-06 10:52:51 +00:00
|
|
|
|
{
|
|
|
|
|
int view = 0;
|
|
|
|
|
int i, x, y;
|
2005-02-08 15:12:25 +00:00
|
|
|
|
unsigned short maxv, minv;
|
2002-08-06 10:52:51 +00:00
|
|
|
|
char buf[32];
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-08-20 22:13:20 +00:00
|
|
|
|
lcd_setmargins(0, 0);
|
2005-08-14 08:43:05 +00:00
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2005-10-10 19:43:07 +00:00
|
|
|
|
|
2002-08-06 10:52:51 +00:00
|
|
|
|
while(1)
|
|
|
|
|
{
|
2007-04-06 22:55:00 +00:00
|
|
|
|
lcd_clear_display();
|
2002-08-06 10:52:51 +00:00
|
|
|
|
switch (view) {
|
2002-08-10 08:57:47 +00:00
|
|
|
|
case 0: /* voltage history graph */
|
|
|
|
|
/* Find maximum and minimum voltage for scaling */
|
2007-08-15 23:57:27 +00:00
|
|
|
|
minv = power_history[0];
|
|
|
|
|
maxv = minv + 1;
|
|
|
|
|
for (i = 1; i < BAT_LAST_VAL && power_history[i]; i++) {
|
2002-08-10 08:57:47 +00:00
|
|
|
|
if (power_history[i] > maxv)
|
|
|
|
|
maxv = power_history[i];
|
2007-08-15 23:57:27 +00:00
|
|
|
|
if (power_history[i] < minv)
|
2002-08-10 08:57:47 +00:00
|
|
|
|
minv = power_history[i];
|
2002-08-06 10:52:51 +00:00
|
|
|
|
}
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2007-08-15 23:57:27 +00:00
|
|
|
|
snprintf(buf, 30, "Battery %d.%03d", power_history[0] / 1000,
|
|
|
|
|
power_history[0] % 1000);
|
2005-03-03 07:25:43 +00:00
|
|
|
|
lcd_puts(0, 0, buf);
|
2007-08-15 23:57:27 +00:00
|
|
|
|
snprintf(buf, 30, "scale %d.%03d-%d.%03dV",
|
|
|
|
|
minv / 1000, minv % 1000, maxv / 1000, maxv % 1000);
|
2002-08-10 08:57:47 +00:00
|
|
|
|
lcd_puts(0, 1, buf);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-08-10 08:57:47 +00:00
|
|
|
|
x = 0;
|
2005-03-03 07:25:43 +00:00
|
|
|
|
for (i = BAT_LAST_VAL - 1; i >= 0; i--) {
|
2002-08-10 08:57:47 +00:00
|
|
|
|
y = (power_history[i] - minv) * BAT_YSPACE / (maxv - minv);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
2005-06-25 00:28:09 +00:00
|
|
|
|
lcd_vline(x, LCD_HEIGHT-1, 20);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID);
|
2005-06-25 00:28:09 +00:00
|
|
|
|
lcd_vline(x, LCD_HEIGHT-1,
|
|
|
|
|
MIN(MAX(LCD_HEIGHT-1 - y, 20), LCD_HEIGHT-1));
|
2002-08-10 08:57:47 +00:00
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-08-10 08:57:47 +00:00
|
|
|
|
case 1: /* status: */
|
|
|
|
|
lcd_puts(0, 0, "Power status:");
|
2005-11-03 21:21:37 +00:00
|
|
|
|
|
2007-08-15 23:57:27 +00:00
|
|
|
|
battery_read_info(&y, NULL);
|
|
|
|
|
snprintf(buf, 30, "Battery: %d.%03d V", y / 1000, y % 1000);
|
2002-08-10 08:57:47 +00:00
|
|
|
|
lcd_puts(0, 1, buf);
|
2004-12-01 00:33:18 +00:00
|
|
|
|
#ifdef ADC_EXT_POWER
|
2007-08-15 23:57:27 +00:00
|
|
|
|
y = (adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 1000;
|
|
|
|
|
snprintf(buf, 30, "External: %d.%03d V", y / 1000, y % 1000);
|
2002-08-10 08:57:47 +00:00
|
|
|
|
lcd_puts(0, 2, buf);
|
2004-12-01 00:33:18 +00:00
|
|
|
|
#endif
|
2007-02-18 05:32:06 +00:00
|
|
|
|
#if CONFIG_CHARGING
|
2006-06-06 22:23:52 +00:00
|
|
|
|
#if CONFIG_CHARGING == CHARGING_CONTROL
|
2006-08-21 17:35:35 +00:00
|
|
|
|
snprintf(buf, 30, "Chgr: %s %s",
|
2005-03-28 00:47:09 +00:00
|
|
|
|
charger_inserted() ? "present" : "absent",
|
|
|
|
|
charger_enabled ? "on" : "off");
|
|
|
|
|
lcd_puts(0, 3, buf);
|
2005-03-03 07:25:43 +00:00
|
|
|
|
snprintf(buf, 30, "short delta: %d", short_delta);
|
2002-08-10 08:57:47 +00:00
|
|
|
|
lcd_puts(0, 5, buf);
|
2005-03-03 07:25:43 +00:00
|
|
|
|
snprintf(buf, 30, "long delta: %d", long_delta);
|
2002-08-10 08:57:47 +00:00
|
|
|
|
lcd_puts(0, 6, buf);
|
|
|
|
|
lcd_puts(0, 7, power_message);
|
2007-02-01 10:47:22 +00:00
|
|
|
|
snprintf(buf, 30, "USB Inserted: %s",
|
|
|
|
|
usb_inserted() ? "yes" : "no");
|
|
|
|
|
lcd_puts(0, 8, buf);
|
|
|
|
|
#if defined IRIVER_H300_SERIES
|
|
|
|
|
snprintf(buf, 30, "USB Charging Enabled: %s",
|
|
|
|
|
usb_charging_enabled() ? "yes" : "no");
|
|
|
|
|
lcd_puts(0, 9, buf);
|
|
|
|
|
#endif
|
2006-06-06 22:23:52 +00:00
|
|
|
|
#else /* CONFIG_CHARGING != CHARGING_CONTROL */
|
|
|
|
|
#if defined IPOD_NANO || defined IPOD_VIDEO
|
2006-03-18 09:13:55 +00:00
|
|
|
|
int usb_pwr = (GPIOL_INPUT_VAL & 0x10)?true:false;
|
|
|
|
|
int ext_pwr = (GPIOL_INPUT_VAL & 0x08)?false:true;
|
|
|
|
|
int dock = (GPIOA_INPUT_VAL & 0x10)?true:false;
|
|
|
|
|
int charging = (GPIOB_INPUT_VAL & 0x01)?false:true;
|
|
|
|
|
int headphone= (GPIOA_INPUT_VAL & 0x80)?true:false;
|
|
|
|
|
|
|
|
|
|
snprintf(buf, 30, "USB pwr: %s",
|
|
|
|
|
usb_pwr ? "present" : "absent");
|
|
|
|
|
lcd_puts(0, 3, buf);
|
|
|
|
|
snprintf(buf, 30, "EXT pwr: %s",
|
|
|
|
|
ext_pwr ? "present" : "absent");
|
|
|
|
|
lcd_puts(0, 4, buf);
|
|
|
|
|
snprintf(buf, 30, "Battery: %s",
|
2006-10-27 05:31:28 +00:00
|
|
|
|
charging ? "charging" : (usb_pwr||ext_pwr) ? "charged" : "discharging");
|
2006-03-18 09:13:55 +00:00
|
|
|
|
lcd_puts(0, 5, buf);
|
|
|
|
|
snprintf(buf, 30, "Dock mode: %s",
|
|
|
|
|
dock ? "enabled" : "disabled");
|
|
|
|
|
lcd_puts(0, 6, buf);
|
|
|
|
|
snprintf(buf, 30, "Headphone: %s",
|
|
|
|
|
headphone ? "connected" : "disconnected");
|
|
|
|
|
lcd_puts(0, 7, buf);
|
2006-03-18 09:34:58 +00:00
|
|
|
|
#else
|
2005-11-03 21:21:37 +00:00
|
|
|
|
snprintf(buf, 30, "Charger: %s",
|
|
|
|
|
charger_inserted() ? "present" : "absent");
|
|
|
|
|
lcd_puts(0, 3, buf);
|
2006-03-18 09:13:55 +00:00
|
|
|
|
#endif
|
2006-06-06 22:23:52 +00:00
|
|
|
|
#endif /* CONFIG_CHARGING != CHARGING_CONTROL */
|
|
|
|
|
#endif /* CONFIG_CHARGING */
|
2002-08-10 08:57:47 +00:00
|
|
|
|
break;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-08-10 08:57:47 +00:00
|
|
|
|
case 2: /* voltage deltas: */
|
|
|
|
|
lcd_puts(0, 0, "Voltage deltas:");
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-08-10 08:57:47 +00:00
|
|
|
|
for (i = 0; i <= 6; i++) {
|
2007-08-15 23:57:27 +00:00
|
|
|
|
y = power_history[i] - power_history[i+1];
|
|
|
|
|
snprintf(buf, 30, "-%d min: %s%d.%03d V", i,
|
|
|
|
|
(y < 0) ? "-" : "", ((y < 0) ? y * -1 : y) / 1000,
|
|
|
|
|
((y < 0) ? y * -1 : y ) % 1000);
|
2002-08-10 08:57:47 +00:00
|
|
|
|
lcd_puts(0, i+1, buf);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2002-12-03 14:18:51 +00:00
|
|
|
|
|
2005-03-28 00:47:09 +00:00
|
|
|
|
case 3: /* remaining time estimation: */
|
2002-12-15 18:10:19 +00:00
|
|
|
|
|
2006-06-06 22:23:52 +00:00
|
|
|
|
#if CONFIG_CHARGING == CHARGING_CONTROL
|
2002-12-15 18:10:19 +00:00
|
|
|
|
snprintf(buf, 30, "charge_state: %d", charge_state);
|
|
|
|
|
lcd_puts(0, 0, buf);
|
|
|
|
|
|
2002-12-03 14:18:51 +00:00
|
|
|
|
snprintf(buf, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min);
|
|
|
|
|
lcd_puts(0, 1, buf);
|
|
|
|
|
|
2005-03-03 07:25:43 +00:00
|
|
|
|
snprintf(buf, 30, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level);
|
2002-12-03 14:18:51 +00:00
|
|
|
|
lcd_puts(0, 2, buf);
|
2005-03-28 00:47:09 +00:00
|
|
|
|
|
|
|
|
|
snprintf(buf, 30, "P=%2d I=%2d", pid_p, pid_i);
|
|
|
|
|
lcd_puts(0, 3, buf);
|
|
|
|
|
|
|
|
|
|
snprintf(buf, 30, "Trickle sec: %d/60", trickle_sec);
|
|
|
|
|
lcd_puts(0, 4, buf);
|
2006-06-06 22:23:52 +00:00
|
|
|
|
#endif /* CONFIG_CHARGING == CHARGING_CONTROL */
|
2002-12-03 14:18:51 +00:00
|
|
|
|
|
2007-08-15 23:57:27 +00:00
|
|
|
|
snprintf(buf, 30, "Last PwrHist: %d.%03dV",
|
|
|
|
|
power_history[0] / 1000,
|
|
|
|
|
power_history[0] % 1000);
|
2005-03-28 00:00:24 +00:00
|
|
|
|
lcd_puts(0, 5, buf);
|
2002-12-03 14:18:51 +00:00
|
|
|
|
|
2005-03-28 00:47:09 +00:00
|
|
|
|
snprintf(buf, 30, "battery level: %d%%", battery_level());
|
2005-03-28 00:00:24 +00:00
|
|
|
|
lcd_puts(0, 6, buf);
|
|
|
|
|
|
2005-03-28 00:47:09 +00:00
|
|
|
|
snprintf(buf, 30, "Est. remain: %d m", battery_time());
|
2002-12-14 12:10:29 +00:00
|
|
|
|
lcd_puts(0, 7, buf);
|
2002-12-03 14:18:51 +00:00
|
|
|
|
break;
|
2002-08-06 10:52:51 +00:00
|
|
|
|
}
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2002-08-06 10:52:51 +00:00
|
|
|
|
lcd_update();
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
switch(get_action(CONTEXT_SETTINGS,HZ/2))
|
2002-08-06 10:52:51 +00:00
|
|
|
|
{
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_SETTINGS_DEC:
|
2002-08-10 08:57:47 +00:00
|
|
|
|
if (view)
|
|
|
|
|
view--;
|
|
|
|
|
break;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_SETTINGS_INC:
|
2002-12-03 14:18:51 +00:00
|
|
|
|
if (view < 3)
|
2002-08-10 08:57:47 +00:00
|
|
|
|
view++;
|
|
|
|
|
break;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
|
case ACTION_STD_CANCEL:
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return false;
|
2002-08-06 10:52:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return false;
|
2002-08-06 10:52:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2007-06-30 02:08:27 +00:00
|
|
|
|
#if defined(HAVE_MMC) || defined(HAVE_HOTSWAP)
|
2007-07-14 08:55:47 +00:00
|
|
|
|
#if defined(HAVE_MMC)
|
|
|
|
|
#define CARDTYPE "MMC"
|
|
|
|
|
#else
|
|
|
|
|
#define CARDTYPE "microSD"
|
|
|
|
|
#endif
|
2007-10-20 12:32:55 +00:00
|
|
|
|
static int disk_callback(int btn, struct gui_synclist *lists)
|
2004-09-28 06:23:57 +00:00
|
|
|
|
{
|
2004-10-06 20:43:12 +00:00
|
|
|
|
tCardInfo *card;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
int *cardnum = (int*)lists->gui_list[SCREEN_MAIN].data;
|
2004-10-06 20:43:12 +00:00
|
|
|
|
unsigned char card_name[7];
|
2007-07-12 09:58:54 +00:00
|
|
|
|
unsigned char pbuf[32];
|
2007-10-20 12:32:55 +00:00
|
|
|
|
char *title = lists->gui_list[SCREEN_MAIN].title;
|
2004-10-06 20:43:12 +00:00
|
|
|
|
static const unsigned char i_vmin[] = { 0, 1, 5, 10, 25, 35, 60, 100 };
|
|
|
|
|
static const unsigned char i_vmax[] = { 1, 5, 10, 25, 35, 45, 80, 200 };
|
2005-01-31 00:39:20 +00:00
|
|
|
|
static const unsigned char *kbit_units[] = { "kBit/s", "MBit/s", "GBit/s" };
|
2007-10-20 12:32:55 +00:00
|
|
|
|
static const unsigned char *nsec_units[] = { "ns", "<EFBFBD>s", "ms" };
|
2006-10-15 11:51:56 +00:00
|
|
|
|
static const char *spec_vers[] = { "1.0-1.2", "1.4", "2.0-2.2",
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"3.1-3.31", "4.0" };
|
2007-07-15 18:25:39 +00:00
|
|
|
|
if ((btn == ACTION_STD_OK) || (btn == SYS_FS_CHANGED) || (btn == ACTION_REDRAW))
|
2004-10-06 20:43:12 +00:00
|
|
|
|
{
|
2007-07-12 09:58:54 +00:00
|
|
|
|
if (btn == ACTION_STD_OK)
|
2007-10-20 12:32:55 +00:00
|
|
|
|
{
|
|
|
|
|
*cardnum ^= 0x1; /* change cards */
|
|
|
|
|
}
|
2007-07-15 18:25:39 +00:00
|
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_set_line_count(0);
|
2007-07-15 18:25:39 +00:00
|
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
|
card = card_get_info(*cardnum);
|
2007-07-15 18:25:39 +00:00
|
|
|
|
|
2007-07-25 06:15:07 +00:00
|
|
|
|
if (card->initialized > 0)
|
2004-10-06 20:43:12 +00:00
|
|
|
|
{
|
2007-07-12 09:58:54 +00:00
|
|
|
|
card_name[6] = '\0';
|
|
|
|
|
strncpy(card_name, ((unsigned char*)card->cid) + 3, 6);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"%s Rev %d.%d", card_name,
|
|
|
|
|
(int) card_extract_bits(card->cid, 72, 4),
|
|
|
|
|
(int) card_extract_bits(card->cid, 76, 4));
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Prod: %d/%d",
|
|
|
|
|
(int) card_extract_bits(card->cid, 112, 4),
|
|
|
|
|
(int) card_extract_bits(card->cid, 116, 4) + 1997);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Ser#: 0x%08lx",
|
|
|
|
|
card_extract_bits(card->cid, 80, 32));
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"M=%02x, O=%04x",
|
|
|
|
|
(int) card_extract_bits(card->cid, 0, 8),
|
|
|
|
|
(int) card_extract_bits(card->cid, 8, 16));
|
|
|
|
|
int temp = card_extract_bits(card->csd, 2, 4);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-14 08:55:47 +00:00
|
|
|
|
CARDTYPE " v%s", temp < 5 ?
|
2007-07-12 09:58:54 +00:00
|
|
|
|
spec_vers[temp] : "?.?");
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Blocks: 0x%06lx", card->numblocks);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Blksz.: %d P:%c%c", card->blocksize,
|
|
|
|
|
card_extract_bits(card->csd, 48, 1) ? 'R' : '-',
|
|
|
|
|
card_extract_bits(card->csd, 106, 1) ? 'W' : '-');
|
|
|
|
|
output_dyn_value(pbuf, sizeof pbuf, card->speed / 1000,
|
|
|
|
|
kbit_units, false);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Speed: %s", pbuf);
|
|
|
|
|
output_dyn_value(pbuf, sizeof pbuf, card->tsac,
|
|
|
|
|
nsec_units, false);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Tsac: %s", pbuf);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Nsac: %d clk", card->nsac);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"R2W: *%d", card->r2w_factor);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"IRmax: %d..%d mA",
|
|
|
|
|
i_vmin[card_extract_bits(card->csd, 66, 3)],
|
|
|
|
|
i_vmax[card_extract_bits(card->csd, 69, 3)]);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"IWmax: %d..%d mA",
|
|
|
|
|
i_vmin[card_extract_bits(card->csd, 72, 3)],
|
|
|
|
|
i_vmax[card_extract_bits(card->csd, 75, 3)]);
|
2004-10-06 20:43:12 +00:00
|
|
|
|
}
|
2007-07-25 06:15:07 +00:00
|
|
|
|
else if (card->initialized == 0)
|
2004-10-06 20:43:12 +00:00
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Not Found!");
|
2007-07-12 09:58:54 +00:00
|
|
|
|
}
|
2007-07-25 06:15:07 +00:00
|
|
|
|
#ifndef HAVE_MMC
|
|
|
|
|
else /* card->initialized < 0 */
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Init Error! (%d)", card->initialized);
|
2007-07-25 06:15:07 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2007-10-20 12:32:55 +00:00
|
|
|
|
snprintf(title, 16, "[" CARDTYPE " %d]", *cardnum);
|
|
|
|
|
gui_synclist_set_title(lists, title, Icon_NOICON);
|
|
|
|
|
gui_synclist_set_nb_items(lists, simplelist_get_line_count());
|
|
|
|
|
gui_synclist_select_item(lists, 0);
|
2007-07-14 15:08:46 +00:00
|
|
|
|
btn = ACTION_REDRAW;
|
2004-10-06 20:43:12 +00:00
|
|
|
|
}
|
2007-07-12 09:58:54 +00:00
|
|
|
|
return btn;
|
|
|
|
|
}
|
2007-06-30 02:08:27 +00:00
|
|
|
|
#else /* !defined(HAVE_MMC) && !defined(HAVE_HOTSWAP) */
|
2007-10-20 12:32:55 +00:00
|
|
|
|
static int disk_callback(int btn, struct gui_synclist *lists)
|
2002-12-03 13:12:55 +00:00
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
(void)lists;
|
2002-12-03 13:12:55 +00:00
|
|
|
|
int i;
|
2007-07-12 09:58:54 +00:00
|
|
|
|
char buf[128];
|
2002-12-03 13:12:55 +00:00
|
|
|
|
unsigned short* identify_info = ata_get_identify();
|
2004-02-16 12:04:55 +00:00
|
|
|
|
bool timing_info_present = false;
|
2007-07-15 18:25:39 +00:00
|
|
|
|
(void)btn;
|
|
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_set_line_count(0);
|
2007-07-15 18:25:39 +00:00
|
|
|
|
|
2007-07-12 09:58:54 +00:00
|
|
|
|
for (i=0; i < 20; i++)
|
|
|
|
|
((unsigned short*)buf)[i]=htobe16(identify_info[i+27]);
|
|
|
|
|
buf[40]=0;
|
|
|
|
|
/* kill trailing space */
|
|
|
|
|
for (i=39; i && buf[i]==' '; i--)
|
|
|
|
|
buf[i] = 0;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Model: %s", buf);
|
2007-07-12 09:58:54 +00:00
|
|
|
|
for (i=0; i < 4; i++)
|
|
|
|
|
((unsigned short*)buf)[i]=htobe16(identify_info[i+23]);
|
|
|
|
|
buf[8]=0;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-14 12:32:37 +00:00
|
|
|
|
"Firmware: %s", buf);
|
2007-07-12 09:58:54 +00:00
|
|
|
|
snprintf(buf, sizeof buf, "%ld MB",
|
|
|
|
|
((unsigned long)identify_info[61] << 16 |
|
|
|
|
|
(unsigned long)identify_info[60]) / 2048 );
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Size: %s", buf);
|
|
|
|
|
unsigned long free;
|
|
|
|
|
fat_size( IF_MV2(0,) NULL, &free );
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Free: %ld MB", free / 1024);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Spinup time: %d ms", ata_spinup_time * (1000/HZ));
|
|
|
|
|
i = identify_info[83] & (1<<3);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Power mgmt: %s", i ? "enabled" : "unsupported");
|
|
|
|
|
i = identify_info[83] & (1<<9);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Noise mgmt: %s", i ? "enabled" : "unsupported");
|
|
|
|
|
i = identify_info[82] & (1<<6);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Read-ahead: %s", i ? "enabled" : "unsupported");
|
|
|
|
|
timing_info_present = identify_info[53] & (1<<1);
|
|
|
|
|
if(timing_info_present) {
|
|
|
|
|
char pio3[2], pio4[2];pio3[1] = 0;
|
|
|
|
|
pio4[1] = 0;
|
|
|
|
|
pio3[0] = (identify_info[64] & (1<<0)) ? '3' : 0;
|
|
|
|
|
pio4[0] = (identify_info[64] & (1<<1)) ? '4' : 0;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"PIO modes: 0 1 2 %s %s", pio3, pio4);
|
2002-12-03 13:12:55 +00:00
|
|
|
|
}
|
2007-07-12 09:58:54 +00:00
|
|
|
|
else {
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"No PIO mode info");
|
|
|
|
|
}
|
|
|
|
|
timing_info_present = identify_info[53] & (1<<1);
|
|
|
|
|
if(timing_info_present) {
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Cycle times %dns/%dns",
|
|
|
|
|
identify_info[67],
|
|
|
|
|
identify_info[68] );
|
|
|
|
|
} else {
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"No timing info");
|
|
|
|
|
}
|
|
|
|
|
timing_info_present = identify_info[53] & (1<<1);
|
|
|
|
|
if(timing_info_present) {
|
|
|
|
|
i = identify_info[49] & (1<<11);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"IORDY support: %s", i ? "yes" : "no");
|
|
|
|
|
i = identify_info[49] & (1<<10);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"IORDY disable: %s", i ? "yes" : "no");
|
|
|
|
|
} else {
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"No timing info");
|
|
|
|
|
}
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
|
"Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
|
|
|
|
|
return btn;
|
|
|
|
|
}
|
2007-10-20 12:32:55 +00:00
|
|
|
|
#endif /* !defined(HAVE_MMC) && !defined(HAVE_HOTSWAP) */
|
2007-07-12 09:58:54 +00:00
|
|
|
|
static bool dbg_disk_info(void)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
struct simplelist_info info;
|
2007-10-21 06:42:52 +00:00
|
|
|
|
simplelist_info_init(&info, "Disk Info", 1, NULL);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
#if defined(HAVE_MMC) || defined(HAVE_HOTSWAP)
|
|
|
|
|
char title[16];
|
|
|
|
|
int card = 0;
|
|
|
|
|
info.callback_data = (void*)&card;
|
|
|
|
|
info.title = title;
|
|
|
|
|
#endif
|
2007-07-15 18:25:39 +00:00
|
|
|
|
info.action_callback = disk_callback;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
info.hide_selection = true;
|
|
|
|
|
return simplelist_show_list(&info);
|
2002-12-03 13:12:55 +00:00
|
|
|
|
}
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif /* !SIMULATOR */
|
2002-12-03 13:12:55 +00:00
|
|
|
|
|
2005-11-26 20:22:19 +00:00
|
|
|
|
#ifdef HAVE_DIRCACHE
|
2007-10-20 12:32:55 +00:00
|
|
|
|
static int dircache_callback(int btn, struct gui_synclist *lists)
|
2007-07-11 13:27:15 +00:00
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
(void)btn; (void)lists;
|
|
|
|
|
simplelist_set_line_count(0);
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Cache initialized: %s",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
dircache_is_enabled() ? "Yes" : "No");
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Cache size: %d B",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
dircache_get_cache_size());
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Last size: %d B",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
global_status.dircache_size);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Limit: %d B",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
DIRCACHE_LIMIT);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Reserve: %d/%d B",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
dircache_get_reserve_used(), DIRCACHE_RESERVE);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Scanning took: %d s",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
dircache_get_build_ticks() / HZ);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Entry count: %d",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
dircache_get_entry_count());
|
|
|
|
|
return btn;
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-26 20:22:19 +00:00
|
|
|
|
static bool dbg_dircache_info(void)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
struct simplelist_info info;
|
2007-10-21 06:42:52 +00:00
|
|
|
|
simplelist_info_init(&info, "Dircache Info", 7, NULL);
|
2007-07-15 18:25:39 +00:00
|
|
|
|
info.action_callback = dircache_callback;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
info.hide_selection = true;
|
|
|
|
|
return simplelist_show_list(&info);
|
2005-11-26 20:22:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* HAVE_DIRCACHE */
|
|
|
|
|
|
2006-10-25 10:17:57 +00:00
|
|
|
|
#ifdef HAVE_TAGCACHE
|
2007-10-20 12:32:55 +00:00
|
|
|
|
static int database_callback(int btn, struct gui_synclist *lists)
|
2007-07-11 13:27:15 +00:00
|
|
|
|
{
|
2007-10-21 11:06:30 +00:00
|
|
|
|
(void)lists;
|
2007-07-11 13:27:15 +00:00
|
|
|
|
struct tagcache_stat *stat = tagcache_get_stat();
|
2007-10-21 11:06:30 +00:00
|
|
|
|
static bool synced = false;
|
|
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_set_line_count(0);
|
2007-10-21 11:06:30 +00:00
|
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Initialized: %s",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
stat->initialized ? "Yes" : "No");
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "DB Ready: %s",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
stat->ready ? "Yes" : "No");
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "RAM Cache: %s",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
stat->ramcache ? "Yes" : "No");
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "RAM: %d/%d B",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
stat->ramcache_used, stat->ramcache_allocated);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Progress: %d%% (%d entries)",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
stat->progress, stat->processed_entries);
|
2007-10-21 11:06:30 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Curfile: %s",
|
|
|
|
|
stat->curentry ? stat->curentry : "---");
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Commit step: %d",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
stat->commit_step);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Commit delayed: %s",
|
2007-07-11 13:27:15 +00:00
|
|
|
|
stat->commit_delayed ? "Yes" : "No");
|
2007-10-21 11:06:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (synced)
|
|
|
|
|
{
|
|
|
|
|
synced = false;
|
|
|
|
|
tagcache_screensync_event();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!btn && stat->curentry)
|
|
|
|
|
{
|
|
|
|
|
synced = true;
|
|
|
|
|
return ACTION_REDRAW;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (btn == ACTION_STD_CANCEL)
|
|
|
|
|
tagcache_screensync_enable(false);
|
|
|
|
|
|
2007-07-11 13:27:15 +00:00
|
|
|
|
return btn;
|
|
|
|
|
}
|
2006-03-26 11:33:42 +00:00
|
|
|
|
static bool dbg_tagcache_info(void)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
struct simplelist_info info;
|
2007-10-21 11:06:30 +00:00
|
|
|
|
simplelist_info_init(&info, "Database Info", 8, NULL);
|
2007-07-15 18:25:39 +00:00
|
|
|
|
info.action_callback = database_callback;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
info.hide_selection = true;
|
2007-10-21 13:47:43 +00:00
|
|
|
|
info.timeout = TIMEOUT_NOBLOCK;
|
2007-10-21 11:06:30 +00:00
|
|
|
|
tagcache_screensync_enable(true);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
return simplelist_show_list(&info);
|
2006-03-26 11:33:42 +00:00
|
|
|
|
}
|
2006-03-26 17:09:32 +00:00
|
|
|
|
#endif
|
2006-03-26 11:33:42 +00:00
|
|
|
|
|
2005-02-02 21:57:40 +00:00
|
|
|
|
#if CONFIG_CPU == SH7034
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_save_roms(void)
|
2003-05-17 21:24:13 +00:00
|
|
|
|
{
|
|
|
|
|
int fd;
|
2004-08-30 19:52:45 +00:00
|
|
|
|
int oldmode = system_memory_guard(MEMGUARD_NONE);
|
2003-05-17 21:24:13 +00:00
|
|
|
|
|
2007-02-01 23:08:15 +00:00
|
|
|
|
fd = creat("/internal_rom_0000-FFFF.bin");
|
2003-05-17 21:24:13 +00:00
|
|
|
|
if(fd >= 0)
|
|
|
|
|
{
|
|
|
|
|
write(fd, (void *)0, 0x10000);
|
|
|
|
|
close(fd);
|
|
|
|
|
}
|
2005-06-22 22:38:52 +00:00
|
|
|
|
|
2007-02-01 23:08:15 +00:00
|
|
|
|
fd = creat("/internal_rom_2000000-203FFFF.bin");
|
2003-05-17 21:24:13 +00:00
|
|
|
|
if(fd >= 0)
|
|
|
|
|
{
|
|
|
|
|
write(fd, (void *)0x2000000, 0x40000);
|
|
|
|
|
close(fd);
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-30 19:52:45 +00:00
|
|
|
|
system_memory_guard(oldmode);
|
2003-05-17 21:24:13 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#elif defined CPU_COLDFIRE
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_save_roms(void)
|
2005-10-10 19:43:07 +00:00
|
|
|
|
{
|
|
|
|
|
int fd;
|
|
|
|
|
int oldmode = system_memory_guard(MEMGUARD_NONE);
|
|
|
|
|
|
|
|
|
|
#if defined(IRIVER_H100_SERIES)
|
2007-02-01 23:08:15 +00:00
|
|
|
|
fd = creat("/internal_rom_000000-1FFFFF.bin");
|
2005-11-09 01:26:33 +00:00
|
|
|
|
#elif defined(IRIVER_H300_SERIES)
|
2007-02-01 23:08:15 +00:00
|
|
|
|
fd = creat("/internal_rom_000000-3FFFFF.bin");
|
2007-03-05 00:04:00 +00:00
|
|
|
|
#elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
|
2007-02-01 23:08:15 +00:00
|
|
|
|
fd = creat("/internal_rom_000000-3FFFFF.bin");
|
2005-11-09 01:26:33 +00:00
|
|
|
|
#endif
|
2005-10-10 19:43:07 +00:00
|
|
|
|
if(fd >= 0)
|
|
|
|
|
{
|
2005-11-09 01:26:33 +00:00
|
|
|
|
write(fd, (void *)0, FLASH_SIZE);
|
2005-10-10 19:43:07 +00:00
|
|
|
|
close(fd);
|
|
|
|
|
}
|
|
|
|
|
system_memory_guard(oldmode);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-08-05 20:19:10 +00:00
|
|
|
|
#ifdef HAVE_EEPROM
|
2007-02-01 23:08:15 +00:00
|
|
|
|
fd = creat("/internal_eeprom.bin");
|
2006-08-05 20:19:10 +00:00
|
|
|
|
if (fd >= 0)
|
|
|
|
|
{
|
2006-08-15 22:54:06 +00:00
|
|
|
|
int old_irq_level;
|
2006-08-05 20:19:10 +00:00
|
|
|
|
char buf[EEPROM_SIZE];
|
2006-08-15 22:54:06 +00:00
|
|
|
|
int err;
|
|
|
|
|
|
|
|
|
|
old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
|
|
|
|
|
|
|
|
|
|
err = eeprom_24cxx_read(0, buf, sizeof buf);
|
|
|
|
|
if (err)
|
2007-03-16 21:56:08 +00:00
|
|
|
|
gui_syncsplash(HZ*3, "Eeprom read failure (%d)",err);
|
2006-08-05 20:19:10 +00:00
|
|
|
|
else
|
2006-08-15 22:54:06 +00:00
|
|
|
|
{
|
2006-08-05 20:19:10 +00:00
|
|
|
|
write(fd, buf, sizeof buf);
|
2006-08-15 22:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_irq_level(old_irq_level);
|
|
|
|
|
|
2006-08-05 20:19:10 +00:00
|
|
|
|
close(fd);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2005-10-10 19:43:07 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2007-09-06 03:28:58 +00:00
|
|
|
|
#elif defined(CPU_PP) && !(defined(SANSA_E200) || defined(SANSA_C200))
|
2007-02-23 23:22:03 +00:00
|
|
|
|
static bool dbg_save_roms(void)
|
|
|
|
|
{
|
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
|
|
fd = creat("/internal_rom_000000-0FFFFF.bin");
|
|
|
|
|
if(fd >= 0)
|
|
|
|
|
{
|
|
|
|
|
write(fd, (void *)0x20000000, FLASH_SIZE);
|
|
|
|
|
close(fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* CPU */
|
2003-05-17 21:24:13 +00:00
|
|
|
|
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2007-02-18 02:04:47 +00:00
|
|
|
|
#if CONFIG_TUNER
|
2007-10-20 12:32:55 +00:00
|
|
|
|
static int radio_callback(int btn, struct gui_synclist *lists)
|
2004-02-04 09:53:22 +00:00
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
(void)lists;
|
|
|
|
|
if (btn == ACTION_STD_CANCEL)
|
|
|
|
|
return btn;
|
|
|
|
|
simplelist_set_line_count(1);
|
2007-07-14 22:00:50 +00:00
|
|
|
|
|
2007-06-06 19:23:48 +00:00
|
|
|
|
#if (CONFIG_TUNER & LV24020LP)
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
|
"CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT) );
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
|
"RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT) );
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
|
"MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM) );
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
|
"MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF) );
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
|
"MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD) );
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
|
"if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET) );
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
|
"sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET) );
|
2007-06-06 19:23:48 +00:00
|
|
|
|
#endif
|
2006-08-11 17:39:34 +00:00
|
|
|
|
#if (CONFIG_TUNER & S1A0903X01)
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
|
"Samsung regs: %08X", s1a0903x01_get(RADIO_ALL));
|
2007-07-15 18:25:39 +00:00
|
|
|
|
/* This one doesn't return dynamic data atm */
|
2006-08-11 17:39:34 +00:00
|
|
|
|
#endif
|
|
|
|
|
#if (CONFIG_TUNER & TEA5767)
|
2007-07-15 18:25:39 +00:00
|
|
|
|
struct tea5767_dbg_info nfo;
|
|
|
|
|
tea5767_dbg_info(&nfo);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Philips regs:");
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-15 18:25:39 +00:00
|
|
|
|
" Read: %02X %02X %02X %02X %02X",
|
|
|
|
|
(unsigned)nfo.read_regs[0], (unsigned)nfo.read_regs[1],
|
|
|
|
|
(unsigned)nfo.read_regs[2], (unsigned)nfo.read_regs[3],
|
|
|
|
|
(unsigned)nfo.read_regs[4]);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-15 18:25:39 +00:00
|
|
|
|
" Write: %02X %02X %02X %02X %02X",
|
|
|
|
|
(unsigned)nfo.write_regs[0], (unsigned)nfo.write_regs[1],
|
|
|
|
|
(unsigned)nfo.write_regs[2], (unsigned)nfo.write_regs[3],
|
|
|
|
|
(unsigned)nfo.write_regs[4]);
|
2006-08-11 17:39:34 +00:00
|
|
|
|
#endif
|
2007-10-20 12:32:55 +00:00
|
|
|
|
return ACTION_REDRAW;
|
2007-07-11 13:27:15 +00:00
|
|
|
|
}
|
|
|
|
|
static bool dbg_fm_radio(void)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
struct simplelist_info info;
|
2007-10-21 06:42:52 +00:00
|
|
|
|
simplelist_info_init(&info, "FM Radio", 1, NULL);
|
2007-10-20 12:32:55 +00:00
|
|
|
|
simplelist_set_line_count(0);
|
2007-10-21 01:27:17 +00:00
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "HW detected: %s",
|
|
|
|
|
radio_hardware_present() ? "yes" : "no");
|
2007-07-15 18:25:39 +00:00
|
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
|
info.action_callback = radio_hardware_present()?radio_callback : NULL;
|
|
|
|
|
info.hide_selection = true;
|
|
|
|
|
return simplelist_show_list(&info);
|
2004-02-04 09:53:22 +00:00
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* CONFIG_TUNER */
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif /* !SIMULATOR */
|
2004-02-04 09:53:22 +00:00
|
|
|
|
|
2004-06-30 13:31:14 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
extern bool do_screendump_instead_of_usb;
|
|
|
|
|
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_screendump(void)
|
2004-06-30 13:31:14 +00:00
|
|
|
|
{
|
|
|
|
|
do_screendump_instead_of_usb = !do_screendump_instead_of_usb;
|
2007-03-16 21:56:08 +00:00
|
|
|
|
gui_syncsplash(HZ, "Screendump %s",
|
2004-06-30 13:31:14 +00:00
|
|
|
|
do_screendump_instead_of_usb?"enabled":"disabled");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2004-06-30 13:31:14 +00:00
|
|
|
|
|
2005-10-08 20:09:07 +00:00
|
|
|
|
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_set_memory_guard(void)
|
2004-08-30 19:52:45 +00:00
|
|
|
|
{
|
|
|
|
|
static const struct opt_items names[MAXMEMGUARD] = {
|
|
|
|
|
{ "None", -1 },
|
|
|
|
|
{ "Flash ROM writes", -1 },
|
|
|
|
|
{ "Zero area (all)", -1 }
|
|
|
|
|
};
|
|
|
|
|
int mode = system_memory_guard(MEMGUARD_KEEP);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2004-08-30 19:52:45 +00:00
|
|
|
|
set_option( "Catch mem accesses", &mode, INT, names, MAXMEMGUARD, NULL);
|
|
|
|
|
system_memory_guard(mode);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-10-08 20:09:07 +00:00
|
|
|
|
#endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
|
2004-08-30 19:52:45 +00:00
|
|
|
|
|
2007-01-04 12:13:56 +00:00
|
|
|
|
#if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
|
2007-01-04 11:44:32 +00:00
|
|
|
|
|
|
|
|
|
extern volatile bool lcd_poweroff;
|
|
|
|
|
|
|
|
|
|
static bool dbg_lcd_power_off(void)
|
|
|
|
|
{
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
2007-02-27 11:09:09 +00:00
|
|
|
|
int button;
|
2007-01-04 11:44:32 +00:00
|
|
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_puts(0, 0, "LCD Power Off");
|
2007-02-27 11:09:09 +00:00
|
|
|
|
if(lcd_poweroff)
|
|
|
|
|
lcd_puts(1, 1, "Yes");
|
|
|
|
|
else
|
|
|
|
|
lcd_puts(1, 1, "No");
|
2007-01-04 11:44:32 +00:00
|
|
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
|
|
|
|
|
|
button = get_action(CONTEXT_STD,HZ/5);
|
|
|
|
|
switch(button)
|
|
|
|
|
{
|
|
|
|
|
case ACTION_STD_PREV:
|
|
|
|
|
case ACTION_STD_NEXT:
|
|
|
|
|
lcd_poweroff = !lcd_poweroff;
|
|
|
|
|
break;
|
2007-02-27 11:09:09 +00:00
|
|
|
|
case ACTION_STD_OK:
|
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
|
return false;
|
|
|
|
|
default:
|
2007-01-04 11:44:32 +00:00
|
|
|
|
sleep(HZ/10);
|
2007-02-27 11:09:09 +00:00
|
|
|
|
break;
|
2007-01-04 11:44:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-08-15 22:54:06 +00:00
|
|
|
|
#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
|
2006-12-12 22:22:21 +00:00
|
|
|
|
static bool dbg_write_eeprom(void)
|
2006-08-15 22:54:06 +00:00
|
|
|
|
{
|
|
|
|
|
int fd;
|
|
|
|
|
int rc;
|
|
|
|
|
int old_irq_level;
|
|
|
|
|
char buf[EEPROM_SIZE];
|
|
|
|
|
int err;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
|
2006-08-15 22:54:06 +00:00
|
|
|
|
fd = open("/internal_eeprom.bin", O_RDONLY);
|
|
|
|
|
|
|
|
|
|
if (fd >= 0)
|
|
|
|
|
{
|
|
|
|
|
rc = read(fd, buf, EEPROM_SIZE);
|
|
|
|
|
|
|
|
|
|
if(rc == EEPROM_SIZE)
|
|
|
|
|
{
|
|
|
|
|
old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
|
|
|
|
|
|
|
|
|
|
err = eeprom_24cxx_write(0, buf, sizeof buf);
|
|
|
|
|
if (err)
|
2007-03-16 21:56:08 +00:00
|
|
|
|
gui_syncsplash(HZ*3, "Eeprom write failure (%d)",err);
|
2006-08-16 18:56:08 +00:00
|
|
|
|
else
|
2007-03-16 21:56:08 +00:00
|
|
|
|
gui_syncsplash(HZ*3, "Eeprom written successfully");
|
2006-08-15 22:54:06 +00:00
|
|
|
|
|
|
|
|
|
set_irq_level(old_irq_level);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-03-16 21:56:08 +00:00
|
|
|
|
gui_syncsplash(HZ*3, "File read error (%d)",rc);
|
2006-08-15 22:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
close(fd);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-03-16 21:56:08 +00:00
|
|
|
|
gui_syncsplash(HZ*3, "Failed to open 'internal_eeprom.bin'");
|
2006-08-15 22:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
|
2007-01-22 10:41:25 +00:00
|
|
|
|
#ifdef CPU_BOOST_LOGGING
|
|
|
|
|
static bool cpu_boost_log(void)
|
|
|
|
|
{
|
|
|
|
|
int i = 0,j=0;
|
|
|
|
|
int count = cpu_boost_log_getcount();
|
|
|
|
|
int lines = LCD_HEIGHT/SYSFONT_HEIGHT;
|
|
|
|
|
char *str;
|
|
|
|
|
bool done;
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
str = cpu_boost_log_getlog_first();
|
|
|
|
|
while (i < count)
|
|
|
|
|
{
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
for(j=0; j<lines; j++,i++)
|
|
|
|
|
{
|
|
|
|
|
if (!str)
|
|
|
|
|
str = cpu_boost_log_getlog_next();
|
|
|
|
|
if (str)
|
|
|
|
|
{
|
|
|
|
|
lcd_puts(0, j,str);
|
|
|
|
|
}
|
|
|
|
|
str = NULL;
|
|
|
|
|
}
|
|
|
|
|
lcd_update();
|
|
|
|
|
done = false;
|
|
|
|
|
while (!done)
|
|
|
|
|
{
|
|
|
|
|
switch(get_action(CONTEXT_STD,TIMEOUT_BLOCK))
|
|
|
|
|
{
|
|
|
|
|
case ACTION_STD_OK:
|
|
|
|
|
case ACTION_STD_PREV:
|
|
|
|
|
case ACTION_STD_NEXT:
|
|
|
|
|
done = true;
|
|
|
|
|
break;
|
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
|
i = count;
|
|
|
|
|
done = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
get_action(CONTEXT_STD,TIMEOUT_BLOCK);
|
|
|
|
|
lcd_setfont(FONT_UI);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2002-07-15 11:23:24 +00:00
|
|
|
|
|
2007-04-29 15:31:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****** The menu *********/
|
|
|
|
|
struct the_menu_item {
|
|
|
|
|
unsigned char *desc; /* string or ID */
|
|
|
|
|
bool (*function) (void); /* return true if USB was connected */
|
|
|
|
|
};
|
|
|
|
|
static const struct the_menu_item menuitems[] = {
|
2007-01-04 12:13:56 +00:00
|
|
|
|
#if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
|
2007-01-04 11:44:32 +00:00
|
|
|
|
{ "LCD Power Off", dbg_lcd_power_off },
|
|
|
|
|
#endif
|
2007-02-23 23:22:03 +00:00
|
|
|
|
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
|
2007-09-06 03:28:58 +00:00
|
|
|
|
(defined(CPU_PP) && !(defined(SANSA_E200) || defined(SANSA_C200)))
|
2005-10-10 19:43:07 +00:00
|
|
|
|
{ "Dump ROM contents", dbg_save_roms },
|
2006-01-31 01:50:10 +00:00
|
|
|
|
#endif
|
2007-04-21 04:48:20 +00:00
|
|
|
|
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) || CONFIG_CPU == S3C2440
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ "View I/O ports", dbg_ports },
|
2005-02-11 13:16:09 +00:00
|
|
|
|
#endif
|
2005-03-07 10:51:43 +00:00
|
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
|
|
|
|
{ "CPU frequency", dbg_cpufreq },
|
2005-03-18 12:47:06 +00:00
|
|
|
|
#endif
|
2005-07-11 12:09:01 +00:00
|
|
|
|
#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
|
2005-07-18 18:28:49 +00:00
|
|
|
|
{ "S/PDIF analyzer", dbg_spdif },
|
2005-06-19 03:05:53 +00:00
|
|
|
|
#endif
|
2005-10-08 20:09:07 +00:00
|
|
|
|
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
|
2004-08-30 19:52:45 +00:00
|
|
|
|
{ "Catch mem accesses", dbg_set_memory_guard },
|
2005-10-08 20:09:07 +00:00
|
|
|
|
#endif
|
2005-02-02 21:57:40 +00:00
|
|
|
|
{ "View OS stacks", dbg_os },
|
2002-08-08 20:44:25 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ "View battery", view_battery },
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ "Screendump", dbg_screendump },
|
2002-07-22 16:39:17 +00:00
|
|
|
|
#endif
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ "View HW info", dbg_hw_info },
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifndef SIMULATOR
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ "View partitions", dbg_partitions },
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifndef SIMULATOR
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ "View disk info", dbg_disk_info },
|
2004-09-28 06:23:57 +00:00
|
|
|
|
#endif
|
2005-11-26 20:22:19 +00:00
|
|
|
|
#ifdef HAVE_DIRCACHE
|
|
|
|
|
{ "View dircache info", dbg_dircache_info },
|
|
|
|
|
#endif
|
2006-10-25 10:17:57 +00:00
|
|
|
|
#ifdef HAVE_TAGCACHE
|
2007-01-11 09:18:05 +00:00
|
|
|
|
{ "View database info", dbg_tagcache_info },
|
2006-10-25 10:17:57 +00:00
|
|
|
|
#endif
|
2007-07-11 13:27:15 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC || !defined(SIMULATOR)
|
2005-04-04 12:06:29 +00:00
|
|
|
|
{ "View audio thread", dbg_audio_thread },
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
2002-10-29 12:09:15 +00:00
|
|
|
|
#ifdef PM_DEBUG
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ "pm histogram", peak_meter_histogram},
|
2002-10-29 12:09:15 +00:00
|
|
|
|
#endif /* PM_DEBUG */
|
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2007-02-18 02:04:47 +00:00
|
|
|
|
#if CONFIG_TUNER
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ "FM Radio", dbg_fm_radio },
|
2005-05-30 13:00:43 +00:00
|
|
|
|
#endif
|
2006-10-04 07:29:50 +00:00
|
|
|
|
#endif
|
2006-08-15 22:54:06 +00:00
|
|
|
|
#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
|
|
|
|
|
{ "Write back EEPROM", dbg_write_eeprom },
|
|
|
|
|
#endif
|
2005-05-30 13:00:43 +00:00
|
|
|
|
#ifdef ROCKBOX_HAS_LOGF
|
|
|
|
|
{"logf", logfdisplay },
|
2005-06-01 13:07:37 +00:00
|
|
|
|
{"logfdump", logfdump },
|
2007-01-22 10:41:25 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef CPU_BOOST_LOGGING
|
|
|
|
|
{"cpu_boost log",cpu_boost_log},
|
2004-02-04 09:53:22 +00:00
|
|
|
|
#endif
|
2002-07-15 11:23:24 +00:00
|
|
|
|
};
|
2007-10-20 12:32:55 +00:00
|
|
|
|
static int menu_action_callback(int btn, struct gui_synclist *lists)
|
2007-04-29 15:31:43 +00:00
|
|
|
|
{
|
|
|
|
|
if (btn == ACTION_STD_OK)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
menuitems[gui_synclist_get_sel_pos(lists)].function();
|
|
|
|
|
btn = ACTION_REDRAW;
|
2007-04-29 15:31:43 +00:00
|
|
|
|
}
|
|
|
|
|
return btn;
|
|
|
|
|
}
|
2007-04-29 23:26:26 +00:00
|
|
|
|
static char* dbg_menu_getname(int item, void * data, char *buffer)
|
2007-04-29 15:31:43 +00:00
|
|
|
|
{
|
|
|
|
|
(void)data; (void)buffer;
|
|
|
|
|
return menuitems[item].desc;
|
|
|
|
|
}
|
|
|
|
|
bool debug_menu(void)
|
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
|
struct simplelist_info info;
|
2007-10-21 11:06:30 +00:00
|
|
|
|
|
|
|
|
|
simplelist_info_init(&info, "Debug Menu", ARRAYLEN(menuitems), NULL);
|
2007-07-15 18:25:39 +00:00
|
|
|
|
info.action_callback = menu_action_callback;
|
2007-10-20 12:32:55 +00:00
|
|
|
|
info.get_name = dbg_menu_getname;
|
2007-10-21 11:06:30 +00:00
|
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
|
return simplelist_show_list(&info);
|
2002-07-15 11:23:24 +00:00
|
|
|
|
}
|