2002-07-15 11:23:24 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Heikki Hannikainen
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-07-15 11:23:24 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "config.h"
|
2008-05-25 01:38:08 +00:00
|
|
|
#include <stdlib.h>
|
2002-07-15 11:23:24 +00:00
|
|
|
#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"
|
2011-11-15 13:22:02 +00:00
|
|
|
#include "lang.h"
|
2002-07-15 11:23:24 +00:00
|
|
|
#include "menu.h"
|
|
|
|
#include "debug_menu.h"
|
|
|
|
#include "kernel.h"
|
2008-03-01 10:47:21 +00:00
|
|
|
#include "structec.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"
|
2011-11-15 13:22:02 +00:00
|
|
|
#include "shortcuts.h"
|
2006-03-26 11:33:42 +00:00
|
|
|
#include "dircache.h"
|
2008-12-31 05:59:26 +00:00
|
|
|
#include "viewport.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
|
2012-01-07 19:35:46 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2006-02-17 22:38:38 +00:00
|
|
|
#include "lcd-remote.h"
|
2012-01-07 19:35:46 +00:00
|
|
|
#endif
|
2006-05-07 22:19:29 +00:00
|
|
|
#include "crc32.h"
|
2006-08-05 20:19:10 +00:00
|
|
|
#include "logf.h"
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2006-10-04 07:29:50 +00:00
|
|
|
#include "disk.h"
|
|
|
|
#include "adc.h"
|
|
|
|
#include "usb.h"
|
|
|
|
#include "rtc.h"
|
2008-11-01 16:14:28 +00:00
|
|
|
#include "storage.h"
|
2006-10-04 07:29:50 +00:00
|
|
|
#include "fat.h"
|
|
|
|
#include "eeprom_24cxx.h"
|
2008-10-31 21:25:04 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
|
2010-06-05 21:12:16 +00:00
|
|
|
#include "sdmmc.h"
|
2002-10-15 08:08:35 +00:00
|
|
|
#endif
|
2008-11-01 16:14:28 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_ATA)
|
|
|
|
#include "ata.h"
|
|
|
|
#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
|
2011-12-31 13:34:56 +00:00
|
|
|
#include "power.h"
|
2006-10-04 07:29:50 +00:00
|
|
|
|
2012-04-07 08:30:23 +00:00
|
|
|
#if defined(SAMSUNG_YPR0) && defined(CONFIG_TUNER)
|
|
|
|
#include "tuner.h"
|
|
|
|
#include "radio.h"
|
|
|
|
#endif
|
|
|
|
|
2006-10-04 07:29:50 +00:00
|
|
|
#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"
|
2011-08-30 14:01:33 +00:00
|
|
|
#include "core_alloc.h"
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2005-07-13 13:13:10 +00:00
|
|
|
#include "pcmbuf.h"
|
2007-10-25 21:27:45 +00:00
|
|
|
#include "buffering.h"
|
2008-03-28 11:24:24 +00:00
|
|
|
#include "playback.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"
|
2008-02-10 05:39:20 +00:00
|
|
|
#include "button.h"
|
|
|
|
#if CONFIG_RTC == RTC_PCF50605
|
|
|
|
#include "pcf50605.h"
|
|
|
|
#endif
|
2009-08-16 22:20:11 +00:00
|
|
|
#include "appevents.h"
|
2007-11-10 22:12:54 +00:00
|
|
|
|
2012-01-08 01:43:16 +00:00
|
|
|
#if defined(HAVE_AS3514) && defined(CONFIG_CHARGING)
|
2008-10-31 00:16:42 +00:00
|
|
|
#include "ascodec.h"
|
2008-03-04 14:36:22 +00:00
|
|
|
#endif
|
2008-03-04 14:31:14 +00:00
|
|
|
|
2009-10-10 22:02:23 +00:00
|
|
|
#ifdef IPOD_NANO2G
|
|
|
|
#include "pmu-target.h"
|
|
|
|
#endif
|
|
|
|
|
2009-10-29 20:12:28 +00:00
|
|
|
#ifdef HAVE_USBSTACK
|
|
|
|
#include "usb_core.h"
|
2009-07-18 13:27:41 +00:00
|
|
|
#endif
|
|
|
|
|
2010-09-20 19:37:17 +00:00
|
|
|
#if defined(IPOD_ACCESSORY_PROTOCOL)
|
|
|
|
#include "iap.h"
|
|
|
|
#endif
|
|
|
|
|
2012-02-16 19:49:06 +00:00
|
|
|
#ifdef HAVE_RDS_CAP
|
|
|
|
#include "rds.h"
|
|
|
|
#endif
|
|
|
|
|
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 (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
|
|
|
|
2009-08-20 16:47:44 +00:00
|
|
|
static const char* threads_getname(int selected_item, void *data,
|
|
|
|
char *buffer, size_t buffer_len)
|
2007-03-26 12:09:08 +00:00
|
|
|
{
|
|
|
|
(void)data;
|
2007-11-20 03:44:25 +00:00
|
|
|
struct thread_entry *thread;
|
2007-09-28 10:20:02 +00:00
|
|
|
char name[32];
|
|
|
|
|
|
|
|
#if NUM_CORES > 1
|
|
|
|
if (selected_item < (int)NUM_CORES)
|
|
|
|
{
|
2008-04-09 15:25:17 +00:00
|
|
|
snprintf(buffer, buffer_len, "Idle (%d): %2d%%", selected_item,
|
2007-11-20 03:44:25 +00:00
|
|
|
idle_stack_usage(selected_item));
|
2007-09-28 10:20:02 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
selected_item -= NUM_CORES;
|
|
|
|
#endif
|
|
|
|
|
2007-03-26 16:55:17 +00:00
|
|
|
thread = &threads[selected_item];
|
2007-11-20 03:44:25 +00:00
|
|
|
|
|
|
|
if (thread->state == STATE_KILLED)
|
2007-03-26 16:55:17 +00:00
|
|
|
{
|
2008-04-09 15:25:17 +00:00
|
|
|
snprintf(buffer, buffer_len, "%2d: ---", selected_item);
|
2007-03-26 16:55:17 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
2007-09-28 10:20:02 +00:00
|
|
|
|
|
|
|
thread_get_name(name, 32, thread);
|
|
|
|
|
2008-04-09 15:25:17 +00:00
|
|
|
snprintf(buffer, buffer_len,
|
2008-03-25 02:34:12 +00:00
|
|
|
"%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %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-11-20 03:44:25 +00:00
|
|
|
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
2008-03-25 02:34:12 +00:00
|
|
|
(thread->cpu_boost) ? '+' :
|
2007-11-20 03:44:25 +00:00
|
|
|
#endif
|
|
|
|
((thread->state == STATE_RUNNING) ? '*' : ' '),
|
|
|
|
thread_status_char(thread->state),
|
2008-03-25 02:34:12 +00:00
|
|
|
IF_PRIO(thread->base_priority, thread->priority, )
|
2007-11-20 03:44:25 +00:00
|
|
|
thread_stack_usage(thread), name);
|
2007-09-28 10:20:02 +00:00
|
|
|
|
2007-03-26 12:09:08 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
2009-08-20 16:47:44 +00:00
|
|
|
|
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)
|
2009-05-17 13:45:14 +00:00
|
|
|
remove_thread(threads[selpos - NUM_CORES].id);
|
2007-09-28 10:20:02 +00:00
|
|
|
#else
|
2009-07-18 13:23:15 +00:00
|
|
|
remove_thread(threads[selpos].id);
|
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 */
|
2008-02-28 16:48:18 +00:00
|
|
|
if (action == ACTION_NONE)
|
|
|
|
action = ACTION_REDRAW;
|
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;
|
2008-05-05 07:11:27 +00:00
|
|
|
info.scroll_all = true;
|
2007-10-20 12:32:55 +00:00
|
|
|
#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
|
|
|
|
2011-12-19 15:42:04 +00:00
|
|
|
#ifdef __linux__
|
|
|
|
#include "cpuinfo-linux.h"
|
|
|
|
|
|
|
|
#define MAX_STATES 16
|
|
|
|
static struct time_state states[MAX_STATES];
|
|
|
|
|
|
|
|
static const char* get_cpuinfo(int selected_item, void *data,
|
|
|
|
char *buffer, size_t buffer_len)
|
|
|
|
{
|
|
|
|
(void)data;(void)buffer_len;
|
|
|
|
const char* text;
|
|
|
|
long time, diff;
|
|
|
|
struct cpuusage us;
|
|
|
|
static struct cpuusage last_us;
|
|
|
|
int state_count = *(int*)data;
|
|
|
|
|
|
|
|
if (cpuusage_linux(&us) != 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
switch(selected_item)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
diff = abs(last_us.usage - us.usage);
|
|
|
|
sprintf(buffer, "Usage: %ld.%02ld%% (%c %ld.%02ld)",
|
|
|
|
us.usage/100, us.usage%100,
|
|
|
|
(us.usage >= last_us.usage) ? '+':'-',
|
|
|
|
diff/100, diff%100);
|
|
|
|
last_us.usage = us.usage;
|
|
|
|
return buffer;
|
|
|
|
case 1:
|
|
|
|
text = "User";
|
|
|
|
time = us.utime;
|
|
|
|
diff = us.utime - last_us.utime;
|
|
|
|
last_us.utime = us.utime;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
text = "Sys";
|
|
|
|
time = us.stime;
|
|
|
|
diff = us.stime - last_us.stime;
|
|
|
|
last_us.stime = us.stime;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
text = "Real";
|
|
|
|
time = us.rtime;
|
|
|
|
diff = us.rtime - last_us.rtime;
|
|
|
|
last_us.rtime = us.rtime;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
return "*** Per CPU freq stats ***";
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
int cpu = (selected_item - 5) / (state_count + 1);
|
|
|
|
int cpu_line = (selected_item - 5) % (state_count + 1);
|
2012-01-04 00:34:02 +00:00
|
|
|
int freq1 = frequency_linux(cpu, false);
|
|
|
|
int freq2 = frequency_linux(cpu, true);
|
2011-12-19 15:42:04 +00:00
|
|
|
if (cpu_line == 0)
|
|
|
|
{
|
|
|
|
sprintf(buffer, " CPU%d: Cur/Scal freq: %d/%d MHz", cpu,
|
|
|
|
freq1 > 0 ? freq1/1000 : -1,
|
|
|
|
freq2 > 0 ? freq2/1000 : -1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpustatetimes_linux(cpu, states, ARRAYLEN(states));
|
|
|
|
snprintf(buffer, buffer_len, " %ld %ld",
|
|
|
|
states[cpu_line-1].frequency,
|
|
|
|
states[cpu_line-1].time);
|
|
|
|
}
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sprintf(buffer, "%s: %ld.%02lds (+ %ld.%02ld)", text,
|
|
|
|
time / us.hz, time % us.hz,
|
|
|
|
diff / us.hz, diff % us.hz);
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cpuinfo_cb(int action, struct gui_synclist *lists)
|
|
|
|
{
|
|
|
|
(void)lists;
|
|
|
|
if (action == ACTION_NONE)
|
|
|
|
action = ACTION_REDRAW;
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool dbg_cpuinfo(void)
|
|
|
|
{
|
|
|
|
struct simplelist_info info;
|
|
|
|
int cpu_count = MAX(cpucount_linux(), 1);
|
|
|
|
int state_count = cpustatetimes_linux(0, states, ARRAYLEN(states));
|
|
|
|
printf("%s(): %d %d\n", __func__, cpu_count, state_count);
|
|
|
|
simplelist_info_init(&info, "CPU info:", 5 + cpu_count*(state_count+1), &state_count);
|
|
|
|
info.get_name = get_cpuinfo;
|
|
|
|
info.action_callback = cpuinfo_cb;
|
|
|
|
info.timeout = HZ;
|
|
|
|
info.hide_selection = true;
|
|
|
|
info.scroll_all = true;
|
|
|
|
return simplelist_show_list(&info);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
struct audio_debug d;
|
2002-10-14 14:13:48 +00:00
|
|
|
|
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();
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 0, "read: %x", d.audiobuf_read);
|
|
|
|
lcd_putsf(0, 1, "write: %x", d.audiobuf_write);
|
|
|
|
lcd_putsf(0, 2, "swap: %x", d.audiobuf_swapwrite);
|
|
|
|
lcd_putsf(0, 3, "playing: %d", d.playing);
|
|
|
|
lcd_putsf(0, 4, "playable: %x", d.playable_space);
|
|
|
|
lcd_putsf(0, 5, "unswapped: %x", d.unswapped_space);
|
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
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 7, "wm: %x - %x",
|
2009-10-17 13:00:58 +00:00
|
|
|
d.low_watermark_level, d.lowest_watermark_level);
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2002-10-14 14:13:48 +00:00
|
|
|
lcd_update();
|
|
|
|
}
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2002-10-14 14:13:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
2006-10-04 07:29:50 +00:00
|
|
|
#endif /* !SIMULATOR */
|
2005-10-10 19:43:07 +00:00
|
|
|
#else /* CONFIG_CODEC == SWCODEC */
|
2011-01-22 18:30:24 +00:00
|
|
|
static unsigned int ticks, freq_sum;
|
|
|
|
#ifndef CPU_MULTI_FREQUENCY
|
|
|
|
static unsigned int boost_ticks;
|
|
|
|
#endif
|
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
|
|
|
{
|
2010-06-21 16:53:00 +00:00
|
|
|
#ifdef CPUFREQ_NORMAL
|
2011-01-22 18:30:24 +00:00
|
|
|
#ifndef CPU_MULTI_FREQUENCY
|
2005-06-22 14:03:04 +00:00
|
|
|
if(FREQ > CPUFREQ_NORMAL)
|
|
|
|
boost_ticks++;
|
2011-01-22 18:30:24 +00:00
|
|
|
#endif
|
2008-04-19 10:43:00 +00:00
|
|
|
freq_sum += FREQ/1000000; /* in MHz */
|
2008-04-19 11:17:06 +00:00
|
|
|
#endif
|
2005-06-22 14:03:04 +00:00
|
|
|
ticks++;
|
|
|
|
}
|
|
|
|
|
2007-10-25 21:27:45 +00:00
|
|
|
static bool dbg_buffering_thread(void)
|
2005-06-22 14:03:04 +00:00
|
|
|
{
|
|
|
|
int button;
|
2011-10-15 19:35:02 +00:00
|
|
|
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();
|
2007-10-25 21:27:45 +00:00
|
|
|
struct buffering_debug d;
|
2009-10-31 19:17:36 +00:00
|
|
|
size_t filebuflen = audio_get_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
|
|
|
|
2011-01-22 18:30:24 +00:00
|
|
|
#ifndef CPU_MULTI_FREQUENCY
|
|
|
|
boost_ticks = 0;
|
|
|
|
#endif
|
|
|
|
ticks = freq_sum = 0;
|
2005-06-22 14:03:04 +00:00
|
|
|
|
|
|
|
tick_add_task(dbg_audio_task);
|
2010-04-25 12:01:25 +00:00
|
|
|
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
screens[i].setfont(FONT_SYSFIXED);
|
|
|
|
|
2005-06-22 14:09:07 +00:00
|
|
|
while(!done)
|
2005-06-22 14:03:04 +00:00
|
|
|
{
|
2008-07-17 18:36:47 +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
|
|
|
}
|
2007-10-25 21:27:45 +00:00
|
|
|
|
|
|
|
buffering_get_debugdata(&d);
|
2010-04-25 12:01:25 +00:00
|
|
|
bufused = bufsize - pcmbuf_free();
|
2007-10-25 21:27:45 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
{
|
|
|
|
line = 0;
|
|
|
|
screens[i].clear_display();
|
2005-06-22 14:03:04 +00:00
|
|
|
|
2006-04-25 20:32:38 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "pcm: %6ld/%ld", (long) bufused, (long) bufsize);
|
2005-06-22 14:03:04 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6,
|
|
|
|
bufsize, 0, bufused, HORIZONTAL);
|
|
|
|
line++;
|
2002-10-14 14:13:48 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "alloc: %6ld/%ld", audio_filebufused(),
|
|
|
|
(long) filebuflen);
|
2005-06-22 14:03:04 +00:00
|
|
|
|
2010-04-25 12:14:28 +00:00
|
|
|
#if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80)
|
2010-04-25 12:01:25 +00:00
|
|
|
if (screens[i].lcdheight > 80)
|
|
|
|
{
|
|
|
|
gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6,
|
|
|
|
filebuflen, 0, audio_filebufused(), HORIZONTAL);
|
|
|
|
line++;
|
2007-10-25 21:27:45 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "real: %6ld/%ld", (long)d.buffered_data,
|
|
|
|
(long)filebuflen);
|
2007-10-25 21:27:45 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6,
|
|
|
|
filebuflen, 0, (long)d.buffered_data, HORIZONTAL);
|
|
|
|
line++;
|
|
|
|
}
|
2007-10-25 21:27:45 +00:00
|
|
|
#endif
|
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "usefl: %6ld/%ld", (long)(d.useful_data),
|
2007-10-25 21:27:45 +00:00
|
|
|
(long)filebuflen);
|
|
|
|
|
2010-04-25 12:14:28 +00:00
|
|
|
#if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80)
|
2010-04-25 12:01:25 +00:00
|
|
|
if (screens[i].lcdheight > 80)
|
|
|
|
{
|
|
|
|
gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6,
|
|
|
|
filebuflen, 0, d.useful_data, HORIZONTAL);
|
|
|
|
line++;
|
|
|
|
}
|
2007-10-25 21:27:45 +00:00
|
|
|
#endif
|
2005-06-22 14:03:04 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "data_rem: %ld", (long)d.data_rem);
|
2007-10-25 21:27:45 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "track count: %2d", audio_track_count());
|
2007-10-25 21:27:45 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "handle count: %d", (int)d.num_handles);
|
2005-06-22 20:37:31 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "cpu freq: %3dMHz",
|
|
|
|
(int)((FREQ + 500000) / 1000000));
|
2006-10-04 07:29:50 +00:00
|
|
|
#endif
|
2005-06-22 14:03:04 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
if (ticks > 0)
|
|
|
|
{
|
|
|
|
int avgclock = freq_sum * 10 / ticks; /* in 100 kHz */
|
2011-01-22 18:30:24 +00:00
|
|
|
#ifdef CPU_MULTI_FREQUENCY
|
|
|
|
int boostquota = (avgclock * 100 - CPUFREQ_NORMAL/1000) /
|
|
|
|
((CPUFREQ_MAX - CPUFREQ_NORMAL) / 1000000); /* in 0.1 % */
|
|
|
|
#else
|
|
|
|
int boostquota = boost_ticks * 1000 / ticks; /* in 0.1 % */
|
|
|
|
#endif
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "boost:%3d.%d%% (%d.%dMHz)",
|
|
|
|
boostquota/10, boostquota%10, avgclock/10, avgclock%10);
|
|
|
|
}
|
2005-06-22 14:03:04 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].putsf(0, line++, "pcmbufdesc: %2d/%2d",
|
|
|
|
pcmbuf_used_descs(), pcmbufdescs);
|
|
|
|
screens[i].putsf(0, line++, "watermark: %6d",
|
|
|
|
(int)(d.watermark));
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2010-04-25 12:01:25 +00:00
|
|
|
screens[i].update();
|
|
|
|
}
|
2005-06-22 14:03:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tick_remove_task(dbg_audio_task);
|
2010-04-25 12:01:25 +00:00
|
|
|
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
screens[i].setfont(FONT_UI);
|
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
|
|
|
|
2011-08-30 14:01:33 +00:00
|
|
|
static const char* bf_getname(int selected_item, void *data,
|
|
|
|
char *buffer, size_t buffer_len)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
core_print_block_at(selected_item, buffer, buffer_len);
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2011-08-30 14:01:45 +00:00
|
|
|
static int bf_action_cb(int action, struct gui_synclist* list)
|
|
|
|
{
|
|
|
|
if (action == ACTION_STD_OK)
|
|
|
|
{
|
2011-10-05 18:32:19 +00:00
|
|
|
if (gui_synclist_get_sel_pos(list) == 0 && core_test_free())
|
|
|
|
{
|
|
|
|
splash(HZ, "Freed test handle. New alloc should trigger compact");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
splash(HZ/1, "Attempting a 64k allocation");
|
|
|
|
int handle = core_alloc("test", 64<<10);
|
|
|
|
splash(HZ/2, (handle > 0) ? "Success":"Fail");
|
|
|
|
/* for some reason simplelist doesn't allow adding items here if
|
|
|
|
* info.get_name is given, so use normal list api */
|
|
|
|
gui_synclist_set_nb_items(list, core_get_num_blocks());
|
|
|
|
if (handle > 0)
|
|
|
|
core_free(handle);
|
|
|
|
}
|
2011-08-30 14:01:45 +00:00
|
|
|
action = ACTION_REDRAW;
|
|
|
|
}
|
|
|
|
else if (action == ACTION_NONE)
|
|
|
|
action = ACTION_REDRAW;
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
2011-08-30 14:01:33 +00:00
|
|
|
static bool dbg_buflib_allocs(void)
|
|
|
|
{
|
|
|
|
struct simplelist_info info;
|
|
|
|
simplelist_info_init(&info, "mem allocs", core_get_num_blocks(), NULL);
|
|
|
|
info.get_name = bf_getname;
|
2011-08-30 14:01:45 +00:00
|
|
|
info.action_callback = bf_action_cb;
|
2011-09-01 11:29:55 +00:00
|
|
|
info.timeout = TIMEOUT_BLOCK;
|
2011-08-30 14:01:33 +00:00
|
|
|
return simplelist_show_list(&info);
|
|
|
|
}
|
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2009-08-20 16:47:44 +00:00
|
|
|
static const char* dbg_partitions_getname(int selected_item, void *data,
|
|
|
|
char *buffer, size_t buffer_len)
|
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
|
|
|
{
|
2009-11-09 23:26:47 +00:00
|
|
|
snprintf(buffer, buffer_len, " T:%x %ld MB", p->type, p->size / ( 2048 / ( SECTOR_SIZE / 512 )));
|
2002-10-10 12:01:58 +00:00
|
|
|
}
|
2007-04-05 04:52:53 +00:00
|
|
|
else
|
|
|
|
{
|
2008-04-09 15:25:17 +00:00
|
|
|
snprintf(buffer, buffer_len, "P%d: S:%lx", partition, p->start);
|
2007-04-05 04:52:53 +00:00
|
|
|
}
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2012-01-04 05:21:31 +00:00
|
|
|
static bool dbg_partitions(void)
|
2007-04-05 04:52:53 +00:00
|
|
|
{
|
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;
|
2008-05-05 07:11:27 +00:00
|
|
|
info.scroll_all = true;
|
2007-10-20 12:32:55 +00:00
|
|
|
info.get_name = dbg_partitions_getname;
|
|
|
|
return simplelist_show_list(&info);
|
2002-10-10 12:01:58 +00:00
|
|
|
}
|
2010-06-21 16:53:00 +00:00
|
|
|
#endif /* PLATFORM_NATIVE */
|
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
|
|
|
{
|
|
|
|
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_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
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Val: %s Sym: %s Par: %s",
|
2005-07-18 18:28:49 +00:00
|
|
|
valnogood?"--":"OK",
|
|
|
|
symbolerr?"--":"OK",
|
|
|
|
parityerr?"--":"OK");
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Status word: %08x", (int)control);
|
2005-07-18 18:28:49 +00:00
|
|
|
|
|
|
|
line++;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
x = control >> 31;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "PRO: %d (%s)",
|
2005-07-18 18:28:49 +00:00
|
|
|
x, x?"Professional":"Consumer");
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
x = (control >> 30) & 1;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Audio: %d (%s)",
|
2005-07-18 18:28:49 +00:00
|
|
|
x, x?"Non-PCM":"PCM");
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
x = (control >> 29) & 1;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Copy: %d (%s)",
|
2005-07-18 18:28:49 +00:00
|
|
|
x, x?"Permitted":"Inhibited");
|
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;
|
|
|
|
}
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Preemphasis: %d (%s)", x, s);
|
2005-07-18 18:28:49 +00:00
|
|
|
|
|
|
|
x = (control >> 24) & 3;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Mode: %d", x);
|
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";
|
|
|
|
}
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Category: 0x%02x (%s)", category, s);
|
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;
|
|
|
|
}
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Generation: %d (%s)",
|
2005-07-18 18:28:49 +00:00
|
|
|
x, generation?"Original":"No ind.");
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
x = (control >> 12) & 15;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Source: %d", x);
|
2009-10-17 13:00:58 +00:00
|
|
|
|
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;
|
|
|
|
}
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Channel: %d (%s)", x, s);
|
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;
|
|
|
|
}
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Frequency: %d (%s)", x, s);
|
2006-05-12 01:10:18 +00:00
|
|
|
|
2005-07-18 18:28:49 +00:00
|
|
|
x = (control >> 2) & 3;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Clock accuracy: %d", x);
|
2006-05-12 01:10:18 +00:00
|
|
|
line++;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Measured freq: %ldHz",
|
2006-11-13 23:21:54 +00:00
|
|
|
spdif_measure_frequency());
|
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
|
|
|
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2005-07-18 18:28:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
#endif /* CPU_COLDFIRE */
|
2002-07-15 11:23:24 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2008-02-10 05:39:20 +00:00
|
|
|
static bool dbg_pcf(void)
|
|
|
|
{
|
|
|
|
int line;
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
#endif
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
line = 0;
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "DCDC1: %02x", pcf50605_read(0x1b));
|
|
|
|
lcd_putsf(0, line++, "DCDC2: %02x", pcf50605_read(0x1c));
|
|
|
|
lcd_putsf(0, line++, "DCDC3: %02x", pcf50605_read(0x1d));
|
|
|
|
lcd_putsf(0, line++, "DCDC4: %02x", pcf50605_read(0x1e));
|
|
|
|
lcd_putsf(0, line++, "DCDEC1: %02x", pcf50605_read(0x1f));
|
|
|
|
lcd_putsf(0, line++, "DCDEC2: %02x", pcf50605_read(0x20));
|
|
|
|
lcd_putsf(0, line++, "DCUDC1: %02x", pcf50605_read(0x21));
|
|
|
|
lcd_putsf(0, line++, "DCUDC2: %02x", pcf50605_read(0x22));
|
|
|
|
lcd_putsf(0, line++, "IOREGC: %02x", pcf50605_read(0x23));
|
|
|
|
lcd_putsf(0, line++, "D1REGC: %02x", pcf50605_read(0x24));
|
|
|
|
lcd_putsf(0, line++, "D2REGC: %02x", pcf50605_read(0x25));
|
|
|
|
lcd_putsf(0, line++, "D3REGC: %02x", pcf50605_read(0x26));
|
|
|
|
lcd_putsf(0, line++, "LPREG1: %02x", pcf50605_read(0x27));
|
2008-02-10 05:39:20 +00:00
|
|
|
lcd_update();
|
2012-01-04 06:21:16 +00:00
|
|
|
if (action_userabort(HZ/10))
|
2008-02-10 05:39:20 +00:00
|
|
|
{
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2008-02-10 05:39:20 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2008-02-10 05:39:20 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
{
|
|
|
|
int line;
|
|
|
|
int button;
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
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
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Frequency: %ld", FREQ);
|
|
|
|
lcd_putsf(0, line++, "boost_counter: %d", get_cpu_boost_counter());
|
2008-02-10 05:56:35 +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:
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2006-08-15 12:27:07 +00:00
|
|
|
return false;
|
2005-03-07 10:51:43 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
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
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2007-11-02 06:17:53 +00:00
|
|
|
#include "tsc2100.h"
|
2009-08-20 17:03:50 +00:00
|
|
|
static const char* tsc2100_debug_getname(int selected_item, void * data,
|
|
|
|
char *buffer, size_t buffer_len)
|
2007-11-02 06:17:53 +00:00
|
|
|
{
|
|
|
|
int *page = (int*)data;
|
|
|
|
bool reserved = false;
|
|
|
|
switch (*page)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if ((selected_item > 0x0a) ||
|
|
|
|
(selected_item == 0x04) ||
|
|
|
|
(selected_item == 0x08))
|
|
|
|
reserved = true;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if ((selected_item > 0x05) ||
|
|
|
|
(selected_item == 0x02))
|
|
|
|
reserved = true;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (selected_item > 0x1e)
|
|
|
|
reserved = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (reserved)
|
2011-02-06 19:11:29 +00:00
|
|
|
snprintf(buffer, buffer_len, "%02x: RSVD", selected_item);
|
2007-11-02 06:17:53 +00:00
|
|
|
else
|
2011-02-06 19:11:29 +00:00
|
|
|
snprintf(buffer, buffer_len, "%02x: %04x", selected_item,
|
|
|
|
tsc2100_readreg(*page, selected_item)&0xffff);
|
2007-11-02 06:17:53 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
static int tsc2100debug_action_callback(int action, struct gui_synclist *lists)
|
|
|
|
{
|
2007-12-17 02:37:21 +00:00
|
|
|
int *page = (int*)lists->data;
|
2007-11-02 06:17:53 +00:00
|
|
|
if (action == ACTION_STD_OK)
|
|
|
|
{
|
|
|
|
*page = (*page+1)%3;
|
2008-02-10 05:56:35 +00:00
|
|
|
snprintf(lists->title, 32,
|
2007-11-02 06:17:53 +00:00
|
|
|
"tsc2100 registers - Page %d", *page);
|
|
|
|
return ACTION_REDRAW;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
2008-09-10 20:14:22 +00:00
|
|
|
static bool tsc2100_debug(void)
|
2007-11-02 06:17:53 +00:00
|
|
|
{
|
|
|
|
int page = 0;
|
|
|
|
char title[32] = "tsc2100 registers - Page 0";
|
|
|
|
struct simplelist_info info;
|
|
|
|
simplelist_info_init(&info, title, 32, &page);
|
|
|
|
info.timeout = HZ/100;
|
|
|
|
info.get_name = tsc2100_debug_getname;
|
|
|
|
info.action_callback= tsc2100debug_action_callback;
|
|
|
|
return simplelist_show_list(&info);
|
|
|
|
}
|
|
|
|
#endif
|
2012-01-03 23:44:38 +00:00
|
|
|
#if (CONFIG_BATTERY_MEASURE != 0) && defined(HAVE_LCD_BITMAP) && !defined(SIMULATOR)
|
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)
|
2012-01-03 23:44:38 +00:00
|
|
|
#define BAT_TSPACE 20
|
|
|
|
#define BAT_YSPACE (LCD_HEIGHT - BAT_TSPACE)
|
2002-08-06 10:52:51 +00:00
|
|
|
|
2010-07-17 11:29:06 +00:00
|
|
|
|
2006-12-12 22:22:21 +00:00
|
|
|
static bool view_battery(void)
|
2002-08-06 10:52:51 +00:00
|
|
|
{
|
|
|
|
int view = 0;
|
2012-01-03 23:44:38 +00:00
|
|
|
int i, x, y, z, y1, y2, grid, graph;
|
2005-02-08 15:12:25 +00:00
|
|
|
unsigned short maxv, minv;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
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
|
|
|
}
|
2012-01-03 23:44:38 +00:00
|
|
|
/* print header */
|
|
|
|
#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE)
|
2010-07-17 11:29:06 +00:00
|
|
|
/* adjust grid scale */
|
|
|
|
if ((maxv - minv) > 50)
|
|
|
|
grid = 50;
|
|
|
|
else
|
|
|
|
grid = 5;
|
2012-01-03 23:44:38 +00:00
|
|
|
|
2010-07-17 11:29:06 +00:00
|
|
|
lcd_putsf(0, 0, "battery %d.%03dV", power_history[0] / 1000,
|
2007-08-15 23:57:27 +00:00
|
|
|
power_history[0] % 1000);
|
2010-07-17 11:29:06 +00:00
|
|
|
lcd_putsf(0, 1, "%d.%03d-%d.%03dV (%2dmV)",
|
|
|
|
minv / 1000, minv % 1000, maxv / 1000, maxv % 1000,
|
|
|
|
grid);
|
2012-01-03 23:44:38 +00:00
|
|
|
#elif (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
|
|
|
|
/* adjust grid scale */
|
|
|
|
if ((maxv - minv) > 10)
|
|
|
|
grid = 10;
|
|
|
|
else
|
|
|
|
grid = 1;
|
|
|
|
lcd_putsf(0, 0, "battery %d%%", power_history[0]);
|
|
|
|
lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid);
|
|
|
|
#endif
|
2010-07-17 11:29:06 +00:00
|
|
|
|
|
|
|
i = 1;
|
|
|
|
while ((y = (minv - (minv % grid)+i*grid)) < maxv)
|
|
|
|
{
|
|
|
|
graph = ((y-minv)*BAT_YSPACE)/(maxv-minv);
|
|
|
|
graph = LCD_HEIGHT-1 - graph;
|
|
|
|
|
|
|
|
/* draw dotted horizontal grid line */
|
|
|
|
for (x=0; x<LCD_WIDTH;x=x+2)
|
|
|
|
lcd_drawpixel(x,graph);
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2002-08-10 08:57:47 +00:00
|
|
|
x = 0;
|
2010-07-17 11:29:06 +00:00
|
|
|
/* draw plot of power history
|
|
|
|
* skip empty entries
|
|
|
|
*/
|
|
|
|
for (i = BAT_LAST_VAL - 1; i > 0; i--)
|
|
|
|
{
|
|
|
|
if (power_history[i] && power_history[i-1])
|
|
|
|
{
|
|
|
|
y1 = (power_history[i] - minv) * BAT_YSPACE /
|
|
|
|
(maxv - minv);
|
2012-01-03 23:44:38 +00:00
|
|
|
y1 = MIN(MAX(LCD_HEIGHT-1 - y1, BAT_TSPACE),
|
2010-07-17 11:29:06 +00:00
|
|
|
LCD_HEIGHT-1);
|
|
|
|
y2 = (power_history[i-1] - minv) * BAT_YSPACE /
|
|
|
|
(maxv - minv);
|
2012-01-03 23:44:38 +00:00
|
|
|
y2 = MIN(MAX(LCD_HEIGHT-1 - y2, BAT_TSPACE),
|
2010-07-17 11:29:06 +00:00
|
|
|
LCD_HEIGHT-1);
|
|
|
|
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID);
|
|
|
|
|
|
|
|
/* make line thicker */
|
|
|
|
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL)),
|
|
|
|
y1,
|
|
|
|
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL)),
|
|
|
|
y2);
|
|
|
|
lcd_drawline(((x*LCD_WIDTH)/(BAT_LAST_VAL))+1,
|
|
|
|
y1+1,
|
|
|
|
(((x+1)*LCD_WIDTH)/(BAT_LAST_VAL))+1,
|
|
|
|
y2+1);
|
|
|
|
x++;
|
|
|
|
}
|
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 1: /* status: */
|
2010-05-19 13:24:18 +00:00
|
|
|
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
|
|
|
lcd_putsf(0, 0, "Pwr status: %s",
|
|
|
|
charging_state() ? "charging" : "discharging");
|
|
|
|
#else
|
2012-01-03 23:44:38 +00:00
|
|
|
lcd_puts(0, 0, "Power status: unknown");
|
2010-05-19 13:24:18 +00:00
|
|
|
#endif
|
2012-01-03 23:44:38 +00:00
|
|
|
battery_read_info(&y, &z);
|
|
|
|
if (y > 0)
|
|
|
|
lcd_putsf(0, 1, "Battery: %d.%03d V (%d %%)", y / 1000, y % 1000, z);
|
|
|
|
else if (z > 0)
|
|
|
|
lcd_putsf(0, 1, "Battery: %d %%", z);
|
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;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 2, "External: %d.%03d V", y / 1000, y % 1000);
|
2004-12-01 00:33:18 +00:00
|
|
|
#endif
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2008-12-24 16:58:41 +00:00
|
|
|
#if defined ARCHOS_RECORDER
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 3, "Chgr: %s %s",
|
2005-03-28 00:47:09 +00:00
|
|
|
charger_inserted() ? "present" : "absent",
|
2008-12-24 16:58:41 +00:00
|
|
|
charger_enabled() ? "on" : "off");
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 5, "short delta: %d", short_delta);
|
|
|
|
lcd_putsf(0, 6, "long delta: %d", long_delta);
|
2002-08-10 08:57:47 +00:00
|
|
|
lcd_puts(0, 7, power_message);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 8, "USB Inserted: %s",
|
2007-02-01 10:47:22 +00:00
|
|
|
usb_inserted() ? "yes" : "no");
|
2008-12-24 16:58:41 +00:00
|
|
|
#elif 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;
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 3, "USB pwr: %s",
|
2009-10-17 13:00:58 +00:00
|
|
|
usb_pwr ? "present" : "absent");
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 4, "EXT pwr: %s",
|
2009-10-17 13:00:58 +00:00
|
|
|
ext_pwr ? "present" : "absent");
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 5, "Battery: %s",
|
2006-10-27 05:31:28 +00:00
|
|
|
charging ? "charging" : (usb_pwr||ext_pwr) ? "charged" : "discharging");
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 6, "Dock mode: %s",
|
2006-03-18 09:13:55 +00:00
|
|
|
dock ? "enabled" : "disabled");
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 7, "Headphone: %s",
|
2006-03-18 09:13:55 +00:00
|
|
|
headphone ? "connected" : "disconnected");
|
2009-11-03 20:35:04 +00:00
|
|
|
#ifdef IPOD_VIDEO
|
2010-08-31 19:06:04 +00:00
|
|
|
if(probed_ramsize == 64)
|
|
|
|
x = (adc_read(ADC_4066_ISTAT) * 2400) / (1024 * 2);
|
|
|
|
else
|
2011-07-24 17:32:50 +00:00
|
|
|
#endif
|
2010-08-31 19:06:04 +00:00
|
|
|
x = (adc_read(ADC_4066_ISTAT) * 2400) / (1024 * 3);
|
2009-11-03 20:35:04 +00:00
|
|
|
lcd_putsf(0, 8, "Ibat: %d mA", x);
|
|
|
|
lcd_putsf(0, 9, "Vbat * Ibat: %d mW", x * y / 1000);
|
2008-12-24 16:58:41 +00:00
|
|
|
#elif defined TOSHIBA_GIGABEAT_S
|
|
|
|
int line = 3;
|
2008-12-21 18:10:36 +00:00
|
|
|
unsigned int st;
|
|
|
|
|
|
|
|
static const unsigned char * const chrgstate_strings[] =
|
|
|
|
{
|
|
|
|
"Disabled",
|
|
|
|
"Error",
|
|
|
|
"Discharging",
|
|
|
|
"Precharge",
|
|
|
|
"Constant Voltage",
|
|
|
|
"Constant Current",
|
|
|
|
"<unknown>",
|
|
|
|
};
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Charger: %s",
|
2008-12-24 16:58:41 +00:00
|
|
|
charger_inserted() ? "present" : "absent");
|
|
|
|
|
2008-12-21 18:10:36 +00:00
|
|
|
st = power_input_status() &
|
|
|
|
(POWER_INPUT_CHARGER | POWER_INPUT_BATTERY);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "%s%s",
|
2008-12-21 18:10:36 +00:00
|
|
|
(st & POWER_INPUT_MAIN_CHARGER) ? " Main" : "",
|
|
|
|
(st & POWER_INPUT_USB_CHARGER) ? " USB" : "");
|
|
|
|
|
|
|
|
y = ARRAYLEN(chrgstate_strings) - 1;
|
|
|
|
|
|
|
|
switch (charge_state)
|
|
|
|
{
|
|
|
|
case CHARGE_STATE_DISABLED: y--;
|
|
|
|
case CHARGE_STATE_ERROR: y--;
|
|
|
|
case DISCHARGING: y--;
|
|
|
|
case TRICKLE: y--;
|
|
|
|
case TOPOFF: y--;
|
|
|
|
case CHARGING: y--;
|
|
|
|
default:;
|
|
|
|
}
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "State: %s", chrgstate_strings[y]);
|
2008-12-21 18:10:36 +00:00
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Battery Switch: %s",
|
2008-12-21 18:10:36 +00:00
|
|
|
(st & POWER_INPUT_BATTERY) ? "On" : "Off");
|
|
|
|
|
|
|
|
y = chrgraw_adc_voltage();
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "CHRGRAW: %d.%03d V",
|
2008-12-21 18:10:36 +00:00
|
|
|
y / 1000, y % 1000);
|
|
|
|
|
|
|
|
y = application_supply_adc_voltage();
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "BP : %d.%03d V",
|
2008-12-21 18:10:36 +00:00
|
|
|
y / 1000, y % 1000);
|
|
|
|
|
2008-05-25 01:38:08 +00:00
|
|
|
y = battery_adc_charge_current();
|
2008-12-21 18:10:36 +00:00
|
|
|
if (y < 0) x = '-', y = -y;
|
|
|
|
else x = ' ';
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "CHRGISN:%c%d mA", x, y);
|
2008-12-21 18:10:36 +00:00
|
|
|
|
|
|
|
y = cccv_regulator_dissipation();
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "P CCCV : %d mW", y);
|
2008-12-21 18:10:36 +00:00
|
|
|
|
|
|
|
y = battery_charge_current();
|
|
|
|
if (y < 0) x = '-', y = -y;
|
|
|
|
else x = ' ';
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "I Charge:%c%d mA", x, y);
|
2008-05-25 01:38:08 +00:00
|
|
|
|
|
|
|
y = battery_adc_temp();
|
2008-12-21 18:10:36 +00:00
|
|
|
|
|
|
|
if (y != INT_MIN) {
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "T Battery: %dC (%dF)", y,
|
2009-10-17 13:00:58 +00:00
|
|
|
(9*y + 160) / 5);
|
2008-12-21 18:10:36 +00:00
|
|
|
} else {
|
|
|
|
/* Conversion disabled */
|
2009-10-17 13:00:58 +00:00
|
|
|
lcd_puts(0, line++, "T Battery: ?");
|
2008-12-21 18:10:36 +00:00
|
|
|
}
|
|
|
|
|
2012-01-08 01:51:51 +00:00
|
|
|
#elif defined(HAVE_AS3514) && defined(CONFIG_CHARGING)
|
2009-01-11 10:07:22 +00:00
|
|
|
static const char * const chrgstate_strings[] =
|
|
|
|
{
|
2010-06-21 00:03:15 +00:00
|
|
|
[CHARGE_STATE_DISABLED - CHARGE_STATE_DISABLED]= "Disabled",
|
|
|
|
[CHARGE_STATE_ERROR - CHARGE_STATE_DISABLED] = "Error",
|
|
|
|
[DISCHARGING - CHARGE_STATE_DISABLED] = "Discharging",
|
|
|
|
[CHARGING - CHARGE_STATE_DISABLED] = "Charging",
|
2009-01-11 10:07:22 +00:00
|
|
|
};
|
|
|
|
const char *str = NULL;
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 3, "Charger: %s",
|
2009-01-11 10:07:22 +00:00
|
|
|
charger_inserted() ? "present" : "absent");
|
|
|
|
|
2010-06-21 00:03:15 +00:00
|
|
|
y = charge_state - CHARGE_STATE_DISABLED;
|
2009-01-11 10:07:22 +00:00
|
|
|
if ((unsigned)y < ARRAYLEN(chrgstate_strings))
|
|
|
|
str = chrgstate_strings[y];
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 4, "State: %s",
|
2009-01-11 10:07:22 +00:00
|
|
|
str ? str : "<unknown>");
|
|
|
|
|
2010-05-17 20:53:25 +00:00
|
|
|
lcd_putsf(0, 5, "CHARGER: %02X", ascodec_read_charger());
|
2009-10-10 22:02:23 +00:00
|
|
|
#elif defined(IPOD_NANO2G)
|
2010-03-10 03:18:58 +00:00
|
|
|
y = pmu_read_battery_voltage();
|
|
|
|
lcd_putsf(17, 1, "RAW: %d.%03d V", y / 1000, y % 1000);
|
2009-10-10 22:02:23 +00:00
|
|
|
y = pmu_read_battery_current();
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 2, "Battery current: %d mA", y);
|
2010-11-14 15:08:38 +00:00
|
|
|
lcd_putsf(0, 3, "PWRCON: %08x %08x", PWRCON, PWRCONEXT);
|
|
|
|
lcd_putsf(0, 4, "CLKCON: %08x %03x %03x", CLKCON, CLKCON2, CLKCON3);
|
|
|
|
lcd_putsf(0, 5, "PLL: %06x %06x %06x", PLL0PMS, PLL1PMS, PLL2PMS);
|
2010-02-17 15:57:53 +00:00
|
|
|
x = pmu_read(0x1b) & 0xf;
|
|
|
|
y = pmu_read(0x1a) * 25 + 625;
|
2010-11-14 15:08:38 +00:00
|
|
|
lcd_putsf(0, 6, "AUTO: %x / %d mV", x, y);
|
2010-02-17 15:57:53 +00:00
|
|
|
x = pmu_read(0x1f) & 0xf;
|
|
|
|
y = pmu_read(0x1e) * 25 + 625;
|
2010-11-14 15:08:38 +00:00
|
|
|
lcd_putsf(0, 7, "DOWN1: %x / %d mV", x, y);
|
2010-02-17 15:57:53 +00:00
|
|
|
x = pmu_read(0x23) & 0xf;
|
|
|
|
y = pmu_read(0x22) * 25 + 625;
|
2010-11-14 15:08:38 +00:00
|
|
|
lcd_putsf(0, 8, "DOWN2: %x / %d mV", x, y);
|
2010-02-17 15:57:53 +00:00
|
|
|
x = pmu_read(0x27) & 0xf;
|
|
|
|
y = pmu_read(0x26) * 100 + 900;
|
2010-11-14 15:08:38 +00:00
|
|
|
lcd_putsf(0, 9, "MEMLDO: %x / %d mV", x, y);
|
2010-02-17 15:57:53 +00:00
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
x = pmu_read(0x2e + (i << 1)) & 0xf;
|
|
|
|
y = pmu_read(0x2d + (i << 1)) * 100 + 900;
|
2010-11-14 15:08:38 +00:00
|
|
|
lcd_putsf(0, 10 + i, "LDO%d: %x / %d mV", i + 1, x, y);
|
2010-02-17 15:57:53 +00:00
|
|
|
}
|
2008-12-24 16:58:41 +00:00
|
|
|
#else
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 3, "Charger: %s",
|
2008-12-24 16:58:41 +00:00
|
|
|
charger_inserted() ? "present" : "absent");
|
|
|
|
#endif /* target type */
|
2006-06-06 22:23:52 +00:00
|
|
|
#endif /* CONFIG_CHARGING */
|
2002-08-10 08:57:47 +00:00
|
|
|
break;
|
|
|
|
case 2: /* voltage deltas: */
|
2012-01-03 23:44:38 +00:00
|
|
|
#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE)
|
2002-08-10 08:57:47 +00:00
|
|
|
lcd_puts(0, 0, "Voltage deltas:");
|
2012-01-03 23:44:38 +00:00
|
|
|
for (i = 0; i < POWER_HISTORY_LEN-1; i++) {
|
2007-08-15 23:57:27 +00:00
|
|
|
y = power_history[i] - power_history[i+1];
|
2012-01-03 23:44:38 +00:00
|
|
|
lcd_putsf(0, i+1, "-%d min: %c%d.%03d V", i,
|
|
|
|
(y < 0) ? '-' : ' ', ((y < 0) ? y * -1 : y) / 1000,
|
2007-08-15 23:57:27 +00:00
|
|
|
((y < 0) ? y * -1 : y ) % 1000);
|
2002-08-10 08:57:47 +00:00
|
|
|
}
|
2012-01-03 23:44:38 +00:00
|
|
|
#elif (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
|
|
|
|
lcd_puts(0, 0, "Percentage deltas:");
|
|
|
|
for (i = 0; i < POWER_HISTORY_LEN-1; i++) {
|
|
|
|
y = power_history[i] - power_history[i+1];
|
|
|
|
lcd_putsf(0, i+1, "-%d min: %c%d%%", i,
|
|
|
|
(y < 0) ? '-' : ' ', ((y < 0) ? y * -1 : y));
|
|
|
|
}
|
|
|
|
#endif
|
2002-08-10 08:57:47 +00:00
|
|
|
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
|
|
|
|
2008-12-24 16:58:41 +00:00
|
|
|
#ifdef ARCHOS_RECORDER
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 0, "charge_state: %d", charge_state);
|
2002-12-15 18:10:19 +00:00
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 1, "Cycle time: %d m", powermgmt_last_cycle_startstop_min);
|
2002-12-03 14:18:51 +00:00
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 2, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level);
|
2005-03-28 00:47:09 +00:00
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 3, "P=%2d I=%2d", pid_p, pid_i);
|
2005-03-28 00:47:09 +00:00
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 4, "Trickle sec: %d/60", trickle_sec);
|
2008-12-24 16:58:41 +00:00
|
|
|
#endif /* ARCHOS_RECORDER */
|
2002-12-03 14:18:51 +00:00
|
|
|
|
2012-01-03 23:44:38 +00:00
|
|
|
#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE)
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 5, "Last PwrHist: %d.%03dV",
|
2007-08-15 23:57:27 +00:00
|
|
|
power_history[0] / 1000,
|
|
|
|
power_history[0] % 1000);
|
2012-01-03 23:44:38 +00:00
|
|
|
#endif
|
2002-12-03 14:18:51 +00:00
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 6, "battery level: %d%%", battery_level());
|
2005-03-28 00:00:24 +00:00
|
|
|
|
2012-01-03 23:44:38 +00:00
|
|
|
int time_left = battery_time();
|
|
|
|
if (time_left >= 0)
|
|
|
|
lcd_putsf(0, 7, "Est. remain: %d m", time_left);
|
|
|
|
else
|
|
|
|
lcd_puts(0, 7, "Estimation n/a");
|
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
|
|
|
|
2008-04-19 17:54:12 +00:00
|
|
|
switch(get_action(CONTEXT_STD,HZ/2))
|
2002-08-06 10:52:51 +00:00
|
|
|
{
|
2008-04-19 17:54:12 +00:00
|
|
|
case ACTION_STD_PREV:
|
2002-08-10 08:57:47 +00:00
|
|
|
if (view)
|
|
|
|
view--;
|
|
|
|
break;
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2008-04-19 17:54:12 +00:00
|
|
|
case ACTION_STD_NEXT:
|
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:
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2002-09-24 17:22:12 +00:00
|
|
|
return false;
|
2002-08-06 10:52:51 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2002-09-24 17:22:12 +00:00
|
|
|
return false;
|
2002-08-06 10:52:51 +00:00
|
|
|
}
|
|
|
|
|
2012-01-03 23:44:38 +00:00
|
|
|
#endif /* (CONFIG_BATTERY_MEASURE != 0) && HAVE_LCD_BITMAP */
|
2006-08-21 17:35:35 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2008-10-31 21:25:04 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
|
2008-11-01 16:14:28 +00:00
|
|
|
|
2008-10-31 21:25:04 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC)
|
2007-07-14 08:55:47 +00:00
|
|
|
#define CARDTYPE "MMC"
|
2008-11-01 16:14:28 +00:00
|
|
|
#elif (CONFIG_STORAGE & STORAGE_SD)
|
2007-07-14 08:55:47 +00:00
|
|
|
#define CARDTYPE "microSD"
|
|
|
|
#endif
|
2008-11-01 16:14:28 +00:00
|
|
|
|
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-12-17 02:37:21 +00:00
|
|
|
int *cardnum = (int*)lists->data;
|
2009-12-09 15:32:22 +00:00
|
|
|
unsigned char card_name[6];
|
2007-07-12 09:58:54 +00:00
|
|
|
unsigned char pbuf[32];
|
2007-12-17 02:37:21 +00:00
|
|
|
char *title = lists->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 };
|
2009-10-17 13:40:42 +00:00
|
|
|
static const unsigned char * const kbit_units[] = { "kBit/s", "MBit/s", "GBit/s" };
|
|
|
|
static const unsigned char * const nsec_units[] = { "ns", "µs", "ms" };
|
2009-07-01 21:49:13 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC)
|
2009-10-17 13:00:58 +00:00
|
|
|
static const char * const mmc_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" };
|
2009-07-01 21:49:13 +00:00
|
|
|
#endif
|
|
|
|
|
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
|
|
|
{
|
2008-05-13 02:50:31 +00:00
|
|
|
#ifdef HAVE_HOTSWAP
|
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 */
|
|
|
|
}
|
2008-05-13 02:50:31 +00:00
|
|
|
#endif
|
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
|
|
|
{
|
2009-12-09 15:32:22 +00:00
|
|
|
unsigned i;
|
|
|
|
for (i=0; i<sizeof(card_name); i++)
|
|
|
|
{
|
2009-12-09 17:10:48 +00:00
|
|
|
card_name[i] = card_extract_bits(card->cid, (103-8*i), 8);
|
2009-12-09 15:32:22 +00:00
|
|
|
}
|
2009-12-09 17:10:48 +00:00
|
|
|
strlcpy(card_name, card_name, sizeof(card_name));
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"%s Rev %d.%d", card_name,
|
2009-12-09 15:32:22 +00:00
|
|
|
(int) card_extract_bits(card->cid, 63, 4),
|
|
|
|
(int) card_extract_bits(card->cid, 59, 4));
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"Prod: %d/%d",
|
2009-07-01 21:49:13 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_SD)
|
2009-12-09 15:32:22 +00:00
|
|
|
(int) card_extract_bits(card->cid, 11, 4),
|
2009-07-01 21:49:13 +00:00
|
|
|
(int) card_extract_bits(card->cid, 19, 8) + 2000
|
|
|
|
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
2009-07-01 19:13:01 +00:00
|
|
|
(int) card_extract_bits(card->cid, 15, 4),
|
2009-07-01 21:49:13 +00:00
|
|
|
(int) card_extract_bits(card->cid, 11, 4) + 1997
|
|
|
|
#endif
|
|
|
|
);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2009-07-01 21:49:13 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_SD)
|
2007-07-12 09:58:54 +00:00
|
|
|
"Ser#: 0x%08lx",
|
2009-07-01 21:49:13 +00:00
|
|
|
card_extract_bits(card->cid, 55, 32)
|
|
|
|
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
|
|
|
"Ser#: 0x%04lx",
|
|
|
|
card_extract_bits(card->cid, 47, 16)
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "M=%02x, "
|
|
|
|
#if (CONFIG_STORAGE & STORAGE_SD)
|
|
|
|
"O=%c%c",
|
|
|
|
(int) card_extract_bits(card->cid, 127, 8),
|
|
|
|
card_extract_bits(card->cid, 119, 8),
|
|
|
|
card_extract_bits(card->cid, 111, 8)
|
|
|
|
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
|
|
|
"O=%04x",
|
2009-07-01 19:13:01 +00:00
|
|
|
(int) card_extract_bits(card->cid, 127, 8),
|
2009-07-01 21:49:13 +00:00
|
|
|
(int) card_extract_bits(card->cid, 119, 16)
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
|
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC)
|
2009-07-01 19:13:01 +00:00
|
|
|
int temp = card_extract_bits(card->csd, 125, 4);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2009-07-01 21:49:13 +00:00
|
|
|
"MMC v%s", temp < 5 ?
|
|
|
|
mmc_spec_vers[temp] : "?.?");
|
|
|
|
#endif
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2008-09-14 20:33:24 +00:00
|
|
|
"Blocks: 0x%08lx", card->numblocks);
|
2007-07-12 09:58:54 +00:00
|
|
|
output_dyn_value(pbuf, sizeof pbuf, card->speed / 1000,
|
|
|
|
kbit_units, false);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"Speed: %s", pbuf);
|
2009-07-01 10:07:22 +00:00
|
|
|
output_dyn_value(pbuf, sizeof pbuf, card->taac,
|
2007-07-12 09:58:54 +00:00
|
|
|
nsec_units, false);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2009-07-01 10:07:22 +00:00
|
|
|
"Taac: %s", pbuf);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"Nsac: %d clk", card->nsac);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"R2W: *%d", card->r2w_factor);
|
2011-04-11 19:11:39 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_SD)
|
|
|
|
int csd_structure = card_extract_bits(card->csd, 127, 2);
|
|
|
|
if (csd_structure == 0) /* CSD version 1.0 */
|
|
|
|
#endif
|
|
|
|
{
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"IRmax: %d..%d mA",
|
2009-07-01 19:13:01 +00:00
|
|
|
i_vmin[card_extract_bits(card->csd, 61, 3)],
|
|
|
|
i_vmax[card_extract_bits(card->csd, 58, 3)]);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"IWmax: %d..%d mA",
|
2009-07-01 19:13:01 +00:00
|
|
|
i_vmin[card_extract_bits(card->csd, 55, 3)],
|
|
|
|
i_vmax[card_extract_bits(card->csd, 52, 3)]);
|
2011-04-11 19:11:39 +00:00
|
|
|
}
|
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
|
|
|
}
|
2008-10-31 21:25:04 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_SD)
|
2007-07-25 06:15:07 +00:00
|
|
|
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;
|
|
|
|
}
|
2008-11-01 16:14:28 +00:00
|
|
|
#elif (CONFIG_STORAGE & STORAGE_ATA)
|
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 );
|
2008-02-10 05:56:35 +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 );
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"Free: %ld MB", free / 1024);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2008-11-01 16:14:28 +00:00
|
|
|
"Spinup time: %d ms", storage_spinup_time() * (1000/HZ));
|
2007-07-12 09:58:54 +00:00
|
|
|
i = identify_info[83] & (1<<3);
|
2008-02-10 05:56:35 +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);
|
2008-02-10 05:56:35 +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);
|
2008-02-10 05:56:35 +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;
|
2008-02-10 05:56:35 +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 {
|
2008-02-10 05:56:35 +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) {
|
2008-02-10 05:56:35 +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 {
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"No timing info");
|
|
|
|
}
|
2010-04-09 11:55:57 +00:00
|
|
|
int sector_size = 512;
|
|
|
|
if((identify_info[106] & 0xe000) == 0x6000)
|
|
|
|
sector_size *= BIT_N(identify_info[106] & 0x000f);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"Physical sector size: %d", sector_size);
|
2009-03-12 02:01:25 +00:00
|
|
|
#ifdef HAVE_ATA_DMA
|
2008-05-04 15:27:10 +00:00
|
|
|
if (identify_info[63] & (1<<0)) {
|
|
|
|
char mdma0[2], mdma1[2], mdma2[2];
|
|
|
|
mdma0[1] = mdma1[1] = mdma2[1] = 0;
|
|
|
|
mdma0[0] = (identify_info[63] & (1<<0)) ? '0' : 0;
|
|
|
|
mdma1[0] = (identify_info[63] & (1<<1)) ? '1' : 0;
|
|
|
|
mdma2[0] = (identify_info[63] & (1<<2)) ? '2' : 0;
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"MDMA modes: %s %s %s", mdma0, mdma1, mdma2);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"MDMA Cycle times %dns/%dns",
|
|
|
|
identify_info[65],
|
|
|
|
identify_info[66] );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"No MDMA mode info");
|
|
|
|
}
|
2009-03-12 02:01:25 +00:00
|
|
|
if (identify_info[53] & (1<<2)) {
|
|
|
|
char udma0[2], udma1[2], udma2[2], udma3[2], udma4[2], udma5[2], udma6[2];
|
|
|
|
udma0[1] = udma1[1] = udma2[1] = udma3[1] = udma4[1] = udma5[1] = udma6[1] = 0;
|
2008-05-04 15:27:10 +00:00
|
|
|
udma0[0] = (identify_info[88] & (1<<0)) ? '0' : 0;
|
|
|
|
udma1[0] = (identify_info[88] & (1<<1)) ? '1' : 0;
|
|
|
|
udma2[0] = (identify_info[88] & (1<<2)) ? '2' : 0;
|
|
|
|
udma3[0] = (identify_info[88] & (1<<3)) ? '3' : 0;
|
|
|
|
udma4[0] = (identify_info[88] & (1<<4)) ? '4' : 0;
|
|
|
|
udma5[0] = (identify_info[88] & (1<<5)) ? '5' : 0;
|
2009-03-12 02:01:25 +00:00
|
|
|
udma6[0] = (identify_info[88] & (1<<6)) ? '6' : 0;
|
2008-05-04 15:27:10 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2009-03-12 02:01:25 +00:00
|
|
|
"UDMA modes: %s %s %s %s %s %s %s", udma0, udma1, udma2,
|
|
|
|
udma3, udma4, udma5, udma6);
|
2008-05-04 15:27:10 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"No UDMA mode info");
|
|
|
|
}
|
2009-03-12 02:01:25 +00:00
|
|
|
#endif /* HAVE_ATA_DMA */
|
2007-07-12 09:58:54 +00:00
|
|
|
timing_info_present = identify_info[53] & (1<<1);
|
|
|
|
if(timing_info_present) {
|
|
|
|
i = identify_info[49] & (1<<11);
|
2008-02-10 05:56:35 +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);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"IORDY disable: %s", i ? "yes" : "no");
|
|
|
|
} else {
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-07-12 09:58:54 +00:00
|
|
|
"No timing info");
|
|
|
|
}
|
2008-02-10 05:56:35 +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)));
|
2009-03-12 02:01:25 +00:00
|
|
|
#ifdef HAVE_ATA_DMA
|
|
|
|
i = ata_get_dma_mode();
|
|
|
|
if (i == 0) {
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"DMA not enabled");
|
|
|
|
} else {
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"DMA mode: %s %c",
|
|
|
|
(i & 0x40) ? "UDMA" : "MDMA",
|
|
|
|
'0' + (i & 7));
|
|
|
|
}
|
|
|
|
#endif /* HAVE_ATA_DMA */
|
2007-07-12 09:58:54 +00:00
|
|
|
return btn;
|
|
|
|
}
|
2008-11-01 16:14:28 +00:00
|
|
|
#else /* No SD, MMC or ATA */
|
|
|
|
static int disk_callback(int btn, struct gui_synclist *lists)
|
|
|
|
{
|
|
|
|
(void)lists;
|
|
|
|
struct storage_info info;
|
2008-11-02 01:14:46 +00:00
|
|
|
storage_get_info(0,&info);
|
2008-11-01 16:14:28 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Vendor: %s", info.vendor);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Model: %s", info.product);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Firmware: %s", info.revision);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"Size: %ld MB", info.num_sectors*(info.sector_size/512)/2024);
|
|
|
|
unsigned long free;
|
|
|
|
fat_size( IF_MV2(0,) NULL, &free );
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"Free: %ld MB", free / 1024);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
|
|
|
|
return btn;
|
|
|
|
}
|
|
|
|
#endif
|
2008-02-27 22:52:18 +00:00
|
|
|
|
2008-11-01 16:14:28 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_ATA)
|
2008-02-27 22:52:18 +00:00
|
|
|
static bool dbg_identify_info(void)
|
|
|
|
{
|
2010-05-06 17:35:04 +00:00
|
|
|
int fd = creat("/identify_info.bin", 0666);
|
2008-02-27 22:52:18 +00:00
|
|
|
if(fd >= 0)
|
|
|
|
{
|
2008-03-01 10:47:21 +00:00
|
|
|
#ifdef ROCKBOX_LITTLE_ENDIAN
|
|
|
|
ecwrite(fd, ata_get_identify(), SECTOR_SIZE/2, "s", true);
|
|
|
|
#else
|
2008-02-27 22:52:18 +00:00
|
|
|
write(fd, ata_get_identify(), SECTOR_SIZE);
|
2008-03-01 10:47:21 +00:00
|
|
|
#endif
|
2008-02-27 22:52:18 +00:00
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2008-11-01 16:14:28 +00:00
|
|
|
#endif
|
2008-05-13 02:50:31 +00:00
|
|
|
|
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);
|
2008-10-31 21:25:04 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
|
2007-10-20 12:32:55 +00:00
|
|
|
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;
|
2008-05-05 07:11:27 +00:00
|
|
|
info.scroll_all = true;
|
2007-10-20 12:32:55 +00:00
|
|
|
return simplelist_show_list(&info);
|
2002-12-03 13:12:55 +00:00
|
|
|
}
|
2010-06-21 16:53:00 +00:00
|
|
|
#endif /* PLATFORM_NATIVE */
|
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
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
(void)lists;
|
2007-10-20 12:32:55 +00:00
|
|
|
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");
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Cache size: %d B",
|
2007-07-11 13:27:15 +00:00
|
|
|
dircache_get_cache_size());
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Last size: %d B",
|
2007-07-11 13:27:15 +00:00
|
|
|
global_status.dircache_size);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Limit: %d B",
|
2007-07-11 13:27:15 +00:00
|
|
|
DIRCACHE_LIMIT);
|
2008-02-10 05:56:35 +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);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Scanning took: %d s",
|
2007-07-11 13:27:15 +00:00
|
|
|
dircache_get_build_ticks() / HZ);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Entry count: %d",
|
2007-07-11 13:27:15 +00:00
|
|
|
dircache_get_entry_count());
|
|
|
|
return btn;
|
|
|
|
}
|
2008-02-10 05:56:35 +00:00
|
|
|
|
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;
|
2008-05-05 07:11:27 +00:00
|
|
|
info.scroll_all = true;
|
2007-10-20 12:32:55 +00:00
|
|
|
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;
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2007-10-20 12:32:55 +00:00
|
|
|
simplelist_set_line_count(0);
|
2008-02-10 05:56:35 +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");
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "DB Ready: %s",
|
2007-07-11 13:27:15 +00:00
|
|
|
stat->ready ? "Yes" : "No");
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "RAM Cache: %s",
|
2007-07-11 13:27:15 +00:00
|
|
|
stat->ramcache ? "Yes" : "No");
|
2008-02-10 05:56:35 +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);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Progress: %d%% (%d entries)",
|
2007-07-11 13:27:15 +00:00
|
|
|
stat->progress, stat->processed_entries);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Curfile: %s",
|
2007-10-21 11:06:30 +00:00
|
|
|
stat->curentry ? stat->curentry : "---");
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Commit step: %d",
|
2007-07-11 13:27:15 +00:00
|
|
|
stat->commit_step);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Commit delayed: %s",
|
2007-07-11 13:27:15 +00:00
|
|
|
stat->commit_delayed ? "Yes" : "No");
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2008-07-17 18:36:47 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "Queue length: %d",
|
2008-02-17 18:35:27 +00:00
|
|
|
stat->queue_length);
|
2008-07-17 18:36:47 +00:00
|
|
|
|
2007-10-21 11:06:30 +00:00
|
|
|
if (synced)
|
|
|
|
{
|
|
|
|
synced = false;
|
|
|
|
tagcache_screensync_event();
|
|
|
|
}
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2007-10-21 11:06:30 +00:00
|
|
|
if (!btn && stat->curentry)
|
|
|
|
{
|
|
|
|
synced = true;
|
|
|
|
return ACTION_REDRAW;
|
|
|
|
}
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2007-10-21 11:06:30 +00:00
|
|
|
if (btn == ACTION_STD_CANCEL)
|
|
|
|
tagcache_screensync_enable(false);
|
2008-02-10 05:56:35 +00:00
|
|
|
|
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;
|
2008-05-05 07:11:27 +00:00
|
|
|
info.scroll_all = true;
|
2008-07-17 18:36:47 +00:00
|
|
|
|
2008-02-17 18:35:27 +00:00
|
|
|
/* Don't do nonblock here, must give enough processing time
|
|
|
|
for tagcache thread. */
|
|
|
|
/* info.timeout = TIMEOUT_NOBLOCK; */
|
|
|
|
info.timeout = 1;
|
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
|
|
|
|
2010-05-06 17:35:04 +00:00
|
|
|
fd = creat("/internal_rom_0000-FFFF.bin", 0666);
|
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
|
|
|
|
2010-05-06 17:35:04 +00:00
|
|
|
fd = creat("/internal_rom_2000000-203FFFF.bin", 0666);
|
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)
|
2010-05-06 17:35:04 +00:00
|
|
|
fd = creat("/internal_rom_000000-1FFFFF.bin", 0666);
|
2005-11-09 01:26:33 +00:00
|
|
|
#elif defined(IRIVER_H300_SERIES)
|
2010-05-06 17:35:04 +00:00
|
|
|
fd = creat("/internal_rom_000000-3FFFFF.bin", 0666);
|
2008-03-14 08:54:54 +00:00
|
|
|
#elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3)
|
2010-05-06 17:35:04 +00:00
|
|
|
fd = creat("/internal_rom_000000-3FFFFF.bin", 0666);
|
2010-11-26 23:28:08 +00:00
|
|
|
#elif defined(MPIO_HD200) || defined(MPIO_HD300)
|
2010-05-06 17:35:04 +00:00
|
|
|
fd = creat("/internal_rom_000000-1FFFFF.bin", 0666);
|
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
|
2010-05-06 17:35:04 +00:00
|
|
|
fd = creat("/internal_eeprom.bin", 0666);
|
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;
|
|
|
|
|
2008-03-26 01:50:41 +00:00
|
|
|
old_irq_level = disable_irq_save();
|
2006-08-15 22:54:06 +00:00
|
|
|
|
|
|
|
err = eeprom_24cxx_read(0, buf, sizeof buf);
|
2008-03-26 01:50:41 +00:00
|
|
|
|
|
|
|
restore_irq(old_irq_level);
|
|
|
|
|
2006-08-15 22:54:06 +00:00
|
|
|
if (err)
|
2008-08-15 08:27:39 +00:00
|
|
|
splashf(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
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
2008-10-31 21:25:04 +00:00
|
|
|
#elif defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)
|
2007-02-23 23:22:03 +00:00
|
|
|
static bool dbg_save_roms(void)
|
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
int fd = creat("/internal_rom_000000-0FFFFF.bin", 0666);
|
2007-02-23 23:22:03 +00:00
|
|
|
if(fd >= 0)
|
|
|
|
{
|
|
|
|
write(fd, (void *)0x20000000, FLASH_SIZE);
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2009-10-16 16:08:11 +00:00
|
|
|
#elif CONFIG_CPU == IMX31L
|
2012-05-07 04:55:59 +00:00
|
|
|
bool __dbg_dvfs_dptc(void);
|
2009-10-16 16:08:11 +00:00
|
|
|
static bool dbg_save_roms(void)
|
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
int fd = creat("/flash_rom_A0000000-A01FFFFF.bin", 0666);
|
2009-10-16 16:08:11 +00:00
|
|
|
if (fd >= 0)
|
|
|
|
{
|
|
|
|
write(fd, (void*)0xa0000000, FLASH_SIZE);
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2009-10-29 20:12:28 +00:00
|
|
|
#elif defined(CPU_TCC780X)
|
|
|
|
static bool dbg_save_roms(void)
|
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
int fd = creat("/eeprom_E0000000-E0001FFF.bin", 0666);
|
2009-10-29 20:12:28 +00:00
|
|
|
if (fd >= 0)
|
|
|
|
{
|
|
|
|
write(fd, (void*)0xe0000000, 0x2000);
|
|
|
|
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
|
2010-06-15 20:57:48 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_TUNER_MULTI
|
|
|
|
static int tuner_type = 0;
|
|
|
|
#define IF_TUNER_TYPE(type) if(tuner_type==type)
|
|
|
|
#else
|
|
|
|
#define IF_TUNER_TYPE(type)
|
|
|
|
#endif
|
|
|
|
|
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)
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-10-20 12:32:55 +00:00
|
|
|
"CTRL_STAT: %02X", lv24020lp_get(LV24020LP_CTRL_STAT) );
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-10-20 12:32:55 +00:00
|
|
|
"RADIO_STAT: %02X", lv24020lp_get(LV24020LP_REG_STAT) );
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-10-20 12:32:55 +00:00
|
|
|
"MSS_FM: %d kHz", lv24020lp_get(LV24020LP_MSS_FM) );
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-10-20 12:32:55 +00:00
|
|
|
"MSS_IF: %d Hz", lv24020lp_get(LV24020LP_MSS_IF) );
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-10-20 12:32:55 +00:00
|
|
|
"MSS_SD: %d Hz", lv24020lp_get(LV24020LP_MSS_SD) );
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-10-20 12:32:55 +00:00
|
|
|
"if_set: %d Hz", lv24020lp_get(LV24020LP_IF_SET) );
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-10-20 12:32:55 +00:00
|
|
|
"sd_set: %d Hz", lv24020lp_get(LV24020LP_SD_SET) );
|
2008-12-27 19:18:50 +00:00
|
|
|
#endif /* LV24020LP */
|
2006-08-11 17:39:34 +00:00
|
|
|
#if (CONFIG_TUNER & S1A0903X01)
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
2007-10-20 12:32:55 +00:00
|
|
|
"Samsung regs: %08X", s1a0903x01_get(RADIO_ALL));
|
2007-07-15 18:25:39 +00:00
|
|
|
/* This one doesn't return dynamic data atm */
|
2008-12-27 19:18:50 +00:00
|
|
|
#endif /* S1A0903X01 */
|
2006-08-11 17:39:34 +00:00
|
|
|
#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:");
|
2008-02-10 05:56:35 +00:00
|
|
|
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]);
|
2008-02-10 05:56:35 +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]);
|
2008-12-27 19:18:50 +00:00
|
|
|
#endif /* TEA5767 */
|
|
|
|
#if (CONFIG_TUNER & SI4700)
|
2010-06-15 20:57:48 +00:00
|
|
|
IF_TUNER_TYPE(SI4700)
|
|
|
|
{
|
|
|
|
struct si4700_dbg_info nfo;
|
|
|
|
si4700_dbg_info(&nfo);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "SI4700 regs:");
|
2012-01-04 07:42:03 +00:00
|
|
|
for (int i = 0; i < 16; i += 4) {
|
2010-06-15 20:57:48 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,"%02X: %04X %04X %04X %04X",
|
|
|
|
i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]);
|
|
|
|
}
|
|
|
|
}
|
2008-12-27 19:18:50 +00:00
|
|
|
#endif /* SI4700 */
|
2010-06-16 20:29:08 +00:00
|
|
|
#if (CONFIG_TUNER & RDA5802)
|
|
|
|
IF_TUNER_TYPE(RDA5802)
|
2010-06-15 20:57:48 +00:00
|
|
|
{
|
2010-06-16 20:29:08 +00:00
|
|
|
struct rda5802_dbg_info nfo;
|
|
|
|
rda5802_dbg_info(&nfo);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "RDA5802 regs:");
|
2012-01-04 07:42:03 +00:00
|
|
|
for (int i = 0; i < 16; i += 4) {
|
2010-06-15 20:57:48 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,"%02X: %04X %04X %04X %04X",
|
|
|
|
i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]);
|
|
|
|
}
|
|
|
|
}
|
2010-06-16 20:29:08 +00:00
|
|
|
#endif /* RDA55802 */
|
2012-05-19 16:03:27 +00:00
|
|
|
#if (CONFIG_TUNER & STFM1000)
|
|
|
|
IF_TUNER_TYPE(STFM1000)
|
|
|
|
{
|
|
|
|
struct stfm1000_dbg_info nfo;
|
|
|
|
stfm1000_dbg_info(&nfo);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "STFM1000 regs:");
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,"chipid: 0x%x", nfo.chipid);
|
|
|
|
}
|
|
|
|
#endif /* STFM1000 */
|
2012-02-16 19:49:06 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_RDS_CAP
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "PI:%04X PS:'%8s'",
|
|
|
|
rds_get_pi(), rds_get_ps());
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "RT:%s",
|
|
|
|
rds_get_rt());
|
2012-02-07 18:50:33 +00:00
|
|
|
time_t seconds = rds_get_ct();
|
|
|
|
struct tm* time = gmtime(&seconds);
|
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE,
|
|
|
|
"CT:%4d-%02d-%02d %02d:%02d",
|
|
|
|
time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
|
|
|
|
time->tm_hour, time->tm_min, time->tm_sec);
|
2012-02-16 19:49:06 +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;
|
2010-06-15 20:57:48 +00:00
|
|
|
#ifdef CONFIG_TUNER_MULTI
|
|
|
|
tuner_type = tuner_detect_type();
|
|
|
|
#endif
|
2008-05-05 07:11:27 +00:00
|
|
|
info.scroll_all = true;
|
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);
|
2008-02-10 05:56:35 +00:00
|
|
|
simplelist_addline(SIMPLELIST_ADD_LINE, "HW detected: %s",
|
2007-10-21 01:27:17 +00:00
|
|
|
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
|
|
|
|
2011-11-17 19:52:59 +00:00
|
|
|
#if defined(HAVE_LCD_BITMAP) && !defined(APPLICATION)
|
2004-06-30 13:31:14 +00:00
|
|
|
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;
|
2012-01-04 07:42:03 +00:00
|
|
|
splashf(HZ, "Screendump %sabled", do_screendump_instead_of_usb?"en":"dis");
|
2004-06-30 13:31:14 +00:00
|
|
|
return false;
|
|
|
|
}
|
2005-10-10 19:43:07 +00:00
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
2004-06-30 13:31:14 +00:00
|
|
|
|
2010-12-11 04:30:54 +00:00
|
|
|
extern bool write_metadata_log;
|
|
|
|
|
|
|
|
static bool dbg_metadatalog(void)
|
|
|
|
{
|
|
|
|
write_metadata_log = !write_metadata_log;
|
2012-01-04 07:42:03 +00:00
|
|
|
splashf(HZ, "Metadata log %sabled", write_metadata_log ? "en" : "dis");
|
2010-12-11 04:30:54 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
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
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
int fd = open("/internal_eeprom.bin", O_RDONLY);
|
2006-08-15 22:54:06 +00:00
|
|
|
|
|
|
|
if (fd >= 0)
|
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
char buf[EEPROM_SIZE];
|
|
|
|
int rc = read(fd, buf, EEPROM_SIZE);
|
2006-08-15 22:54:06 +00:00
|
|
|
|
|
|
|
if(rc == EEPROM_SIZE)
|
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
int old_irq_level = disable_irq_save();
|
2006-08-15 22:54:06 +00:00
|
|
|
|
2012-01-04 07:42:03 +00:00
|
|
|
int err = eeprom_24cxx_write(0, buf, sizeof buf);
|
2006-08-15 22:54:06 +00:00
|
|
|
if (err)
|
2008-08-15 08:27:39 +00:00
|
|
|
splashf(HZ*3, "Eeprom write failure (%d)", err);
|
2006-08-16 18:56:08 +00:00
|
|
|
else
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*3, "Eeprom written successfully");
|
2006-08-15 22:54:06 +00:00
|
|
|
|
2008-03-26 01:50:41 +00:00
|
|
|
restore_irq(old_irq_level);
|
2006-08-15 22:54:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-15 08:27:39 +00:00
|
|
|
splashf(HZ*3, "File read error (%d)",rc);
|
2006-08-15 22:54:06 +00:00
|
|
|
}
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(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 count = cpu_boost_log_getcount();
|
2012-01-04 07:42:03 +00:00
|
|
|
char *str = cpu_boost_log_getlog_first();
|
2007-01-22 10:41:25 +00:00
|
|
|
bool done;
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2012-01-04 07:42:03 +00:00
|
|
|
for (int i = 0; i < count ;)
|
2007-01-22 10:41:25 +00:00
|
|
|
{
|
|
|
|
lcd_clear_display();
|
2012-01-04 07:42:03 +00:00
|
|
|
for(int j=0; j<LCD_HEIGHT/SYSFONT_HEIGHT; j++,i++)
|
2007-01-22 10:41:25 +00:00
|
|
|
{
|
|
|
|
if (!str)
|
|
|
|
str = cpu_boost_log_getlog_next();
|
|
|
|
if (str)
|
|
|
|
{
|
2009-07-18 13:33:12 +00:00
|
|
|
if(strlen(str) > LCD_WIDTH/SYSFONT_WIDTH)
|
|
|
|
lcd_puts_scroll(0, j, str);
|
|
|
|
else
|
|
|
|
lcd_puts(0, j,str);
|
2007-01-22 10:41:25 +00:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-05-03 16:58:17 +00:00
|
|
|
lcd_stop_scroll();
|
2007-01-22 10:41:25 +00:00
|
|
|
get_action(CONTEXT_STD,TIMEOUT_BLOCK);
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2007-01-22 10:41:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
2002-07-15 11:23:24 +00:00
|
|
|
|
2010-08-23 19:56:17 +00:00
|
|
|
#if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
|
|
|
|
&& !defined(IPOD_MINI) && !defined(SIMULATOR))
|
2008-02-10 05:39:20 +00:00
|
|
|
extern bool wheel_is_touched;
|
|
|
|
extern int old_wheel_value;
|
|
|
|
extern int new_wheel_value;
|
|
|
|
extern int wheel_delta;
|
|
|
|
extern unsigned int accumulated_wheel_delta;
|
|
|
|
extern unsigned int wheel_velocity;
|
|
|
|
|
|
|
|
static bool dbg_scrollwheel(void)
|
|
|
|
{
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2008-02-10 05:39:20 +00:00
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
if (action_userabort(HZ/10))
|
2008-12-31 05:59:26 +00:00
|
|
|
break;
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2008-02-10 05:39:20 +00:00
|
|
|
lcd_clear_display();
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2008-02-10 05:39:20 +00:00
|
|
|
/* show internal variables of scrollwheel driver */
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, 0, "wheel touched: %s", (wheel_is_touched) ? "true" : "false");
|
|
|
|
lcd_putsf(0, 1, "new position: %2d", new_wheel_value);
|
|
|
|
lcd_putsf(0, 2, "old position: %2d", old_wheel_value);
|
|
|
|
lcd_putsf(0, 3, "wheel delta: %2d", wheel_delta);
|
|
|
|
lcd_putsf(0, 4, "accumulated delta: %2d", accumulated_wheel_delta);
|
|
|
|
lcd_putsf(0, 5, "velo [deg/s]: %4d", (int)wheel_velocity);
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2008-02-10 05:39:20 +00:00
|
|
|
/* show effective accelerated scrollspeed */
|
2012-01-04 07:42:03 +00:00
|
|
|
lcd_putsf(0, 6, "accel. speed: %4d",
|
2012-01-04 07:48:52 +00:00
|
|
|
button_apply_acceleration((1<<31)|(1<<24)|wheel_velocity) );
|
2008-02-10 05:56:35 +00:00
|
|
|
|
2008-02-10 05:39:20 +00:00
|
|
|
lcd_update();
|
|
|
|
}
|
2009-01-05 09:59:11 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2008-02-10 05:39:20 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
2007-04-29 15:31:43 +00:00
|
|
|
|
2012-01-04 07:42:03 +00:00
|
|
|
#ifdef HAVE_USBSTACK
|
2009-05-23 14:30:20 +00:00
|
|
|
#if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
|
2012-01-04 07:42:03 +00:00
|
|
|
static bool toggle_usb_serial(void)
|
2008-03-02 20:45:33 +00:00
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
bool enabled = !usb_core_driver_enabled(USB_DRIVER_SERIAL);
|
2009-04-19 21:17:18 +00:00
|
|
|
|
2012-01-04 07:42:03 +00:00
|
|
|
usb_core_enable_driver(USB_DRIVER_SERIAL, enabled);
|
|
|
|
splashf(HZ, "USB Serial %sabled", enabled ? "en" : "dis");
|
2009-04-19 21:17:18 +00:00
|
|
|
|
2008-03-02 20:45:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-04-19 21:17:18 +00:00
|
|
|
#endif
|
2008-03-02 20:45:33 +00:00
|
|
|
#endif
|
|
|
|
|
2008-05-03 14:43:43 +00:00
|
|
|
#if CONFIG_USBOTG == USBOTG_ISP1583
|
|
|
|
extern int dbg_usb_num_items(void);
|
2009-08-20 17:03:50 +00:00
|
|
|
extern const char* dbg_usb_item(int selected_item, void *data,
|
|
|
|
char *buffer, size_t buffer_len);
|
2008-05-03 14:43:43 +00:00
|
|
|
|
|
|
|
static int isp1583_action_callback(int action, struct gui_synclist *lists)
|
|
|
|
{
|
|
|
|
(void)lists;
|
|
|
|
if (action == ACTION_NONE)
|
|
|
|
action = ACTION_REDRAW;
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool dbg_isp1583(void)
|
|
|
|
{
|
|
|
|
struct simplelist_info isp1583;
|
2008-05-05 07:50:06 +00:00
|
|
|
isp1583.scroll_all = true;
|
2008-05-03 14:43:43 +00:00
|
|
|
simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL);
|
2008-07-17 18:36:47 +00:00
|
|
|
isp1583.timeout = HZ/100;
|
2008-05-03 14:43:43 +00:00
|
|
|
isp1583.hide_selection = true;
|
|
|
|
isp1583.get_name = dbg_usb_item;
|
|
|
|
isp1583.action_callback = isp1583_action_callback;
|
|
|
|
return simplelist_show_list(&isp1583);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-05-14 21:14:06 +00:00
|
|
|
#if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
|
2008-05-03 14:43:43 +00:00
|
|
|
extern int pic_dbg_num_items(void);
|
2009-08-20 17:03:50 +00:00
|
|
|
extern const char* pic_dbg_item(int selected_item, void *data,
|
|
|
|
char *buffer, size_t buffer_len);
|
2008-05-03 14:43:43 +00:00
|
|
|
|
|
|
|
static int pic_action_callback(int action, struct gui_synclist *lists)
|
|
|
|
{
|
|
|
|
(void)lists;
|
|
|
|
if (action == ACTION_NONE)
|
|
|
|
action = ACTION_REDRAW;
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool dbg_pic(void)
|
|
|
|
{
|
|
|
|
struct simplelist_info pic;
|
2008-05-05 07:50:06 +00:00
|
|
|
pic.scroll_all = true;
|
2008-05-03 14:43:43 +00:00
|
|
|
simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL);
|
2008-07-17 18:36:47 +00:00
|
|
|
pic.timeout = HZ/100;
|
2008-05-03 14:43:43 +00:00
|
|
|
pic.hide_selection = true;
|
|
|
|
pic.get_name = pic_dbg_item;
|
|
|
|
pic.action_callback = pic_action_callback;
|
|
|
|
return simplelist_show_list(&pic);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-04-29 15:31:43 +00:00
|
|
|
|
|
|
|
/****** The menu *********/
|
2012-01-04 07:42:03 +00:00
|
|
|
static const struct {
|
2007-04-29 15:31:43 +00:00
|
|
|
unsigned char *desc; /* string or ID */
|
|
|
|
bool (*function) (void); /* return true if USB was connected */
|
2012-01-04 07:42:03 +00:00
|
|
|
} menuitems[] = {
|
2007-02-23 23:22:03 +00:00
|
|
|
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
|
2009-10-16 16:08:11 +00:00
|
|
|
(defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD)) || \
|
2009-10-29 20:12:28 +00:00
|
|
|
CONFIG_CPU == IMX31L || defined(CPU_TCC780X)
|
2005-10-10 19:43:07 +00:00
|
|
|
{ "Dump ROM contents", dbg_save_roms },
|
2006-01-31 01:50:10 +00:00
|
|
|
#endif
|
2008-04-11 15:49:48 +00:00
|
|
|
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \
|
2009-02-26 21:24:40 +00:00
|
|
|
|| CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 \
|
2011-09-06 12:39:41 +00:00
|
|
|
|| CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2 \
|
|
|
|
|| CONFIG_CPU == RK27XX
|
2004-07-23 23:01:20 +00:00
|
|
|
{ "View I/O ports", dbg_ports },
|
2005-02-11 13:16:09 +00:00
|
|
|
#endif
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2008-02-10 05:39:20 +00:00
|
|
|
{ "View PCF registers", dbg_pcf },
|
|
|
|
#endif
|
2010-06-21 16:53:00 +00:00
|
|
|
#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2007-11-02 06:17:53 +00:00
|
|
|
{ "TSC2100 debug", tsc2100_debug },
|
|
|
|
#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
|
2011-01-22 16:58:17 +00:00
|
|
|
#if CONFIG_CPU == IMX31L
|
|
|
|
{ "DVFS/DPTC", __dbg_dvfs_dptc },
|
|
|
|
#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 },
|
2011-12-19 15:42:04 +00:00
|
|
|
#ifdef __linux__
|
|
|
|
{ "View CPU stats", dbg_cpuinfo },
|
|
|
|
#endif
|
2002-08-08 20:44:25 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2012-01-03 23:44:38 +00:00
|
|
|
#if (CONFIG_BATTERY_MEASURE != 0) && !defined(SIMULATOR)
|
2004-07-23 23:01:20 +00:00
|
|
|
{ "View battery", view_battery },
|
2006-10-04 07:29:50 +00:00
|
|
|
#endif
|
2011-11-17 19:52:59 +00:00
|
|
|
#ifndef APPLICATION
|
2004-07-23 23:01:20 +00:00
|
|
|
{ "Screendump", dbg_screendump },
|
2002-07-22 16:39:17 +00:00
|
|
|
#endif
|
2011-11-17 19:52:59 +00:00
|
|
|
#endif
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2004-07-23 23:01:20 +00:00
|
|
|
{ "View HW info", dbg_hw_info },
|
2006-10-04 07:29:50 +00:00
|
|
|
#endif
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2004-07-23 23:01:20 +00:00
|
|
|
{ "View partitions", dbg_partitions },
|
2006-10-04 07:29:50 +00:00
|
|
|
#endif
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2004-07-23 23:01:20 +00:00
|
|
|
{ "View disk info", dbg_disk_info },
|
2008-11-01 16:14:28 +00:00
|
|
|
#if (CONFIG_STORAGE & STORAGE_ATA)
|
2008-02-27 22:52:18 +00:00
|
|
|
{ "Dump ATA identify info", dbg_identify_info},
|
|
|
|
#endif
|
2004-09-28 06:23:57 +00:00
|
|
|
#endif
|
2010-12-11 04:30:54 +00:00
|
|
|
{ "Metadata log", dbg_metadatalog },
|
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
|
2007-10-25 21:27:45 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
{ "View buffering thread", dbg_buffering_thread },
|
|
|
|
#elif !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 */
|
2011-08-30 14:01:33 +00:00
|
|
|
{ "View buflib allocs", dbg_buflib_allocs },
|
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
|
2008-05-03 14:43:43 +00:00
|
|
|
#if CONFIG_USBOTG == USBOTG_ISP1583
|
|
|
|
{ "View ISP1583 info", dbg_isp1583 },
|
|
|
|
#endif
|
2008-05-14 21:14:06 +00:00
|
|
|
#if defined(CREATIVE_ZVx) && !defined(SIMULATOR)
|
2008-05-03 14:43:43 +00:00
|
|
|
{ "View PIC info", dbg_pic },
|
|
|
|
#endif
|
2005-05-30 13:00:43 +00:00
|
|
|
#ifdef ROCKBOX_HAS_LOGF
|
2009-11-23 00:19:22 +00:00
|
|
|
{"Show Log File", logfdisplay },
|
|
|
|
{"Dump Log File", logfdump },
|
2007-01-22 10:41:25 +00:00
|
|
|
#endif
|
2009-04-19 21:17:18 +00:00
|
|
|
#if defined(HAVE_USBSTACK)
|
2009-05-23 14:30:20 +00:00
|
|
|
#if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
|
2009-04-19 21:17:18 +00:00
|
|
|
{"USB Serial driver (logf)", toggle_usb_serial },
|
2008-03-02 20:45:33 +00:00
|
|
|
#endif
|
2009-04-19 21:17:18 +00:00
|
|
|
#endif /* HAVE_USBSTACK */
|
2007-01-22 10:41:25 +00:00
|
|
|
#ifdef CPU_BOOST_LOGGING
|
|
|
|
{"cpu_boost log",cpu_boost_log},
|
2008-02-10 05:39:20 +00:00
|
|
|
#endif
|
2010-08-23 19:56:17 +00:00
|
|
|
#if (defined(HAVE_WHEEL_ACCELERATION) && (CONFIG_KEYPAD==IPOD_4G_PAD) \
|
|
|
|
&& !defined(IPOD_MINI) && !defined(SIMULATOR))
|
2009-04-19 21:17:18 +00:00
|
|
|
{"Debug scrollwheel", dbg_scrollwheel },
|
2004-02-04 09:53:22 +00:00
|
|
|
#endif
|
2012-01-04 07:42:03 +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
|
|
|
{
|
2011-11-15 13:22:02 +00:00
|
|
|
int selection = gui_synclist_get_sel_pos(lists);
|
2007-04-29 15:31:43 +00:00
|
|
|
if (btn == ACTION_STD_OK)
|
|
|
|
{
|
2009-12-09 07:25:46 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
viewportmanager_theme_enable(i, false, NULL);
|
2011-11-15 13:22:02 +00:00
|
|
|
menuitems[selection].function();
|
2007-10-20 12:32:55 +00:00
|
|
|
btn = ACTION_REDRAW;
|
2009-12-09 07:25:46 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
2009-12-21 05:19:12 +00:00
|
|
|
viewportmanager_theme_undo(i, false);
|
2007-04-29 15:31:43 +00:00
|
|
|
}
|
2011-11-15 13:22:02 +00:00
|
|
|
else if (btn == ACTION_STD_CONTEXT)
|
|
|
|
{
|
|
|
|
MENUITEM_STRINGLIST(menu_items, "Debug Menu", NULL, ID2P(LANG_ADD_TO_FAVES));
|
|
|
|
if (do_menu(&menu_items, NULL, NULL, false) == 0)
|
|
|
|
shortcuts_add(SHORTCUT_DEBUGITEM, menuitems[selection].desc);
|
|
|
|
return ACTION_STD_CANCEL;
|
|
|
|
}
|
2007-04-29 15:31:43 +00:00
|
|
|
return btn;
|
|
|
|
}
|
2009-08-20 16:47:44 +00:00
|
|
|
|
2012-01-04 07:42:03 +00:00
|
|
|
static const char* menu_get_name(int item, void * data,
|
2009-08-20 16:47:44 +00:00
|
|
|
char *buffer, size_t buffer_len)
|
2007-04-29 15:31:43 +00:00
|
|
|
{
|
2008-04-09 15:25:17 +00:00
|
|
|
(void)data; (void)buffer; (void)buffer_len;
|
2007-04-29 15:31:43 +00:00
|
|
|
return menuitems[item].desc;
|
|
|
|
}
|
2009-08-20 16:47:44 +00:00
|
|
|
|
2007-04-29 15:31:43 +00:00
|
|
|
bool debug_menu(void)
|
|
|
|
{
|
2007-10-20 12:32:55 +00:00
|
|
|
struct simplelist_info info;
|
2008-02-10 05:56:35 +00:00
|
|
|
|
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;
|
2012-01-04 07:42:03 +00:00
|
|
|
info.get_name = menu_get_name;
|
2007-10-20 12:32:55 +00:00
|
|
|
return simplelist_show_list(&info);
|
2002-07-15 11:23:24 +00:00
|
|
|
}
|
2011-11-15 13:22:02 +00:00
|
|
|
|
|
|
|
bool run_debug_screen(char* screen)
|
|
|
|
{
|
2012-01-04 07:42:03 +00:00
|
|
|
for (unsigned i=0; i<ARRAYLEN(menuitems); i++)
|
2011-11-15 13:22:02 +00:00
|
|
|
if (!strcmp(screen, menuitems[i].desc))
|
|
|
|
{
|
|
|
|
FOR_NB_SCREENS(j)
|
|
|
|
viewportmanager_theme_enable(j, false, NULL);
|
|
|
|
menuitems[i].function();
|
|
|
|
FOR_NB_SCREENS(j)
|
|
|
|
viewportmanager_theme_undo(j, false);
|
|
|
|
return true;
|
|
|
|
}
|
2012-01-04 07:42:03 +00:00
|
|
|
|
2011-11-15 13:22:02 +00:00
|
|
|
return false;
|
|
|
|
}
|