Revise r23225 a bit, removing the debug_printf function and implementing more generic lcd_(remote)_putsf function(s) instead and use those in more places

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23233 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nils Wallménius 2009-10-17 18:02:48 +00:00
parent 5ca76ab9c4
commit f34a841b0c
18 changed files with 366 additions and 413 deletions

View file

@ -41,14 +41,14 @@
#include "splash.h"
#include "viewport.h"
static void speak_time(int hours, int minutes, bool speak_hours)
static void speak_time(int hours, int minutes, bool speak_hours, bool enqueue)
{
if (global_settings.talk_menu){
if(speak_hours) {
talk_value(hours, UNIT_HOUR, false);
talk_value(hours, UNIT_HOUR, enqueue);
talk_value(minutes, UNIT_MIN, true);
} else {
talk_value(minutes, UNIT_MIN, false);
talk_value(minutes, UNIT_MIN, enqueue);
}
}
}
@ -57,7 +57,6 @@ bool alarm_screen(void)
{
int h, m;
bool done = false;
char buf[32];
struct tm *tm;
int togo;
int button;
@ -90,19 +89,14 @@ bool alarm_screen(void)
screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS));
}
/* Talk when entering the wakeup screen */
if (global_settings.talk_menu)
{
talk_value(h, UNIT_HOUR, true);
talk_value(m, UNIT_MIN, true);
}
speak_time(h, m, true, true);
update = false;
}
snprintf(buf, 32, str(LANG_ALARM_MOD_TIME), h, m);
FOR_NB_SCREENS(i)
{
screens[i].set_viewport(&vp[i]);
screens[i].puts(0, 1, buf);
screens[i].putsf(0, 1, str(LANG_ALARM_MOD_TIME), h, m);
screens[i].update_viewport();
screens[i].set_viewport(NULL);
}
@ -147,7 +141,7 @@ bool alarm_screen(void)
if (h == 24)
h = 0;
speak_time(h, m, hour_wrapped);
speak_time(h, m, hour_wrapped, false);
break;
/* dec(m) */
@ -162,7 +156,7 @@ bool alarm_screen(void)
if (h == -1)
h = 23;
speak_time(h, m, hour_wrapped);
speak_time(h, m, hour_wrapped, false);
break;
/* inc(h) */

View file

@ -122,17 +122,6 @@
#include "usb_core.h"
#endif
/* wrapper function to format a string and print it */
void debug_printf(int y, const unsigned char *fmt, ...)
{
va_list ap;
char buf[128];
va_start(ap, fmt);
vsnprintf(buf, sizeof (buf), fmt, ap);
va_end(ap);
lcd_puts(0, y, buf);
}
/*---------------------------------------------------*/
/* SPECIAL DEBUG STUFF */
/*---------------------------------------------------*/
@ -258,12 +247,12 @@ static bool dbg_audio_thread(void)
lcd_clear_display();
debug_printf(0, "read: %x", d.audiobuf_read);
debug_printf(1, "write: %x", d.audiobuf_write);
debug_printf(2, "swap: %x", d.audiobuf_swapwrite);
debug_printf(3, "playing: %d", d.playing);
debug_printf(4, "playable: %x", d.playable_space);
debug_printf(5, "unswapped: %x", d.unswapped_space);
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);
/* Playable space left */
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8, 112, 4, d.audiobuflen, 0,
@ -273,7 +262,7 @@ static bool dbg_audio_thread(void)
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8+4, 112, 4, d.audiobuflen, 0,
d.low_watermark_level, HORIZONTAL);
debug_printf(7, "wm: %x - %x",
lcd_putsf(0, 7, "wm: %x - %x",
d.low_watermark_level, d.lowest_watermark_level);
lcd_update();
@ -336,13 +325,13 @@ static bool dbg_buffering_thread(void)
bufused = bufsize - pcmbuf_free();
debug_printf(line++, "pcm: %6ld/%ld", (long) bufused, (long) bufsize);
lcd_putsf(0, line++, "pcm: %6ld/%ld", (long) bufused, (long) bufsize);
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6,
bufsize, 0, bufused, HORIZONTAL);
line++;
debug_printf(line++, "alloc: %6ld/%ld", audio_filebufused(),
lcd_putsf(0, line++, "alloc: %6ld/%ld", audio_filebufused(),
(long) filebuflen);
#if LCD_HEIGHT > 80
@ -350,7 +339,7 @@ static bool dbg_buffering_thread(void)
filebuflen, 0, audio_filebufused(), HORIZONTAL);
line++;
debug_printf(line++, "real: %6ld/%ld", (long)d.buffered_data,
lcd_putsf(0, line++, "real: %6ld/%ld", (long)d.buffered_data,
(long)filebuflen);
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6,
@ -358,7 +347,7 @@ static bool dbg_buffering_thread(void)
line++;
#endif
debug_printf(line++, "usefl: %6ld/%ld", (long)(d.useful_data),
lcd_putsf(0, line++, "usefl: %6ld/%ld", (long)(d.useful_data),
(long)filebuflen);
#if LCD_HEIGHT > 80
@ -367,14 +356,14 @@ static bool dbg_buffering_thread(void)
line++;
#endif
debug_printf(line++, "data_rem: %ld", (long)d.data_rem);
lcd_putsf(0, line++, "data_rem: %ld", (long)d.data_rem);
debug_printf(line++, "track count: %2d", audio_track_count());
lcd_putsf(0, line++, "track count: %2d", audio_track_count());
debug_printf(line++, "handle count: %d", (int)d.num_handles);
lcd_putsf(0, line++, "handle count: %d", (int)d.num_handles);
#ifndef SIMULATOR
debug_printf(line++, "cpu freq: %3dMHz",
lcd_putsf(0, line++, "cpu freq: %3dMHz",
(int)((FREQ + 500000) / 1000000));
#endif
@ -382,13 +371,13 @@ static bool dbg_buffering_thread(void)
{
int boostquota = boost_ticks * 1000 / ticks; /* in 0.1 % */
int avgclock = freq_sum * 10 / ticks; /* in 100 kHz */
debug_printf(line++, "boost:%3d.%d%% (%d.%dMHz)",
lcd_putsf(0, line++, "boost:%3d.%d%% (%d.%dMHz)",
boostquota/10, boostquota%10, avgclock/10, avgclock%10);
}
debug_printf(line++, "pcmbufdesc: %2d/%2d",
lcd_putsf(0, line++, "pcmbufdesc: %2d/%2d",
pcmbuf_used_descs(), pcmbufdescs);
debug_printf(line++, "watermark: %6d",
lcd_putsf(0, line++, "watermark: %6d",
(int)(d.watermark));
lcd_update();
@ -530,12 +519,12 @@ static bool dbg_hw_info(void)
lcd_puts(0, 0, "[Hardware info]");
debug_printf(1, "ROM: %d.%02d", rom_version/100, rom_version%100);
lcd_putsf(0, 1, "ROM: %d.%02d", rom_version/100, rom_version%100);
debug_printf(2, "Mask: 0x%04x", bitmask);
lcd_putsf(0, 2, "Mask: 0x%04x", bitmask);
if (got_id)
debug_printf(3, "Flash: M=%02x D=%02x", manu, id);
lcd_putsf(0, 3, "Flash: M=%02x D=%02x", manu, id);
else
lcd_puts(0, 3, "Flash: M=?? D=??"); /* unknown, sorry */
@ -544,7 +533,7 @@ static bool dbg_hw_info(void)
if (rom_crc == 0x56DBA4EE) /* known Version 1 */
lcd_puts(0, 4, "Boot ROM: V1");
else
debug_printf(4, "ROMcrc: 0x%08x", rom_crc);
lcd_putsf(0, 4, "ROMcrc: 0x%08x", rom_crc);
}
else
{
@ -576,7 +565,7 @@ static bool dbg_hw_info(void)
lcd_puts(0, line++, "[Hardware info]");
if (got_id)
debug_printf(line++, "Flash: M=%04x D=%04x", manu, id);
lcd_putsf(0, line++, "Flash: M=%04x D=%04x", manu, id);
else
lcd_puts(0, line++, "Flash: M=???? D=????"); /* unknown, sorry */
@ -590,15 +579,15 @@ static bool dbg_hw_info(void)
if (got_id == DS2411_OK)
{
debug_printf(++line, " FC=%02x", (unsigned)id.family_code);
debug_printf(++line, " ID=%02X %02X %02X %02X %02X %02X",
lcd_putsf(0, ++line, " FC=%02x", (unsigned)id.family_code);
lcd_putsf(0, ++line, " ID=%02X %02X %02X %02X %02X %02X",
(unsigned)id.uid[0], (unsigned)id.uid[1], (unsigned)id.uid[2],
(unsigned)id.uid[3], (unsigned)id.uid[4], (unsigned)id.uid[5]);
debug_printf(++line, " CRC=%02X", (unsigned)id.crc);
lcd_putsf(0, ++line, " CRC=%02X", (unsigned)id.crc);
}
else
{
debug_printf(++line, "READ ERR=%d", got_id);
lcd_putsf(0, ++line, "READ ERR=%d", got_id);
}
}
#endif
@ -620,18 +609,18 @@ static bool dbg_hw_info(void)
lcd_puts(0, line++, "[Hardware info]");
#ifdef IPOD_ARCH
debug_printf(line++, "HW rev: 0x%08lx", IPOD_HW_REVISION);
lcd_putsf(0, line++, "HW rev: 0x%08lx", IPOD_HW_REVISION);
#endif
#ifdef IPOD_COLOR
extern int lcd_type; /* Defined in lcd-colornano.c */
debug_printf(line++, "LCD type: %d", lcd_type);
lcd_putsf(0, line++, "LCD type: %d", lcd_type);
#endif
debug_printf(line++, "PP version: %s", pp_version);
lcd_putsf(0, line++, "PP version: %s", pp_version);
debug_printf(line++, "Est. clock (kHz): %d", perfcheck());
lcd_putsf(0, line++, "Est. clock (kHz): %d", perfcheck());
lcd_update();
@ -651,12 +640,12 @@ static bool dbg_hw_info(void)
lcd_puts(0, line++, "[Hardware info]");
#ifdef IPOD_ARCH
debug_printf(line++, "HW rev: 0x%08lx", IPOD_HW_REVISION);
lcd_putsf(0, line++, "HW rev: 0x%08lx", IPOD_HW_REVISION);
#endif
debug_printf(line++, "PP version: %s", pp_version);
lcd_putsf(0, line++, "PP version: %s", pp_version);
debug_printf(line++, "Est. clock (kHz): %d", perfcheck());
lcd_putsf(0, line++, "Est. clock (kHz): %d", perfcheck());
lcd_update();
@ -706,12 +695,12 @@ static bool dbg_hw_info(void)
switch(currval)
{
case 0:
debug_printf(1, "ROM: %d.%02d",
lcd_putsf(0, 1, "ROM: %d.%02d",
rom_version/100, rom_version%100);
break;
case 1:
if (got_id)
debug_printf(1, "Flash:%02x,%02x", manu, id);
lcd_putsf(0, 1, "Flash:%02x,%02x", manu, id);
else
lcd_puts(0, 1, "Flash:??,??"); /* unknown, sorry */
break;
@ -724,7 +713,7 @@ static bool dbg_hw_info(void)
lcd_puts(0, 1, "BootROM: V2");
/* alternative boot ROM found in one single player so far */
else
debug_printf(1, "R: %08x", rom_crc);
lcd_putsf(0, 1, "R: %08x", rom_crc);
}
else
lcd_puts(0, 1, "BootROM: no");
@ -822,25 +811,25 @@ static bool dbg_spdif(void)
symbolerr = (interruptstat & 0x00800000)?true:false;
parityerr = (interruptstat & 0x00400000)?true:false;
debug_printf(line++, "Val: %s Sym: %s Par: %s",
lcd_putsf(0, line++, "Val: %s Sym: %s Par: %s",
valnogood?"--":"OK",
symbolerr?"--":"OK",
parityerr?"--":"OK");
debug_printf(line++, "Status word: %08x", (int)control);
lcd_putsf(0, line++, "Status word: %08x", (int)control);
line++;
x = control >> 31;
debug_printf(line++, "PRO: %d (%s)",
lcd_putsf(0, line++, "PRO: %d (%s)",
x, x?"Professional":"Consumer");
x = (control >> 30) & 1;
debug_printf(line++, "Audio: %d (%s)",
lcd_putsf(0, line++, "Audio: %d (%s)",
x, x?"Non-PCM":"PCM");
x = (control >> 29) & 1;
debug_printf(line++, "Copy: %d (%s)",
lcd_putsf(0, line++, "Copy: %d (%s)",
x, x?"Permitted":"Inhibited");
x = (control >> 27) & 7;
@ -856,10 +845,10 @@ static bool dbg_spdif(void)
s = "Reserved";
break;
}
debug_printf(line++, "Preemphasis: %d (%s)", x, s);
lcd_putsf(0, line++, "Preemphasis: %d (%s)", x, s);
x = (control >> 24) & 3;
debug_printf(line++, "Mode: %d", x);
lcd_putsf(0, line++, "Mode: %d", x);
category = (control >> 17) & 127;
switch(category)
@ -873,7 +862,7 @@ static bool dbg_spdif(void)
default:
s = "Unknown";
}
debug_printf(line++, "Category: 0x%02x (%s)", category, s);
lcd_putsf(0, line++, "Category: 0x%02x (%s)", category, s);
x = (control >> 16) & 1;
generation = x;
@ -883,11 +872,11 @@ static bool dbg_spdif(void)
{
generation = !generation;
}
debug_printf(line++, "Generation: %d (%s)",
lcd_putsf(0, line++, "Generation: %d (%s)",
x, generation?"Original":"No ind.");
x = (control >> 12) & 15;
debug_printf(line++, "Source: %d", x);
lcd_putsf(0, line++, "Source: %d", x);
x = (control >> 8) & 15;
@ -906,7 +895,7 @@ static bool dbg_spdif(void)
s = "";
break;
}
debug_printf(line++, "Channel: %d (%s)", x, s);
lcd_putsf(0, line++, "Channel: %d (%s)", x, s);
x = (control >> 4) & 15;
switch(x)
@ -921,14 +910,14 @@ static bool dbg_spdif(void)
s = "32kHz";
break;
}
debug_printf(line++, "Frequency: %d (%s)", x, s);
lcd_putsf(0, line++, "Frequency: %d (%s)", x, s);
x = (control >> 2) & 3;
debug_printf(line++, "Clock accuracy: %d", x);
lcd_putsf(0, line++, "Clock accuracy: %d", x);
line++;
#ifndef SIMULATOR
debug_printf(line++, "Measured freq: %ldHz",
lcd_putsf(0, line++, "Measured freq: %ldHz",
spdif_measure_frequency());
#endif
@ -1008,16 +997,16 @@ bool dbg_ports(void)
while(1)
{
debug_printf(0, "PADR: %04x", (unsigned short)PADR);
debug_printf(1, "PBDR: %04x", (unsigned short)PBDR);
lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR);
lcd_putsf(0, 1, "PBDR: %04x", (unsigned short)PBDR);
debug_printf(2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
debug_printf(3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
debug_printf(4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
debug_printf(5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
lcd_putsf(0, 2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
lcd_putsf(0, 3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
lcd_putsf(0, 4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
lcd_putsf(0, 5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
battery_read_info(&adc_battery_voltage, &adc_battery_level);
debug_printf(6, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
lcd_putsf(0, 6, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
adc_battery_voltage % 1000, adc_battery_level);
lcd_update();
@ -1055,41 +1044,41 @@ bool dbg_ports(void)
gpio_enable = GPIO_ENABLE;
gpio1_enable = GPIO1_ENABLE;
debug_printf(line++, "GPIO_READ: %08x", gpio_read);
debug_printf(line++, "GPIO_OUT: %08x", gpio_out);
debug_printf(line++, "GPIO_FUNC: %08x", gpio_function);
debug_printf(line++, "GPIO_ENA: %08x", gpio_enable);
lcd_putsf(0, line++, "GPIO_READ: %08x", gpio_read);
lcd_putsf(0, line++, "GPIO_OUT: %08x", gpio_out);
lcd_putsf(0, line++, "GPIO_FUNC: %08x", gpio_function);
lcd_putsf(0, line++, "GPIO_ENA: %08x", gpio_enable);
debug_printf(line++, "GPIO1_READ: %08x", gpio1_read);
debug_printf(line++, "GPIO1_OUT: %08x", gpio1_out);
debug_printf(line++, "GPIO1_FUNC: %08x", gpio1_function);
debug_printf(line++, "GPIO1_ENA: %08x", gpio1_enable);
lcd_putsf(0, line++, "GPIO1_READ: %08x", gpio1_read);
lcd_putsf(0, line++, "GPIO1_OUT: %08x", gpio1_out);
lcd_putsf(0, line++, "GPIO1_FUNC: %08x", gpio1_function);
lcd_putsf(0, line++, "GPIO1_ENA: %08x", gpio1_enable);
adc_buttons = adc_read(ADC_BUTTONS);
adc_remote = adc_read(ADC_REMOTE);
battery_read_info(&adc_battery_voltage, &adc_battery_level);
#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
debug_printf(line++, "ADC_BUTTONS (%c): %02x",
lcd_putsf(0, line++, "ADC_BUTTONS (%c): %02x",
button_scan_enabled() ? '+' : '-', adc_buttons);
#else
debug_printf(line++, "ADC_BUTTONS: %02x", adc_buttons);
lcd_putsf(0, line++, "ADC_BUTTONS: %02x", adc_buttons);
#endif
#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
debug_printf(line++, "ADC_REMOTE (%c): %02x",
lcd_putsf(0, line++, "ADC_REMOTE (%c): %02x",
remote_detect() ? '+' : '-', adc_remote);
#else
debug_printf(line++, "ADC_REMOTE: %02x", adc_remote);
lcd_putsf(0, line++, "ADC_REMOTE: %02x", adc_remote);
#endif
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
debug_printf(line++, "ADC_REMOTEDETECT: %02x",
lcd_putsf(0, line++, "ADC_REMOTEDETECT: %02x",
adc_read(ADC_REMOTEDETECT));
#endif
debug_printf(line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
lcd_putsf(0, line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
adc_battery_voltage % 1000, adc_battery_level);
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
debug_printf(line++, "remotetype: %d", remote_type());
lcd_putsf(0, line++, "remotetype: %d", remote_type());
#endif
lcd_update();
@ -1110,66 +1099,66 @@ bool dbg_ports(void)
{
line = 0;
lcd_puts(0, line++, "GPIO STATES:");
debug_printf(line++, "A: %02x E: %02x I: %02x",
lcd_putsf(0, line++, "A: %02x E: %02x I: %02x",
(unsigned int)GPIOA_INPUT_VAL,
(unsigned int)GPIOE_INPUT_VAL,
(unsigned int)GPIOI_INPUT_VAL);
debug_printf(line++, "B: %02x F: %02x J: %02x",
lcd_putsf(0, line++, "B: %02x F: %02x J: %02x",
(unsigned int)GPIOB_INPUT_VAL,
(unsigned int)GPIOF_INPUT_VAL,
(unsigned int)GPIOJ_INPUT_VAL);
debug_printf(line++, "C: %02x G: %02x K: %02x",
lcd_putsf(0, line++, "C: %02x G: %02x K: %02x",
(unsigned int)GPIOC_INPUT_VAL,
(unsigned int)GPIOG_INPUT_VAL,
(unsigned int)GPIOK_INPUT_VAL);
debug_printf(line++, "D: %02x H: %02x L: %02x",
lcd_putsf(0, line++, "D: %02x H: %02x L: %02x",
(unsigned int)GPIOD_INPUT_VAL,
(unsigned int)GPIOH_INPUT_VAL,
(unsigned int)GPIOL_INPUT_VAL);
line++;
debug_printf(line++, "GPO32_VAL: %08lx", GPO32_VAL);
debug_printf(line++, "GPO32_EN: %08lx", GPO32_ENABLE);
debug_printf(line++, "DEV_EN: %08lx", DEV_EN);
debug_printf(line++, "DEV_EN2: %08lx", DEV_EN2);
debug_printf(line++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */
debug_printf(line++, "DEV_INIT1: %08lx", DEV_INIT1);
debug_printf(line++, "DEV_INIT2: %08lx", DEV_INIT2);
lcd_putsf(0, line++, "GPO32_VAL: %08lx", GPO32_VAL);
lcd_putsf(0, line++, "GPO32_EN: %08lx", GPO32_ENABLE);
lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
lcd_putsf(0, line++, "DEV_EN2: %08lx", DEV_EN2);
lcd_putsf(0, line++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */
lcd_putsf(0, line++, "DEV_INIT1: %08lx", DEV_INIT1);
lcd_putsf(0, line++, "DEV_INIT2: %08lx", DEV_INIT2);
#ifdef ADC_ACCESSORY
debug_printf(line++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY));
lcd_putsf(0, line++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY));
#endif
#if defined(IPOD_ACCESSORY_PROTOCOL)
extern unsigned char serbuf[];
debug_printf(line++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
lcd_putsf(0, line++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
serbuf[0], serbuf[1], serbuf[2], serbuf[3], serbuf[4], serbuf[5],
serbuf[6], serbuf[7]);
#endif
#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
line++;
debug_printf(line++, "BATT: %03x UNK1: %03x",
lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
debug_printf(line++, "REM: %03x PAD: %03x",
lcd_putsf(0, line++, "REM: %03x PAD: %03x",
adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD));
#elif defined(PHILIPS_HDD1630)
line++;
debug_printf(line++, "BATT: %03x UNK1: %03x",
lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
#elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
debug_printf(line++, "ADC_BVDD: %4d", adc_read(ADC_BVDD));
debug_printf(line++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP));
debug_printf(line++, "ADC_UVDD: %4d", adc_read(ADC_UVDD));
debug_printf(line++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN));
debug_printf(line++, "ADC_CVDD: %4d", adc_read(ADC_CVDD));
debug_printf(line++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP));
debug_printf(line++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1));
debug_printf(line++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2));
debug_printf(line++, "ADC_VBE1: %4d", adc_read(ADC_VBE1));
debug_printf(line++, "ADC_VBE2: %4d", adc_read(ADC_VBE2));
debug_printf(line++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1));
lcd_putsf(0, line++, "ADC_BVDD: %4d", adc_read(ADC_BVDD));
lcd_putsf(0, line++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP));
lcd_putsf(0, line++, "ADC_UVDD: %4d", adc_read(ADC_UVDD));
lcd_putsf(0, line++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN));
lcd_putsf(0, line++, "ADC_CVDD: %4d", adc_read(ADC_CVDD));
lcd_putsf(0, line++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP));
lcd_putsf(0, line++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1));
lcd_putsf(0, line++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2));
lcd_putsf(0, line++, "ADC_VBE1: %4d", adc_read(ADC_VBE1));
lcd_putsf(0, line++, "ADC_VBE2: %4d", adc_read(ADC_VBE2));
lcd_putsf(0, line++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1));
#if !defined(PHILIPS_SA9200)
debug_printf(line++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2));
debug_printf(line++, "ADC_VBAT: %4d", adc_read(ADC_VBAT));
lcd_putsf(0, line++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2));
lcd_putsf(0, line++, "ADC_VBAT: %4d", adc_read(ADC_VBAT));
#endif
#endif
lcd_update();
@ -1189,19 +1178,19 @@ extern unsigned char serbuf[];
while(1)
{
line = 0;
debug_printf(line++, "GPIO_A: %02x GPIO_B: %02x",
lcd_putsf(0, line++, "GPIO_A: %02x GPIO_B: %02x",
(unsigned int)GPIOA_INPUT_VAL, (unsigned int)GPIOB_INPUT_VAL);
debug_printf(line++, "GPIO_C: %02x GPIO_D: %02x",
lcd_putsf(0, line++, "GPIO_C: %02x GPIO_D: %02x",
(unsigned int)GPIOC_INPUT_VAL, (unsigned int)GPIOD_INPUT_VAL);
debug_printf(line++, "DEV_EN: %08lx", DEV_EN);
debug_printf(line++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE);
debug_printf(line++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE);
debug_printf(line++, "PLL_CONTROL: %08lx", PLL_CONTROL);
debug_printf(line++, "PLL_DIV: %08lx", PLL_DIV);
debug_printf(line++, "PLL_MULT: %08lx", PLL_MULT);
debug_printf(line++, "TIMING1_CTL: %08lx", TIMING1_CTL);
debug_printf(line++, "TIMING2_CTL: %08lx", TIMING2_CTL);
lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
lcd_putsf(0, line++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE);
lcd_putsf(0, line++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE);
lcd_putsf(0, line++, "PLL_CONTROL: %08lx", PLL_CONTROL);
lcd_putsf(0, line++, "PLL_DIV: %08lx", PLL_DIV);
lcd_putsf(0, line++, "PLL_MULT: %08lx", PLL_MULT);
lcd_putsf(0, line++, "TIMING1_CTL: %08lx", TIMING1_CTL);
lcd_putsf(0, line++, "TIMING2_CTL: %08lx", TIMING2_CTL);
lcd_update();
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
@ -1264,7 +1253,7 @@ bool dbg_ports(void)
lcd_puts(0, 0, buf);
battery_read_info(&adc_battery_voltage, NULL);
debug_printf(1, "Batt: %d.%03dV", adc_battery_voltage / 1000,
lcd_putsf(0, 1, "Batt: %d.%03dV", adc_battery_voltage / 1000,
adc_battery_voltage % 1000);
lcd_update();
@ -1307,19 +1296,19 @@ static bool dbg_pcf(void)
{
line = 0;
debug_printf(line++, "DCDC1: %02x", pcf50605_read(0x1b));
debug_printf(line++, "DCDC2: %02x", pcf50605_read(0x1c));
debug_printf(line++, "DCDC3: %02x", pcf50605_read(0x1d));
debug_printf(line++, "DCDC4: %02x", pcf50605_read(0x1e));
debug_printf(line++, "DCDEC1: %02x", pcf50605_read(0x1f));
debug_printf(line++, "DCDEC2: %02x", pcf50605_read(0x20));
debug_printf(line++, "DCUDC1: %02x", pcf50605_read(0x21));
debug_printf(line++, "DCUDC2: %02x", pcf50605_read(0x22));
debug_printf(line++, "IOREGC: %02x", pcf50605_read(0x23));
debug_printf(line++, "D1REGC: %02x", pcf50605_read(0x24));
debug_printf(line++, "D2REGC: %02x", pcf50605_read(0x25));
debug_printf(line++, "D3REGC: %02x", pcf50605_read(0x26));
debug_printf(line++, "LPREG1: %02x", pcf50605_read(0x27));
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));
lcd_update();
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
{
@ -1348,8 +1337,8 @@ static bool dbg_cpufreq(void)
{
line = 0;
debug_printf(line++, "Frequency: %ld", FREQ);
debug_printf(line++, "boost_counter: %d", get_cpu_boost_counter());
lcd_putsf(0, line++, "Frequency: %ld", FREQ);
lcd_putsf(0, line++, "boost_counter: %d", get_cpu_boost_counter());
lcd_update();
button = get_action(CONTEXT_STD,HZ/10);
@ -1484,9 +1473,9 @@ static bool view_battery(void)
minv = power_history[i];
}
debug_printf(0, "Battery %d.%03d", power_history[0] / 1000,
lcd_putsf(0, 0, "Battery %d.%03d", power_history[0] / 1000,
power_history[0] % 1000);
debug_printf(1, "scale %d.%03d-%d.%03dV",
lcd_putsf(0, 1, "scale %d.%03d-%d.%03dV",
minv / 1000, minv % 1000, maxv / 1000, maxv % 1000);
x = 0;
@ -1506,23 +1495,23 @@ static bool view_battery(void)
lcd_puts(0, 0, "Power status:");
battery_read_info(&y, NULL);
debug_printf(1, "Battery: %d.%03d V", y / 1000, y % 1000);
lcd_putsf(0, 1, "Battery: %d.%03d V", y / 1000, y % 1000);
#ifdef ADC_EXT_POWER
y = (adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 1000;
debug_printf(2, "External: %d.%03d V", y / 1000, y % 1000);
lcd_putsf(0, 2, "External: %d.%03d V", y / 1000, y % 1000);
#endif
#if CONFIG_CHARGING
#if defined ARCHOS_RECORDER
debug_printf(3, "Chgr: %s %s",
lcd_putsf(0, 3, "Chgr: %s %s",
charger_inserted() ? "present" : "absent",
charger_enabled() ? "on" : "off");
debug_printf(5, "short delta: %d", short_delta);
debug_printf(6, "long delta: %d", long_delta);
lcd_putsf(0, 5, "short delta: %d", short_delta);
lcd_putsf(0, 6, "long delta: %d", long_delta);
lcd_puts(0, 7, power_message);
debug_printf(8, "USB Inserted: %s",
lcd_putsf(0, 8, "USB Inserted: %s",
usb_inserted() ? "yes" : "no");
#elif defined IRIVER_H300_SERIES
debug_printf(9, "USB Charging Enabled: %s",
lcd_putsf(0, 9, "USB Charging Enabled: %s",
usb_charging_enabled() ? "yes" : "no");
#elif defined IPOD_NANO || defined IPOD_VIDEO
int usb_pwr = (GPIOL_INPUT_VAL & 0x10)?true:false;
@ -1531,15 +1520,15 @@ static bool view_battery(void)
int charging = (GPIOB_INPUT_VAL & 0x01)?false:true;
int headphone= (GPIOA_INPUT_VAL & 0x80)?true:false;
debug_printf(3, "USB pwr: %s",
lcd_putsf(0, 3, "USB pwr: %s",
usb_pwr ? "present" : "absent");
debug_printf(4, "EXT pwr: %s",
lcd_putsf(0, 4, "EXT pwr: %s",
ext_pwr ? "present" : "absent");
debug_printf(5, "Battery: %s",
lcd_putsf(0, 5, "Battery: %s",
charging ? "charging" : (usb_pwr||ext_pwr) ? "charged" : "discharging");
debug_printf(6, "Dock mode: %s",
lcd_putsf(0, 6, "Dock mode: %s",
dock ? "enabled" : "disabled");
debug_printf(7, "Headphone: %s",
lcd_putsf(0, 7, "Headphone: %s",
headphone ? "connected" : "disconnected");
#elif defined TOSHIBA_GIGABEAT_S
int line = 3;
@ -1556,16 +1545,16 @@ static bool view_battery(void)
"<unknown>",
};
debug_printf(line++, "Charger: %s",
lcd_putsf(0, line++, "Charger: %s",
charger_inserted() ? "present" : "absent");
st = power_input_status() &
(POWER_INPUT_CHARGER | POWER_INPUT_BATTERY);
debug_printf(line++, "%s%s",
lcd_putsf(0, line++, "%s%s",
(st & POWER_INPUT_MAIN_CHARGER) ? " Main" : "",
(st & POWER_INPUT_USB_CHARGER) ? " USB" : "");
debug_printf(line++, "IUSB Max: %d", usb_allowed_current());
lcd_putsf(0, line++, "IUSB Max: %d", usb_allowed_current());
y = ARRAYLEN(chrgstate_strings) - 1;
@ -1580,36 +1569,36 @@ static bool view_battery(void)
default:;
}
debug_printf(line++, "State: %s", chrgstate_strings[y]);
lcd_putsf(0, line++, "State: %s", chrgstate_strings[y]);
debug_printf(line++, "Battery Switch: %s",
lcd_putsf(0, line++, "Battery Switch: %s",
(st & POWER_INPUT_BATTERY) ? "On" : "Off");
y = chrgraw_adc_voltage();
debug_printf(line++, "CHRGRAW: %d.%03d V",
lcd_putsf(0, line++, "CHRGRAW: %d.%03d V",
y / 1000, y % 1000);
y = application_supply_adc_voltage();
debug_printf(line++, "BP : %d.%03d V",
lcd_putsf(0, line++, "BP : %d.%03d V",
y / 1000, y % 1000);
y = battery_adc_charge_current();
if (y < 0) x = '-', y = -y;
else x = ' ';
debug_printf(line++, "CHRGISN:%c%d mA", x, y);
lcd_putsf(0, line++, "CHRGISN:%c%d mA", x, y);
y = cccv_regulator_dissipation();
debug_printf(line++, "P CCCV : %d mW", y);
lcd_putsf(0, line++, "P CCCV : %d mW", y);
y = battery_charge_current();
if (y < 0) x = '-', y = -y;
else x = ' ';
debug_printf(line++, "I Charge:%c%d mA", x, y);
lcd_putsf(0, line++, "I Charge:%c%d mA", x, y);
y = battery_adc_temp();
if (y != INT_MIN) {
debug_printf(line++, "T Battery: %dC (%dF)", y,
lcd_putsf(0, line++, "T Battery: %dC (%dF)", y,
(9*y + 160) / 5);
} else {
/* Conversion disabled */
@ -1627,23 +1616,23 @@ static bool view_battery(void)
};
const char *str = NULL;
debug_printf(3, "Charger: %s",
lcd_putsf(0, 3, "Charger: %s",
charger_inserted() ? "present" : "absent");
y = charge_state - first;
if ((unsigned)y < ARRAYLEN(chrgstate_strings))
str = chrgstate_strings[y];
debug_printf(4, "State: %s",
lcd_putsf(0, 4, "State: %s",
str ? str : "<unknown>");
debug_printf(5, "CHARGER: %02X",
lcd_putsf(0, 5, "CHARGER: %02X",
ascodec_read(AS3514_CHARGER));
#elif defined(IPOD_NANO2G)
y = pmu_read_battery_current();
debug_printf(2, "Battery current: %d mA", y);
lcd_putsf(0, 2, "Battery current: %d mA", y);
#else
debug_printf(3, "Charger: %s",
lcd_putsf(0, 3, "Charger: %s",
charger_inserted() ? "present" : "absent");
#endif /* target type */
#endif /* CONFIG_CHARGING */
@ -1654,7 +1643,7 @@ static bool view_battery(void)
for (i = 0; i <= 6; i++) {
y = power_history[i] - power_history[i+1];
debug_printf(i+1, "-%d min: %s%d.%03d V", i,
lcd_putsf(0, i+1, "-%d min: %s%d.%03d V", i,
(y < 0) ? "-" : "", ((y < 0) ? y * -1 : y) / 1000,
((y < 0) ? y * -1 : y ) % 1000);
}
@ -1663,24 +1652,24 @@ static bool view_battery(void)
case 3: /* remaining time estimation: */
#ifdef ARCHOS_RECORDER
debug_printf(0, "charge_state: %d", charge_state);
lcd_putsf(0, 0, "charge_state: %d", charge_state);
debug_printf(1, "Cycle time: %d m", powermgmt_last_cycle_startstop_min);
lcd_putsf(0, 1, "Cycle time: %d m", powermgmt_last_cycle_startstop_min);
debug_printf(2, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level);
lcd_putsf(0, 2, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level);
debug_printf(3, "P=%2d I=%2d", pid_p, pid_i);
lcd_putsf(0, 3, "P=%2d I=%2d", pid_p, pid_i);
debug_printf(4, "Trickle sec: %d/60", trickle_sec);
lcd_putsf(0, 4, "Trickle sec: %d/60", trickle_sec);
#endif /* ARCHOS_RECORDER */
debug_printf(5, "Last PwrHist: %d.%03dV",
lcd_putsf(0, 5, "Last PwrHist: %d.%03dV",
power_history[0] / 1000,
power_history[0] % 1000);
debug_printf(6, "battery level: %d%%", battery_level());
lcd_putsf(0, 6, "battery level: %d%%", battery_level());
debug_printf(7, "Est. remain: %d m", battery_time());
lcd_putsf(0, 7, "Est. remain: %d m", battery_time());
break;
}
@ -2447,16 +2436,16 @@ static bool dbg_scrollwheel(void)
lcd_clear_display();
/* show internal variables of scrollwheel driver */
debug_printf(0, "wheel touched: %s", (wheel_is_touched) ? "true" : "false");
debug_printf(1, "new position: %2d", new_wheel_value);
debug_printf(2, "old position: %2d", old_wheel_value);
debug_printf(3, "wheel delta: %2d", wheel_delta);
debug_printf(4, "accumulated delta: %2d", accumulated_wheel_delta);
debug_printf(5, "velo [deg/s]: %4d", (int)wheel_velocity);
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);
/* show effective accelerated scrollspeed */
speed = button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity);
debug_printf(6, "accel. speed: %4d", speed);
lcd_putsf(0, 6, "accel. speed: %4d", speed);
lcd_update();
}

View file

@ -242,9 +242,6 @@ static void init_tagcache(void)
while (!tagcache_is_initialized())
{
#ifdef HAVE_LCD_CHARCELLS
char buf[32];
#endif
int ret = tagcache_get_commit_step();
if (ret > 0)
@ -277,9 +274,8 @@ static void init_tagcache(void)
}
#else
lcd_double_height(false);
snprintf(buf, sizeof(buf), " DB [%d/%d]", ret,
lcd_putsf(0, 1, " DB [%d/%d]", ret,
tagcache_get_max_commit_step());
lcd_puts(0, 1, buf);
lcd_update();
#endif
clear = true;
@ -464,10 +460,8 @@ static void init(void)
if(rc)
{
#ifdef HAVE_LCD_BITMAP
char str[32];
lcd_clear_display();
snprintf(str, 31, "ATA error: %d", rc);
lcd_puts(0, 1, str);
lcd_putsf(0, 1, "ATA error: %d", rc);
lcd_puts(0, 3, "Press ON to debug");
lcd_update();
while(!(button_get(true) & BUTTON_REL)); /*DO NOT CHANGE TO ACTION SYSTEM */

View file

@ -1786,13 +1786,16 @@ bool recording_screen(bool no_source)
/* draw the clipcounter just in front of the peakmeter */
if(global_settings.peak_meter_clipcounter)
{
char clpstr[32];
snprintf(clpstr, 32, "%4d", pm_get_clipcount());
int clipcount = pm_get_clipcount();
FOR_NB_ACTIVE_SCREENS(i)
{
if(!compact_view[i])
{
screens[i].puts(0, 2, str(LANG_PM_CLIPCOUNT));
screens[i].puts(0, compact_view[i] ? 2 : 3, clpstr);
screens[i].putsf(0, 3, "%4d", clipcount);
}
else
screens[i].putsf(0, 2, "%4d", clipcount);
}
}

View file

@ -182,6 +182,7 @@ struct screen screens[NB_SCREENS] =
.putsxy=&lcd_putsxy,
.puts=&lcd_puts,
.putsf=&lcd_putsf,
.puts_offset=&lcd_puts_offset,
.puts_scroll=&lcd_puts_scroll,
.puts_scroll_offset=&lcd_puts_scroll_offset,
@ -267,6 +268,7 @@ struct screen screens[NB_SCREENS] =
#endif /* 0 */
.putsxy=&lcd_remote_putsxy,
.puts=&lcd_remote_puts,
.putsf=&lcd_remote_putsf,
.puts_offset=&lcd_remote_puts_offset,
.puts_scroll=&lcd_remote_puts_scroll,
.puts_scroll_offset=&lcd_remote_puts_scroll_offset,

View file

@ -129,6 +129,7 @@ struct screen
#endif
void (*putsxy)(int x, int y, const unsigned char *str);
void (*puts)(int x, int y, const unsigned char *str);
void (*putsf)(int x, int y, const unsigned char *str, ...);
void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
void (*puts_scroll)(int x, int y, const unsigned char *string);
void (*puts_scroll_offset)(int x, int y, const unsigned char *string,

View file

@ -300,11 +300,9 @@ static void charging_display_info(bool animate)
if (ide_powered()) /* FM and V2 can only measure when ATA power is on */
#endif
{
char buf[32];
int battv = battery_voltage();
snprintf(buf, 32, " Batt: %d.%02dV %d%% ", battv / 1000,
lcd_putsf(0, 7, " Batt: %d.%02dV %d%% ", battv / 1000,
(battv % 1000) / 10, battery_level());
lcd_puts(0, 7, buf);
}
#ifdef ARCHOS_RECORDER
@ -400,8 +398,7 @@ static void charging_display_info(bool animate)
char buf[32];
battv = battery_voltage();
snprintf(buf, sizeof(buf), " %d.%02dV", battv / 1000, (battv % 1000) / 10);
lcd_puts(4, 1, buf);
lcd_putsf(4, 1, " %d.%02dV", battv / 1000, (battv % 1000) / 10);
memcpy(buf, logo_pattern, 32); /* copy logo patterns */

View file

@ -27,6 +27,9 @@
* KIND, either express or implied.
*
****************************************************************************/
#include "stdarg.h"
#include "sprintf.h"
#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */
#define LCDFN(fn) lcd_ ## fn
#define FBFN(fn) fb_ ## fn
@ -206,6 +209,17 @@ void LCDFN(puts)(int x, int y, const unsigned char *str)
LCDFN(puts_style_offset)(x, y, str, STYLE_DEFAULT, 0);
}
/* Formatting version of LCDFN(puts) */
void LCDFN(putsf)(int x, int y, const unsigned char *fmt, ...)
{
va_list ap;
char buf[256];
va_start(ap, fmt);
vsnprintf(buf, sizeof (buf), fmt, ap);
va_end(ap);
LCDFN(puts)(x, y, buf);
}
void LCDFN(puts_style)(int x, int y, const unsigned char *str, int style)
{
LCDFN(puts_style_offset)(x, y, str, style, 0);

View file

@ -21,7 +21,8 @@
****************************************************************************/
#include "config.h"
#include "hwcompat.h"
#include "stdarg.h"
#include "sprintf.h"
#include "lcd.h"
#include "kernel.h"
#include "thread.h"
@ -427,6 +428,17 @@ void lcd_puts(int x, int y, const unsigned char *str)
lcd_puts_offset(x, y, str, 0);
}
/* Formatting version of lcd_puts */
void lcd_putsf(int x, int y, const unsigned char *fmt, ...)
{
va_list ap;
char buf[256];
va_start(ap, fmt);
vsnprintf(buf, sizeof (buf), fmt, ap);
va_end(ap);
lcd_puts(x, y, buf);
}
/* Put a string at a given char position, skipping first offset chars */
void lcd_puts_offset(int x, int y, const unsigned char *str, int offset)
{

View file

@ -121,6 +121,7 @@ extern void lcd_remote_set_viewport(struct viewport* vp);
extern void lcd_remote_clear_display(void);
extern void lcd_remote_clear_viewport(void);
extern void lcd_remote_puts(int x, int y, const unsigned char *str);
extern void lcd_remote_putsf(int x, int y, const unsigned char *fmt, ...);
extern void lcd_remote_puts_style(int x, int y, const unsigned char *str,
int style);
extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str,

View file

@ -191,6 +191,7 @@ extern void lcd_clear_viewport(void);
extern void lcd_clear_display(void);
extern void lcd_putsxy(int x, int y, const unsigned char *string);
extern void lcd_puts(int x, int y, const unsigned char *string);
extern void lcd_putsf(int x, int y, const unsigned char *fmt, ...);
extern void lcd_puts_style(int x, int y, const unsigned char *string, int style);
extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset);
extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,

View file

@ -31,10 +31,6 @@
#include "ascodec-target.h"
#include "adc.h"
#define _DEBUG_PRINTF(a,varargs...) do { \
snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf); \
} while(0)
#define ON "Enabled"
#define OFF "Disabled"
@ -224,7 +220,6 @@ int calc_freq(int clk)
bool __dbg_hw_info(void)
{
char buf[50];
int line;
int last_nand = 0;
#if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2)
@ -240,16 +235,16 @@ bool __dbg_hw_info(void)
{
lcd_clear_display();
line = 0;
_DEBUG_PRINTF("[Clock Frequencies:]");
_DEBUG_PRINTF(" SET ACTUAL");
_DEBUG_PRINTF("922T:%s %3dMHz",
lcd_puts(0, line++, "[Clock Frequencies:]");
lcd_puts(0, line++, " SET ACTUAL");
lcd_putsf(0, line++, "922T:%s %3dMHz",
(!(read_cp15()>>30)) ? "FAST " :
(read_cp15()>>31) ? "ASYNC" : "SYNC ",
calc_freq(CLK_922T)/1000000);
_DEBUG_PRINTF("PLLA:%3dMHz %3dMHz", AS3525_PLLA_FREQ/1000000,
lcd_putsf(0, line++, "PLLA:%3dMHz %3dMHz", AS3525_PLLA_FREQ/1000000,
calc_freq(CLK_PLLA)/1000000);
_DEBUG_PRINTF("PLLB: %3dMHz", calc_freq(CLK_PLLB)/1000000);
_DEBUG_PRINTF("FCLK: %3dMHz", calc_freq(CLK_FCLK)/1000000);
lcd_putsf(0, line++, "PLLB: %3dMHz", calc_freq(CLK_PLLB)/1000000);
lcd_putsf(0, line++, "FCLK: %3dMHz", calc_freq(CLK_FCLK)/1000000);
#if LCD_HEIGHT < 176 /* clip */
lcd_update();
@ -265,17 +260,17 @@ bool __dbg_hw_info(void)
line = 0;
#endif /* LCD_HEIGHT < 176 */
_DEBUG_PRINTF("DRAM:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000,
lcd_putsf(0, line++, "DRAM:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000,
calc_freq(CLK_EXTMEM)/1000000);
_DEBUG_PRINTF("PCLK:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000,
lcd_putsf(0, line++, "PCLK:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000,
calc_freq(CLK_PCLK)/1000000);
_DEBUG_PRINTF("IDE :%3dMHz %3dMHz", AS3525_IDE_FREQ/1000000,
lcd_putsf(0, line++, "IDE :%3dMHz %3dMHz", AS3525_IDE_FREQ/1000000,
calc_freq(CLK_IDE)/1000000);
_DEBUG_PRINTF("DBOP:%3dMHz %3dMHz", AS3525_DBOP_FREQ/1000000,
lcd_putsf(0, line++, "DBOP:%3dMHz %3dMHz", AS3525_DBOP_FREQ/1000000,
calc_freq(CLK_DBOP)/1000000);
_DEBUG_PRINTF("I2C :%3dkHz %3dkHz", AS3525_I2C_FREQ/1000,
lcd_putsf(0, line++, "I2C :%3dkHz %3dkHz", AS3525_I2C_FREQ/1000,
calc_freq(CLK_I2C)/1000);
_DEBUG_PRINTF("I2SI: %s %3dMHz", (CGU_AUDIO & (1<<23)) ?
lcd_putsf(0, line++, "I2SI: %s %3dMHz", (CGU_AUDIO & (1<<23)) ?
"on " : "off" , calc_freq(CLK_I2SI)/1000000);
#if LCD_HEIGHT < 176 /* clip */
@ -292,27 +287,27 @@ bool __dbg_hw_info(void)
line = 0;
#endif /* LCD_HEIGHT < 176 */
_DEBUG_PRINTF("I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ?
lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ?
"on " : "off", calc_freq(CLK_I2SO)/1000000);
if(MCI_NAND)
last_nand = MCI_NAND;
/* MCLK == PCLK */
_DEBUG_PRINTF("SD :%3dMHz %3dMHz",
lcd_putsf(0, line++, "SD :%3dMHz %3dMHz",
((last_nand ? (AS3525_PCLK_FREQ/ 1000000): 0) /
((last_nand & MCI_CLOCK_BYPASS)? 1:(((last_nand & 0xff)+1) * 2))),
calc_freq(CLK_SD_MCLK_NAND)/1000000);
#if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2)
if(MCI_SD)
last_sd = MCI_SD;
_DEBUG_PRINTF("uSD :%3dMHz %3dMHz",
lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz",
((last_sd ? (AS3525_PCLK_FREQ/ 1000000): 0) /
((last_sd & MCI_CLOCK_BYPASS) ? 1: (((last_sd & 0xff) + 1) * 2))),
calc_freq(CLK_SD_MCLK_MSD)/1000000);
#endif
_DEBUG_PRINTF("USB : %3dMHz", calc_freq(CLK_USB)/1000000);
_DEBUG_PRINTF("MMU : %s CVDDP:%4d", (read_cp15() & CP15_MMU) ?
lcd_putsf(0, line++, "USB : %3dMHz", calc_freq(CLK_USB)/1000000);
lcd_putsf(0, line++, "MMU : %s CVDDP:%4d", (read_cp15() & CP15_MMU) ?
" on" : "off", adc_read(ADC_CVDD) * 25);
_DEBUG_PRINTF("Icache:%s Dcache:%s",
lcd_putsf(0, line++, "Icache:%s Dcache:%s",
(read_cp15() & CP15_IC) ? " on" : "off",
(read_cp15() & CP15_DC) ? " on" : "off");
@ -328,12 +323,12 @@ bool __dbg_hw_info(void)
lcd_clear_display();
line = 0;
_DEBUG_PRINTF("CGU_PLLA :%8x", (unsigned int)(CGU_PLLA));
_DEBUG_PRINTF("CGU_PLLB :%8x", (unsigned int)(CGU_PLLB));
_DEBUG_PRINTF("CGU_PROC :%8x", (unsigned int)(CGU_PROC));
_DEBUG_PRINTF("CGU_PERI :%8x", (unsigned int)(CGU_PERI));
_DEBUG_PRINTF("CGU_IDE :%8x", (unsigned int)(CGU_IDE));
_DEBUG_PRINTF("CGU_DBOP :%8x", (unsigned int)(CGU_DBOP));
lcd_putsf(0, line++, "CGU_PLLA :%8x", (unsigned int)(CGU_PLLA));
lcd_putsf(0, line++, "CGU_PLLB :%8x", (unsigned int)(CGU_PLLB));
lcd_putsf(0, line++, "CGU_PROC :%8x", (unsigned int)(CGU_PROC));
lcd_putsf(0, line++, "CGU_PERI :%8x", (unsigned int)(CGU_PERI));
lcd_putsf(0, line++, "CGU_IDE :%8x", (unsigned int)(CGU_IDE));
lcd_putsf(0, line++, "CGU_DBOP :%8x", (unsigned int)(CGU_DBOP));
#if LCD_HEIGHT < 176 /* clip */
lcd_update();
@ -349,12 +344,12 @@ bool __dbg_hw_info(void)
line = 0;
#endif /* LCD_HEIGHT < 176 */
_DEBUG_PRINTF("CGU_AUDIO :%8x", (unsigned int)(CGU_AUDIO));
_DEBUG_PRINTF("CGU_USB :%8x", (unsigned int)(CGU_USB));
_DEBUG_PRINTF("I2C2_CPSR :%8x", (unsigned int)(I2C2_CPSR1<<8 |
lcd_putsf(0, line++, "CGU_AUDIO :%8x", (unsigned int)(CGU_AUDIO));
lcd_putsf(0, line++, "CGU_USB :%8x", (unsigned int)(CGU_USB));
lcd_putsf(0, line++, "I2C2_CPSR :%8x", (unsigned int)(I2C2_CPSR1<<8 |
I2C2_CPSR0));
_DEBUG_PRINTF("MCI_NAND :%8x", (unsigned int)(MCI_NAND));
_DEBUG_PRINTF("MCI_SD :%8x", (unsigned int)(MCI_SD));
lcd_putsf(0, line++, "MCI_NAND :%8x", (unsigned int)(MCI_NAND));
lcd_putsf(0, line++, "MCI_SD :%8x", (unsigned int)(MCI_SD));
lcd_update();
int btn = button_get_w_tmo(HZ/10);
@ -372,7 +367,6 @@ end:
bool __dbg_ports(void)
{
char buf[50];
int line;
lcd_clear_display();
@ -381,19 +375,19 @@ bool __dbg_ports(void)
while(1)
{
line = 0;
_DEBUG_PRINTF("[GPIO Values and Directions]");
_DEBUG_PRINTF("GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR);
_DEBUG_PRINTF("GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR);
_DEBUG_PRINTF("GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR);
_DEBUG_PRINTF("GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR);
lcd_puts(0, line++, "[GPIO Values and Directions]");
lcd_putsf(0, line++, "GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR);
lcd_putsf(0, line++, "GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR);
lcd_putsf(0, line++, "GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR);
lcd_putsf(0, line++, "GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR);
#ifdef DEBUG_DBOP
line++;
_DEBUG_PRINTF("[DBOP_DIN]");
_DEBUG_PRINTF("DBOP_DIN: %4x", button_dbop_data());
lcd_puts(0, line++, "[DBOP_DIN]");
lcd_putsf(0, line++, "DBOP_DIN: %4x", button_dbop_data());
#endif
line++;
_DEBUG_PRINTF("[CP15]");
_DEBUG_PRINTF("CP15: 0x%8x", read_cp15());
lcd_puts(0, line++, "[CP15]");
lcd_putsf(0, line++, "CP15: 0x%8x", read_cp15());
lcd_update();
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
break;

View file

@ -32,7 +32,6 @@
bool __dbg_hw_info(void)
{
char buf[50];
int line;
unsigned int pllref;
unsigned int mcu_pllfreq, ser_pllfreq, usb_pllfreq;
@ -46,9 +45,8 @@ bool __dbg_hw_info(void)
while (1)
{
line = 0;
snprintf(buf, sizeof (buf), "Sys Rev Code: 0x%02X",
iim_system_rev());
lcd_puts(0, line++, buf); line++;
lcd_putsf(0, line++, "Sys Rev Code: 0x%02X", iim_system_rev());
line++;
mpctl = CCM_MPCTL;
spctl = CCM_SPCTL;
@ -60,69 +58,55 @@ bool __dbg_hw_info(void)
ser_pllfreq = ccm_get_pll(PLL_SERIAL);
usb_pllfreq = ccm_get_pll(PLL_USB);
snprintf(buf, sizeof (buf), "pll_ref_clk: %u", pllref);
lcd_puts(0, line++, buf); line++;
lcd_putsf(0, line++, "pll_ref_clk: %u", pllref);
line++;
/* MCU clock domain */
snprintf(buf, sizeof (buf), "MPCTL: %08lX", mpctl);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "MPCTL: %08lX", mpctl);
snprintf(buf, sizeof (buf), " mpl_dpdgck_clk: %u", mcu_pllfreq);
lcd_puts(0, line++, buf); line++;
lcd_putsf(0, line++, " mpl_dpdgck_clk: %u", mcu_pllfreq);
line++;
regval = CCM_PDR0;
snprintf(buf, sizeof (buf), " PDR0: %08lX", regval);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " PDR0: %08lX", regval);
freq = mcu_pllfreq / (((regval & 0x7) + 1));
snprintf(buf, sizeof (buf), " mcu_clk: %u", freq);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " mcu_clk: %u", freq);
freq = mcu_pllfreq / (((regval >> 11) & 0x7) + 1);
snprintf(buf, sizeof (buf), " hsp_clk: %u", freq);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " hsp_clk: %u", freq);
freq = mcu_pllfreq / (((regval >> 3) & 0x7) + 1);
snprintf(buf, sizeof (buf), " hclk_clk: %u", freq);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " hclk_clk: %u", freq);
snprintf(buf, sizeof (buf), " ipg_clk: %u",
lcd_putsf(0, line++, " ipg_clk: %u",
freq / (unsigned)(((regval >> 6) & 0x3) + 1));
lcd_puts(0, line++, buf);
snprintf(buf, sizeof (buf), " nfc_clk: %u",
lcd_putsf(0, line++, " nfc_clk: %u",
freq / (unsigned)(((regval >> 8) & 0x7) + 1));
lcd_puts(0, line++, buf);
line++;
/* Serial clock domain */
snprintf(buf, sizeof (buf), "SPCTL: %08lX", spctl);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof (buf), " spl_dpdgck_clk: %u", ser_pllfreq);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "SPCTL: %08lX", spctl);
lcd_putsf(0, line++, " spl_dpdgck_clk: %u", ser_pllfreq);
line++;
/* USB clock domain */
snprintf(buf, sizeof (buf), "UPCTL: %08lX", upctl);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "UPCTL: %08lX", upctl);
snprintf(buf, sizeof (buf), " upl_dpdgck_clk: %u", usb_pllfreq);
lcd_puts(0, line++, buf); line++;
lcd_putsf(0, line++, " upl_dpdgck_clk: %u", usb_pllfreq);
regval = CCM_PDR1;
snprintf(buf, sizeof (buf), " PDR1: %08lX", regval);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " PDR1: %08lX", regval);
freq = usb_pllfreq /
((((regval >> 30) & 0x3) + 1) * (((regval >> 27) & 0x7) + 1));
snprintf(buf, sizeof (buf), " usb_clk: %u", freq);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " usb_clk: %u", freq);
freq = usb_pllfreq / (((CCM_PDR0 >> 16) & 0x1f) + 1);
snprintf(buf, sizeof (buf), " ipg_per_baud: %u", freq);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " ipg_per_baud: %u", freq);
lcd_update();
@ -133,7 +117,6 @@ bool __dbg_hw_info(void)
bool __dbg_ports(void)
{
char buf[50];
int line;
int i;
@ -171,71 +154,62 @@ bool __dbg_ports(void)
while(1)
{
line = 0;
snprintf(buf, sizeof(buf), "[Ports and Registers]");
lcd_puts(0, line++, buf); line++;
lcd_puts(0, line++, "[Ports and Registers]");
line++;
/* GPIO1 */
snprintf(buf, sizeof(buf), "GPIO1: DR: %08lx GDIR: %08lx", GPIO1_DR, GPIO1_GDIR);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "GPIO1: DR: %08lx GDIR: %08lx", GPIO1_DR, GPIO1_GDIR);
snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO1_PSR, GPIO1_ICR1);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " PSR: %08lx ICR1: %08lx", GPIO1_PSR, GPIO1_ICR1);
snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO1_ICR2, GPIO1_IMR);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " ICR2: %08lx IMR: %08lx", GPIO1_ICR2, GPIO1_IMR);
snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO1_ISR);
lcd_puts(0, line++, buf); line++;
lcd_putsf(0, line++, " ISR: %08lx", GPIO1_ISR);
line++;
/* GPIO2 */
snprintf(buf, sizeof(buf), "GPIO2: DR: %08lx GDIR: %08lx", GPIO2_DR, GPIO2_GDIR);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "GPIO2: DR: %08lx GDIR: %08lx", GPIO2_DR, GPIO2_GDIR);
snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO2_PSR, GPIO2_ICR1);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " PSR: %08lx ICR1: %08lx", GPIO2_PSR, GPIO2_ICR1);
snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO2_ICR2, GPIO2_IMR);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " ICR2: %08lx IMR: %08lx", GPIO2_ICR2, GPIO2_IMR);
snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO2_ISR);
lcd_puts(0, line++, buf); line++;
lcd_putsf(0, line++, " ISR: %08lx", GPIO2_ISR);
line++;
/* GPIO3 */
snprintf(buf, sizeof(buf), "GPIO3: DR: %08lx GDIR: %08lx", GPIO3_DR, GPIO3_GDIR);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "GPIO3: DR: %08lx GDIR: %08lx", GPIO3_DR, GPIO3_GDIR);
snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO3_PSR, GPIO3_ICR1);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " PSR: %08lx ICR1: %08lx", GPIO3_PSR, GPIO3_ICR1);
snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO3_ICR2, GPIO3_IMR);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " ICR2: %08lx IMR: %08lx", GPIO3_ICR2, GPIO3_IMR);
snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO3_ISR);
lcd_puts(0, line++, buf); line++;
lcd_putsf(0, line++, " ISR: %08lx", GPIO3_ISR);
line++;
lcd_puts(0, line++, "PMIC Registers"); line++;
lcd_puts(0, line++, "PMIC Registers");
line++;
mc13783_read_regset(pmic_regset, pmic_regs, ARRAYLEN(pmic_regs));
for (i = 0; i < (int)ARRAYLEN(pmic_regs); i++)
{
snprintf(buf, sizeof(buf), "%s: %08lx", pmic_regnames[i], pmic_regs[i]);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "%s: %08lx", pmic_regnames[i], pmic_regs[i]);
}
line++;
lcd_puts(0, line++, "ADC"); line++;
lcd_puts(0, line++, "ADC");
line++;
for (i = 0; i < NUM_ADC_CHANNELS; i += 4)
{
snprintf(buf, sizeof(buf),
lcd_putsf(0, line++,
"CH%02d:%04u CH%02d:%04u CH%02d:%04u CH%02d:%04u",
i+0, adc_read(i+0),
i+1, adc_read(i+1),
i+2, adc_read(i+2),
i+3, adc_read(i+3));
lcd_puts(0, line++, buf);
}
lcd_update();

View file

@ -46,40 +46,39 @@ bool __dbg_ports(void)
while(1)
{
line = 0;
snprintf(buf, sizeof(buf), "[Ports and Registers]");
lcd_puts(0, line++, buf);
lcd_puts(0, line++, "[Ports and Registers]");
snprintf(buf, sizeof(buf), "GPACON: %08lx GPBCON: %08lx", GPACON, GPBCON); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPADAT: %08lx GPBDAT: %08lx", GPADAT, GPBDAT); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPAUP: %08lx GPBUP: %08lx", 0ul, GPBUP); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPCCON: %08lx GPDCON: %08lx", GPCCON, GPDCON); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPCDAT: %08lx GPDDAT: %08lx", GPCDAT, GPDDAT); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPCUP: %08lx GPDUP: %08lx", GPCUP, GPDUP); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "GPACON: %08lx GPBCON: %08lx", GPACON, GPBCON);
lcd_putsf(0, line++, "GPADAT: %08lx GPBDAT: %08lx", GPADAT, GPBDAT);
lcd_putsf(0, line++, "GPAUP: %08lx GPBUP: %08lx", 0ul, GPBUP);
lcd_putsf(0, line++, "GPCCON: %08lx GPDCON: %08lx", GPCCON, GPDCON);
lcd_putsf(0, line++, "GPCDAT: %08lx GPDDAT: %08lx", GPCDAT, GPDDAT);
lcd_putsf(0, line++, "GPCUP: %08lx GPDUP: %08lx", GPCUP, GPDUP)
snprintf(buf, sizeof(buf), "GPCCON: %08lx GPDCON: %08lx", GPCCON, GPDCON); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPCDAT: %08lx GPDDAT: %08lx", GPCDAT, GPDDAT); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPCUP: %08lx GPDUP: %08lx", GPCUP, GPDUP); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "GPCCON: %08lx GPDCON: %08lx", GPCCON, GPDCON);
lcd_putsf(0, line++, "GPCDAT: %08lx GPDDAT: %08lx", GPCDAT, GPDDAT);
lcd_putsf(0, line++, "GPCUP: %08lx GPDUP: %08lx", GPCUP, GPDUP);
snprintf(buf, sizeof(buf), "GPECON: %08lx GPFCON: %08lx", GPECON, GPFCON); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPEDAT: %08lx GPFDAT: %08lx", GPEDAT, GPFDAT); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPEUP: %08lx GPFUP: %08lx", GPEUP, GPFUP); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "GPECON: %08lx GPFCON: %08lx", GPECON, GPFCON);
lcd_putsf(0, line++, "GPEDAT: %08lx GPFDAT: %08lx", GPEDAT, GPFDAT);
lcd_putsf(0, line++, "GPEUP: %08lx GPFUP: %08lx", GPEUP, GPFUP);
snprintf(buf, sizeof(buf), "GPGCON: %08lx GPHCON: %08lx", GPGCON, GPHCON); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPGDAT: %08lx GPHDAT: %08lx", GPGDAT, GPHDAT); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPGUP: %08lx GPHUP: %08lx", GPGUP, GPHUP); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "GPGCON: %08lx GPHCON: %08lx", GPGCON, GPHCON);
lcd_putsf(0, line++, "GPGDAT: %08lx GPHDAT: %08lx", GPGDAT, GPHDAT);
lcd_putsf(0, line++, "GPGUP: %08lx GPHUP: %08lx", GPGUP, GPHUP);
snprintf(buf, sizeof(buf), "GPJCON: %08lx", GPJCON); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPJDAT: %08lx", GPJDAT); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "GPJUP: %08lx", GPJUP); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "GPJCON: %08lx", GPJCON);
lcd_putsf(0, line++, "GPJDAT: %08lx", GPJDAT);
lcd_putsf(0, line++, "GPJUP: %08lx", GPJUP);
line++;
snprintf(buf, sizeof(buf), "SRCPND: %08lx INTMOD: %08lx", SRCPND, INTMOD); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "INTMSK: %08lx INTPND: %08lx", INTMSK, INTPND); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "CLKCON: %08lx CLKSLOW: %08lx", CLKCON, CLKSLOW); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "MPLLCON: %08lx UPLLCON: %08lx", MPLLCON, UPLLCON); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "CLKDIVN: %08lx CAMDIVN: %08lx", CLKDIVN, CAMDIVN); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "BWSCON: %08lx TCONSEL: %08lx", BWSCON, TCONSEL); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "SRCPND: %08lx INTMOD: %08lx", SRCPND, INTMOD);
lcd_putsf(0, line++, "INTMSK: %08lx INTPND: %08lx", INTMSK, INTPND);
lcd_putsf(0, line++, "CLKCON: %08lx CLKSLOW: %08lx", CLKCON, CLKSLOW);
lcd_putsf(0, line++, "MPLLCON: %08lx UPLLCON: %08lx", MPLLCON, UPLLCON);
lcd_putsf(0, line++, "CLKDIVN: %08lx CAMDIVN: %08lx", CLKDIVN, CAMDIVN);
lcd_putsf(0, line++, "BWSCON: %08lx TCONSEL: %08lx", BWSCON, TCONSEL);
lcd_update();
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))

View file

@ -36,16 +36,13 @@ static const char* const uiename[] = {
*/
void __attribute__((noreturn)) UIE(unsigned int pc, unsigned int num)
{
char str[32];
lcd_clear_display();
#ifdef HAVE_LCD_BITMAP
lcd_setfont(FONT_SYSFIXED);
#endif
lcd_puts(0, 0, uiename[num]);
snprintf(str, sizeof(str), "at %08x" IF_COP(" (%d)"), pc
lcd_putsf(0, 1, "at %08x" IF_COP(" (%d)"), pc
IF_COP(, CURRENT_CORE));
lcd_puts(0, 1, str);
lcd_update();
disable_interrupt(IRQ_FIQ_STATUS);

View file

@ -48,7 +48,6 @@ bool __dbg_hw_info(void)
int *address=0x0;
#endif
bool done=false;
char buf[100];
lcd_setfont(FONT_SYSFIXED);
lcd_clear_display();
@ -58,38 +57,27 @@ bool __dbg_hw_info(void)
lcd_puts(0, line++, "Clock info:");
#if LCD_WIDTH > 320
snprintf(buf, sizeof(buf), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x",
IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x",
IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x",
IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x",
IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x",
IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1);
lcd_putsf(0, line++, "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x",
IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2);
lcd_putsf(0, line++, "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x",
IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV);
lcd_putsf(0, line++, "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x",
IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0);
#else
snprintf(buf, sizeof(buf), " IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x", IO_CLK_PLLA, IO_CLK_PLLB);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_SEL0, IO_CLK_SEL1);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x", IO_CLK_SEL2, IO_CLK_DIV0);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_DIV1, IO_CLK_DIV2);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x", IO_CLK_DIV3, IO_CLK_DIV4);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_BYP, IO_CLK_INV);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x ", IO_CLK_MOD0, IO_CLK_MOD1);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x", IO_CLK_PLLA, IO_CLK_PLLB);
lcd_putsf(0, line++, " IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_SEL0, IO_CLK_SEL1);
lcd_putsf(0, line++, " IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x", IO_CLK_SEL2, IO_CLK_DIV0);
lcd_putsf(0, line++, " IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_DIV1, IO_CLK_DIV2);
lcd_putsf(0, line++, " IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x", IO_CLK_DIV3, IO_CLK_DIV4);
lcd_putsf(0, line++, " IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_BYP, IO_CLK_INV);
lcd_putsf(0, line++, " IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x ", IO_CLK_MOD0, IO_CLK_MOD1);
lcd_putsf(0, line++, " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0);
lcd_puts(0, line++, "Interrupt info:");
snprintf(buf, sizeof(buf), " IO_INTC_EINT0: 0x%04x IO_INTC_EINT1: 0x%04x ", IO_INTC_EINT0, IO_INTC_EINT1);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_INTC_EINT2: 0x%04x IO_INTC_IRQ0: 0x%04x ", IO_INTC_EINT2, IO_INTC_IRQ0);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", IO_INTC_IRQ1, IO_INTC_IRQ2);
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " IO_INTC_EINT0: 0x%04x IO_INTC_EINT1: 0x%04x ", IO_INTC_EINT0, IO_INTC_EINT1);
lcd_putsf(0, line++, " IO_INTC_EINT2: 0x%04x IO_INTC_IRQ0: 0x%04x ", IO_INTC_EINT2, IO_INTC_IRQ0);
lcd_putsf(0, line++, " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", IO_INTC_IRQ1, IO_INTC_IRQ2);
#endif
lcd_puts(0, line++, "Board revision:");
@ -134,20 +122,19 @@ bool __dbg_hw_info(void)
lcd_set_direct_fb(true);
lcd_puts(0, line++, "LCD info:");
snprintf(buf, sizeof(buf), " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no"));
lcd_puts(0, line++, buf);
lcd_putsf(0, line++, " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no"));
line++;
#endif
lcd_puts(0, line++, "[Rockbox info]");
snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
(unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "current tick: %08x Seconds running: %08d",
(unsigned int)current_tick, (unsigned int)current_tick/100);
#ifndef CREATIVE_ZVx
snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
(unsigned int)address, *address); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
(unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
(unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf);
lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x",
(unsigned int)address, *address);
lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x",
(unsigned int)(address+1), *(address+1));
lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x",
(unsigned int)(address+2), *(address+2));
#endif
lcd_update();

View file

@ -165,16 +165,13 @@ static void system_display_exception_info(unsigned long format,
unsigned long pc)
{
int vector = (format >> 18) & 0xff;
char str[32];
/* clear screen */
lcd_clear_display ();
lcd_setfont(FONT_SYSFIXED);
snprintf(str, sizeof(str), "I%02x:%s", vector, irqname[vector]);
lcd_puts(0, 0, str);
snprintf(str, sizeof(str), "at %08x", pc);
lcd_puts(0, 1, str);
lcd_putsf(0, 0, "I%02x:%s", vector, irqname[vector]);
lcd_putsf(0, 1, "at %08x", pc);
lcd_update();
system_exception_wait();

View file

@ -295,7 +295,6 @@ void UIE (unsigned int pc) __attribute__((section(".text")));
void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
{
unsigned int n;
char str[32];
asm volatile ("sts\tpr,%0" : "=r"(n));
@ -306,10 +305,8 @@ void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
#endif
/* output exception */
n = (n - (unsigned)UIE4 + 12)>>2; /* get exception or interrupt number */
snprintf(str,sizeof(str),"I%02x:%s",n,irqname[n]);
lcd_puts(0,0,str);
snprintf(str,sizeof(str),"at %08x",pc);
lcd_puts(0,1,str);
lcd_putsf(0, 0, "I%02x:%s", n, irqname[n]);
lcd_putsf(0, 1, "at %08x", pc);
lcd_update();
/* try to restart firmware if ON is pressed */