summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-10-17 18:02:48 +0000
committerNils Wallménius <nils@rockbox.org>2009-10-17 18:02:48 +0000
commitf34a841b0cc5d1a605375209e1b013b388f741bc (patch)
tree90c780494fa42ffe34e3504d6fe3dc026a91d457 /apps
parent5ca76ab9c4af0759f1bcf75ce24c47ccd38fc962 (diff)
downloadrockbox-f34a841b0cc5d1a605375209e1b013b388f741bc.tar.gz
rockbox-f34a841b0cc5d1a605375209e1b013b388f741bc.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/alarm_menu.c22
-rw-r--r--apps/debug_menu.c359
-rw-r--r--apps/main.c10
-rw-r--r--apps/recorder/recording.c11
-rw-r--r--apps/screen_access.c2
-rw-r--r--apps/screen_access.h1
-rw-r--r--apps/screens.c7
7 files changed, 196 insertions, 216 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c
index 413d176c7e..6473bbab82 100644
--- a/apps/alarm_menu.c
+++ b/apps/alarm_menu.c
@@ -41,14 +41,14 @@
41#include "splash.h" 41#include "splash.h"
42#include "viewport.h" 42#include "viewport.h"
43 43
44static void speak_time(int hours, int minutes, bool speak_hours) 44static void speak_time(int hours, int minutes, bool speak_hours, bool enqueue)
45{ 45{
46 if (global_settings.talk_menu){ 46 if (global_settings.talk_menu){
47 if(speak_hours) { 47 if(speak_hours) {
48 talk_value(hours, UNIT_HOUR, false); 48 talk_value(hours, UNIT_HOUR, enqueue);
49 talk_value(minutes, UNIT_MIN, true); 49 talk_value(minutes, UNIT_MIN, true);
50 } else { 50 } else {
51 talk_value(minutes, UNIT_MIN, false); 51 talk_value(minutes, UNIT_MIN, enqueue);
52 } 52 }
53 } 53 }
54} 54}
@@ -56,8 +56,7 @@ static void speak_time(int hours, int minutes, bool speak_hours)
56bool alarm_screen(void) 56bool alarm_screen(void)
57{ 57{
58 int h, m; 58 int h, m;
59 bool done=false; 59 bool done = false;
60 char buf[32];
61 struct tm *tm; 60 struct tm *tm;
62 int togo; 61 int togo;
63 int button; 62 int button;
@@ -90,19 +89,14 @@ bool alarm_screen(void)
90 screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS)); 89 screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS));
91 } 90 }
92 /* Talk when entering the wakeup screen */ 91 /* Talk when entering the wakeup screen */
93 if (global_settings.talk_menu) 92 speak_time(h, m, true, true);
94 {
95 talk_value(h, UNIT_HOUR, true);
96 talk_value(m, UNIT_MIN, true);
97 }
98 update = false; 93 update = false;
99 } 94 }
100 95
101 snprintf(buf, 32, str(LANG_ALARM_MOD_TIME), h, m);
102 FOR_NB_SCREENS(i) 96 FOR_NB_SCREENS(i)
103 { 97 {
104 screens[i].set_viewport(&vp[i]); 98 screens[i].set_viewport(&vp[i]);
105 screens[i].puts(0, 1, buf); 99 screens[i].putsf(0, 1, str(LANG_ALARM_MOD_TIME), h, m);
106 screens[i].update_viewport(); 100 screens[i].update_viewport();
107 screens[i].set_viewport(NULL); 101 screens[i].set_viewport(NULL);
108 } 102 }
@@ -147,7 +141,7 @@ bool alarm_screen(void)
147 if (h == 24) 141 if (h == 24)
148 h = 0; 142 h = 0;
149 143
150 speak_time(h, m, hour_wrapped); 144 speak_time(h, m, hour_wrapped, false);
151 break; 145 break;
152 146
153 /* dec(m) */ 147 /* dec(m) */
@@ -162,7 +156,7 @@ bool alarm_screen(void)
162 if (h == -1) 156 if (h == -1)
163 h = 23; 157 h = 23;
164 158
165 speak_time(h, m, hour_wrapped); 159 speak_time(h, m, hour_wrapped, false);
166 break; 160 break;
167 161
168 /* inc(h) */ 162 /* inc(h) */
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 9886843723..a0b285ae79 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -122,17 +122,6 @@
122#include "usb_core.h" 122#include "usb_core.h"
123#endif 123#endif
124 124
125/* wrapper function to format a string and print it */
126void debug_printf(int y, const unsigned char *fmt, ...)
127{
128 va_list ap;
129 char buf[128];
130 va_start(ap, fmt);
131 vsnprintf(buf, sizeof (buf), fmt, ap);
132 va_end(ap);
133 lcd_puts(0, y, buf);
134}
135
136/*---------------------------------------------------*/ 125/*---------------------------------------------------*/
137/* SPECIAL DEBUG STUFF */ 126/* SPECIAL DEBUG STUFF */
138/*---------------------------------------------------*/ 127/*---------------------------------------------------*/
@@ -258,12 +247,12 @@ static bool dbg_audio_thread(void)
258 247
259 lcd_clear_display(); 248 lcd_clear_display();
260 249
261 debug_printf(0, "read: %x", d.audiobuf_read); 250 lcd_putsf(0, 0, "read: %x", d.audiobuf_read);
262 debug_printf(1, "write: %x", d.audiobuf_write); 251 lcd_putsf(0, 1, "write: %x", d.audiobuf_write);
263 debug_printf(2, "swap: %x", d.audiobuf_swapwrite); 252 lcd_putsf(0, 2, "swap: %x", d.audiobuf_swapwrite);
264 debug_printf(3, "playing: %d", d.playing); 253 lcd_putsf(0, 3, "playing: %d", d.playing);
265 debug_printf(4, "playable: %x", d.playable_space); 254 lcd_putsf(0, 4, "playable: %x", d.playable_space);
266 debug_printf(5, "unswapped: %x", d.unswapped_space); 255 lcd_putsf(0, 5, "unswapped: %x", d.unswapped_space);
267 256
268 /* Playable space left */ 257 /* Playable space left */
269 gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8, 112, 4, d.audiobuflen, 0, 258 gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8, 112, 4, d.audiobuflen, 0,
@@ -273,7 +262,7 @@ static bool dbg_audio_thread(void)
273 gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8+4, 112, 4, d.audiobuflen, 0, 262 gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8+4, 112, 4, d.audiobuflen, 0,
274 d.low_watermark_level, HORIZONTAL); 263 d.low_watermark_level, HORIZONTAL);
275 264
276 debug_printf(7, "wm: %x - %x", 265 lcd_putsf(0, 7, "wm: %x - %x",
277 d.low_watermark_level, d.lowest_watermark_level); 266 d.low_watermark_level, d.lowest_watermark_level);
278 267
279 lcd_update(); 268 lcd_update();
@@ -336,13 +325,13 @@ static bool dbg_buffering_thread(void)
336 325
337 bufused = bufsize - pcmbuf_free(); 326 bufused = bufsize - pcmbuf_free();
338 327
339 debug_printf(line++, "pcm: %6ld/%ld", (long) bufused, (long) bufsize); 328 lcd_putsf(0, line++, "pcm: %6ld/%ld", (long) bufused, (long) bufsize);
340 329
341 gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6, 330 gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6,
342 bufsize, 0, bufused, HORIZONTAL); 331 bufsize, 0, bufused, HORIZONTAL);
343 line++; 332 line++;
344 333
345 debug_printf(line++, "alloc: %6ld/%ld", audio_filebufused(), 334 lcd_putsf(0, line++, "alloc: %6ld/%ld", audio_filebufused(),
346 (long) filebuflen); 335 (long) filebuflen);
347 336
348#if LCD_HEIGHT > 80 337#if LCD_HEIGHT > 80
@@ -350,7 +339,7 @@ static bool dbg_buffering_thread(void)
350 filebuflen, 0, audio_filebufused(), HORIZONTAL); 339 filebuflen, 0, audio_filebufused(), HORIZONTAL);
351 line++; 340 line++;
352 341
353 debug_printf(line++, "real: %6ld/%ld", (long)d.buffered_data, 342 lcd_putsf(0, line++, "real: %6ld/%ld", (long)d.buffered_data,
354 (long)filebuflen); 343 (long)filebuflen);
355 344
356 gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6, 345 gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6,
@@ -358,7 +347,7 @@ static bool dbg_buffering_thread(void)
358 line++; 347 line++;
359#endif 348#endif
360 349
361 debug_printf(line++, "usefl: %6ld/%ld", (long)(d.useful_data), 350 lcd_putsf(0, line++, "usefl: %6ld/%ld", (long)(d.useful_data),
362 (long)filebuflen); 351 (long)filebuflen);
363 352
364#if LCD_HEIGHT > 80 353#if LCD_HEIGHT > 80
@@ -367,14 +356,14 @@ static bool dbg_buffering_thread(void)
367 line++; 356 line++;
368#endif 357#endif
369 358
370 debug_printf(line++, "data_rem: %ld", (long)d.data_rem); 359 lcd_putsf(0, line++, "data_rem: %ld", (long)d.data_rem);
371 360
372 debug_printf(line++, "track count: %2d", audio_track_count()); 361 lcd_putsf(0, line++, "track count: %2d", audio_track_count());
373 362
374 debug_printf(line++, "handle count: %d", (int)d.num_handles); 363 lcd_putsf(0, line++, "handle count: %d", (int)d.num_handles);
375 364
376#ifndef SIMULATOR 365#ifndef SIMULATOR
377 debug_printf(line++, "cpu freq: %3dMHz", 366 lcd_putsf(0, line++, "cpu freq: %3dMHz",
378 (int)((FREQ + 500000) / 1000000)); 367 (int)((FREQ + 500000) / 1000000));
379#endif 368#endif
380 369
@@ -382,13 +371,13 @@ static bool dbg_buffering_thread(void)
382 { 371 {
383 int boostquota = boost_ticks * 1000 / ticks; /* in 0.1 % */ 372 int boostquota = boost_ticks * 1000 / ticks; /* in 0.1 % */
384 int avgclock = freq_sum * 10 / ticks; /* in 100 kHz */ 373 int avgclock = freq_sum * 10 / ticks; /* in 100 kHz */
385 debug_printf(line++, "boost:%3d.%d%% (%d.%dMHz)", 374 lcd_putsf(0, line++, "boost:%3d.%d%% (%d.%dMHz)",
386 boostquota/10, boostquota%10, avgclock/10, avgclock%10); 375 boostquota/10, boostquota%10, avgclock/10, avgclock%10);
387 } 376 }
388 377
389 debug_printf(line++, "pcmbufdesc: %2d/%2d", 378 lcd_putsf(0, line++, "pcmbufdesc: %2d/%2d",
390 pcmbuf_used_descs(), pcmbufdescs); 379 pcmbuf_used_descs(), pcmbufdescs);
391 debug_printf(line++, "watermark: %6d", 380 lcd_putsf(0, line++, "watermark: %6d",
392 (int)(d.watermark)); 381 (int)(d.watermark));
393 382
394 lcd_update(); 383 lcd_update();
@@ -530,12 +519,12 @@ static bool dbg_hw_info(void)
530 519
531 lcd_puts(0, 0, "[Hardware info]"); 520 lcd_puts(0, 0, "[Hardware info]");
532 521
533 debug_printf(1, "ROM: %d.%02d", rom_version/100, rom_version%100); 522 lcd_putsf(0, 1, "ROM: %d.%02d", rom_version/100, rom_version%100);
534 523
535 debug_printf(2, "Mask: 0x%04x", bitmask); 524 lcd_putsf(0, 2, "Mask: 0x%04x", bitmask);
536 525
537 if (got_id) 526 if (got_id)
538 debug_printf(3, "Flash: M=%02x D=%02x", manu, id); 527 lcd_putsf(0, 3, "Flash: M=%02x D=%02x", manu, id);
539 else 528 else
540 lcd_puts(0, 3, "Flash: M=?? D=??"); /* unknown, sorry */ 529 lcd_puts(0, 3, "Flash: M=?? D=??"); /* unknown, sorry */
541 530
@@ -544,7 +533,7 @@ static bool dbg_hw_info(void)
544 if (rom_crc == 0x56DBA4EE) /* known Version 1 */ 533 if (rom_crc == 0x56DBA4EE) /* known Version 1 */
545 lcd_puts(0, 4, "Boot ROM: V1"); 534 lcd_puts(0, 4, "Boot ROM: V1");
546 else 535 else
547 debug_printf(4, "ROMcrc: 0x%08x", rom_crc); 536 lcd_putsf(0, 4, "ROMcrc: 0x%08x", rom_crc);
548 } 537 }
549 else 538 else
550 { 539 {
@@ -576,7 +565,7 @@ static bool dbg_hw_info(void)
576 lcd_puts(0, line++, "[Hardware info]"); 565 lcd_puts(0, line++, "[Hardware info]");
577 566
578 if (got_id) 567 if (got_id)
579 debug_printf(line++, "Flash: M=%04x D=%04x", manu, id); 568 lcd_putsf(0, line++, "Flash: M=%04x D=%04x", manu, id);
580 else 569 else
581 lcd_puts(0, line++, "Flash: M=???? D=????"); /* unknown, sorry */ 570 lcd_puts(0, line++, "Flash: M=???? D=????"); /* unknown, sorry */
582 571
@@ -590,15 +579,15 @@ static bool dbg_hw_info(void)
590 579
591 if (got_id == DS2411_OK) 580 if (got_id == DS2411_OK)
592 { 581 {
593 debug_printf(++line, " FC=%02x", (unsigned)id.family_code); 582 lcd_putsf(0, ++line, " FC=%02x", (unsigned)id.family_code);
594 debug_printf(++line, " ID=%02X %02X %02X %02X %02X %02X", 583 lcd_putsf(0, ++line, " ID=%02X %02X %02X %02X %02X %02X",
595 (unsigned)id.uid[0], (unsigned)id.uid[1], (unsigned)id.uid[2], 584 (unsigned)id.uid[0], (unsigned)id.uid[1], (unsigned)id.uid[2],
596 (unsigned)id.uid[3], (unsigned)id.uid[4], (unsigned)id.uid[5]); 585 (unsigned)id.uid[3], (unsigned)id.uid[4], (unsigned)id.uid[5]);
597 debug_printf(++line, " CRC=%02X", (unsigned)id.crc); 586 lcd_putsf(0, ++line, " CRC=%02X", (unsigned)id.crc);
598 } 587 }
599 else 588 else
600 { 589 {
601 debug_printf(++line, "READ ERR=%d", got_id); 590 lcd_putsf(0, ++line, "READ ERR=%d", got_id);
602 } 591 }
603 } 592 }
604#endif 593#endif
@@ -620,18 +609,18 @@ static bool dbg_hw_info(void)
620 lcd_puts(0, line++, "[Hardware info]"); 609 lcd_puts(0, line++, "[Hardware info]");
621 610
622#ifdef IPOD_ARCH 611#ifdef IPOD_ARCH
623 debug_printf(line++, "HW rev: 0x%08lx", IPOD_HW_REVISION); 612 lcd_putsf(0, line++, "HW rev: 0x%08lx", IPOD_HW_REVISION);
624#endif 613#endif
625 614
626#ifdef IPOD_COLOR 615#ifdef IPOD_COLOR
627 extern int lcd_type; /* Defined in lcd-colornano.c */ 616 extern int lcd_type; /* Defined in lcd-colornano.c */
628 617
629 debug_printf(line++, "LCD type: %d", lcd_type); 618 lcd_putsf(0, line++, "LCD type: %d", lcd_type);
630#endif 619#endif
631 620
632 debug_printf(line++, "PP version: %s", pp_version); 621 lcd_putsf(0, line++, "PP version: %s", pp_version);
633 622
634 debug_printf(line++, "Est. clock (kHz): %d", perfcheck()); 623 lcd_putsf(0, line++, "Est. clock (kHz): %d", perfcheck());
635 624
636 lcd_update(); 625 lcd_update();
637 626
@@ -651,12 +640,12 @@ static bool dbg_hw_info(void)
651 lcd_puts(0, line++, "[Hardware info]"); 640 lcd_puts(0, line++, "[Hardware info]");
652 641
653#ifdef IPOD_ARCH 642#ifdef IPOD_ARCH
654 debug_printf(line++, "HW rev: 0x%08lx", IPOD_HW_REVISION); 643 lcd_putsf(0, line++, "HW rev: 0x%08lx", IPOD_HW_REVISION);
655#endif 644#endif
656 645
657 debug_printf(line++, "PP version: %s", pp_version); 646 lcd_putsf(0, line++, "PP version: %s", pp_version);
658 647
659 debug_printf(line++, "Est. clock (kHz): %d", perfcheck()); 648 lcd_putsf(0, line++, "Est. clock (kHz): %d", perfcheck());
660 649
661 lcd_update(); 650 lcd_update();
662 651
@@ -706,12 +695,12 @@ static bool dbg_hw_info(void)
706 switch(currval) 695 switch(currval)
707 { 696 {
708 case 0: 697 case 0:
709 debug_printf(1, "ROM: %d.%02d", 698 lcd_putsf(0, 1, "ROM: %d.%02d",
710 rom_version/100, rom_version%100); 699 rom_version/100, rom_version%100);
711 break; 700 break;
712 case 1: 701 case 1:
713 if (got_id) 702 if (got_id)
714 debug_printf(1, "Flash:%02x,%02x", manu, id); 703 lcd_putsf(0, 1, "Flash:%02x,%02x", manu, id);
715 else 704 else
716 lcd_puts(0, 1, "Flash:??,??"); /* unknown, sorry */ 705 lcd_puts(0, 1, "Flash:??,??"); /* unknown, sorry */
717 break; 706 break;
@@ -724,7 +713,7 @@ static bool dbg_hw_info(void)
724 lcd_puts(0, 1, "BootROM: V2"); 713 lcd_puts(0, 1, "BootROM: V2");
725 /* alternative boot ROM found in one single player so far */ 714 /* alternative boot ROM found in one single player so far */
726 else 715 else
727 debug_printf(1, "R: %08x", rom_crc); 716 lcd_putsf(0, 1, "R: %08x", rom_crc);
728 } 717 }
729 else 718 else
730 lcd_puts(0, 1, "BootROM: no"); 719 lcd_puts(0, 1, "BootROM: no");
@@ -822,25 +811,25 @@ static bool dbg_spdif(void)
822 symbolerr = (interruptstat & 0x00800000)?true:false; 811 symbolerr = (interruptstat & 0x00800000)?true:false;
823 parityerr = (interruptstat & 0x00400000)?true:false; 812 parityerr = (interruptstat & 0x00400000)?true:false;
824 813
825 debug_printf(line++, "Val: %s Sym: %s Par: %s", 814 lcd_putsf(0, line++, "Val: %s Sym: %s Par: %s",
826 valnogood?"--":"OK", 815 valnogood?"--":"OK",
827 symbolerr?"--":"OK", 816 symbolerr?"--":"OK",
828 parityerr?"--":"OK"); 817 parityerr?"--":"OK");
829 818
830 debug_printf(line++, "Status word: %08x", (int)control); 819 lcd_putsf(0, line++, "Status word: %08x", (int)control);
831 820
832 line++; 821 line++;
833 822
834 x = control >> 31; 823 x = control >> 31;
835 debug_printf(line++, "PRO: %d (%s)", 824 lcd_putsf(0, line++, "PRO: %d (%s)",
836 x, x?"Professional":"Consumer"); 825 x, x?"Professional":"Consumer");
837 826
838 x = (control >> 30) & 1; 827 x = (control >> 30) & 1;
839 debug_printf(line++, "Audio: %d (%s)", 828 lcd_putsf(0, line++, "Audio: %d (%s)",
840 x, x?"Non-PCM":"PCM"); 829 x, x?"Non-PCM":"PCM");
841 830
842 x = (control >> 29) & 1; 831 x = (control >> 29) & 1;
843 debug_printf(line++, "Copy: %d (%s)", 832 lcd_putsf(0, line++, "Copy: %d (%s)",
844 x, x?"Permitted":"Inhibited"); 833 x, x?"Permitted":"Inhibited");
845 834
846 x = (control >> 27) & 7; 835 x = (control >> 27) & 7;
@@ -856,10 +845,10 @@ static bool dbg_spdif(void)
856 s = "Reserved"; 845 s = "Reserved";
857 break; 846 break;
858 } 847 }
859 debug_printf(line++, "Preemphasis: %d (%s)", x, s); 848 lcd_putsf(0, line++, "Preemphasis: %d (%s)", x, s);
860 849
861 x = (control >> 24) & 3; 850 x = (control >> 24) & 3;
862 debug_printf(line++, "Mode: %d", x); 851 lcd_putsf(0, line++, "Mode: %d", x);
863 852
864 category = (control >> 17) & 127; 853 category = (control >> 17) & 127;
865 switch(category) 854 switch(category)
@@ -873,7 +862,7 @@ static bool dbg_spdif(void)
873 default: 862 default:
874 s = "Unknown"; 863 s = "Unknown";
875 } 864 }
876 debug_printf(line++, "Category: 0x%02x (%s)", category, s); 865 lcd_putsf(0, line++, "Category: 0x%02x (%s)", category, s);
877 866
878 x = (control >> 16) & 1; 867 x = (control >> 16) & 1;
879 generation = x; 868 generation = x;
@@ -883,11 +872,11 @@ static bool dbg_spdif(void)
883 { 872 {
884 generation = !generation; 873 generation = !generation;
885 } 874 }
886 debug_printf(line++, "Generation: %d (%s)", 875 lcd_putsf(0, line++, "Generation: %d (%s)",
887 x, generation?"Original":"No ind."); 876 x, generation?"Original":"No ind.");
888 877
889 x = (control >> 12) & 15; 878 x = (control >> 12) & 15;
890 debug_printf(line++, "Source: %d", x); 879 lcd_putsf(0, line++, "Source: %d", x);
891 880
892 881
893 x = (control >> 8) & 15; 882 x = (control >> 8) & 15;
@@ -906,7 +895,7 @@ static bool dbg_spdif(void)
906 s = ""; 895 s = "";
907 break; 896 break;
908 } 897 }
909 debug_printf(line++, "Channel: %d (%s)", x, s); 898 lcd_putsf(0, line++, "Channel: %d (%s)", x, s);
910 899
911 x = (control >> 4) & 15; 900 x = (control >> 4) & 15;
912 switch(x) 901 switch(x)
@@ -921,14 +910,14 @@ static bool dbg_spdif(void)
921 s = "32kHz"; 910 s = "32kHz";
922 break; 911 break;
923 } 912 }
924 debug_printf(line++, "Frequency: %d (%s)", x, s); 913 lcd_putsf(0, line++, "Frequency: %d (%s)", x, s);
925 914
926 x = (control >> 2) & 3; 915 x = (control >> 2) & 3;
927 debug_printf(line++, "Clock accuracy: %d", x); 916 lcd_putsf(0, line++, "Clock accuracy: %d", x);
928 line++; 917 line++;
929 918
930#ifndef SIMULATOR 919#ifndef SIMULATOR
931 debug_printf(line++, "Measured freq: %ldHz", 920 lcd_putsf(0, line++, "Measured freq: %ldHz",
932 spdif_measure_frequency()); 921 spdif_measure_frequency());
933#endif 922#endif
934 923
@@ -1008,16 +997,16 @@ bool dbg_ports(void)
1008 997
1009 while(1) 998 while(1)
1010 { 999 {
1011 debug_printf(0, "PADR: %04x", (unsigned short)PADR); 1000 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR);
1012 debug_printf(1, "PBDR: %04x", (unsigned short)PBDR); 1001 lcd_putsf(0, 1, "PBDR: %04x", (unsigned short)PBDR);
1013 1002
1014 debug_printf(2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4)); 1003 lcd_putsf(0, 2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
1015 debug_printf(3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5)); 1004 lcd_putsf(0, 3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
1016 debug_printf(4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6)); 1005 lcd_putsf(0, 4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
1017 debug_printf(5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7)); 1006 lcd_putsf(0, 5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
1018 1007
1019 battery_read_info(&adc_battery_voltage, &adc_battery_level); 1008 battery_read_info(&adc_battery_voltage, &adc_battery_level);
1020 debug_printf(6, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000, 1009 lcd_putsf(0, 6, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
1021 adc_battery_voltage % 1000, adc_battery_level); 1010 adc_battery_voltage % 1000, adc_battery_level);
1022 1011
1023 lcd_update(); 1012 lcd_update();
@@ -1055,41 +1044,41 @@ bool dbg_ports(void)
1055 gpio_enable = GPIO_ENABLE; 1044 gpio_enable = GPIO_ENABLE;
1056 gpio1_enable = GPIO1_ENABLE; 1045 gpio1_enable = GPIO1_ENABLE;
1057 1046
1058 debug_printf(line++, "GPIO_READ: %08x", gpio_read); 1047 lcd_putsf(0, line++, "GPIO_READ: %08x", gpio_read);
1059 debug_printf(line++, "GPIO_OUT: %08x", gpio_out); 1048 lcd_putsf(0, line++, "GPIO_OUT: %08x", gpio_out);
1060 debug_printf(line++, "GPIO_FUNC: %08x", gpio_function); 1049 lcd_putsf(0, line++, "GPIO_FUNC: %08x", gpio_function);
1061 debug_printf(line++, "GPIO_ENA: %08x", gpio_enable); 1050 lcd_putsf(0, line++, "GPIO_ENA: %08x", gpio_enable);
1062 1051
1063 debug_printf(line++, "GPIO1_READ: %08x", gpio1_read); 1052 lcd_putsf(0, line++, "GPIO1_READ: %08x", gpio1_read);
1064 debug_printf(line++, "GPIO1_OUT: %08x", gpio1_out); 1053 lcd_putsf(0, line++, "GPIO1_OUT: %08x", gpio1_out);
1065 debug_printf(line++, "GPIO1_FUNC: %08x", gpio1_function); 1054 lcd_putsf(0, line++, "GPIO1_FUNC: %08x", gpio1_function);
1066 debug_printf(line++, "GPIO1_ENA: %08x", gpio1_enable); 1055 lcd_putsf(0, line++, "GPIO1_ENA: %08x", gpio1_enable);
1067 1056
1068 adc_buttons = adc_read(ADC_BUTTONS); 1057 adc_buttons = adc_read(ADC_BUTTONS);
1069 adc_remote = adc_read(ADC_REMOTE); 1058 adc_remote = adc_read(ADC_REMOTE);
1070 battery_read_info(&adc_battery_voltage, &adc_battery_level); 1059 battery_read_info(&adc_battery_voltage, &adc_battery_level);
1071#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES) 1060#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
1072 debug_printf(line++, "ADC_BUTTONS (%c): %02x", 1061 lcd_putsf(0, line++, "ADC_BUTTONS (%c): %02x",
1073 button_scan_enabled() ? '+' : '-', adc_buttons); 1062 button_scan_enabled() ? '+' : '-', adc_buttons);
1074#else 1063#else
1075 debug_printf(line++, "ADC_BUTTONS: %02x", adc_buttons); 1064 lcd_putsf(0, line++, "ADC_BUTTONS: %02x", adc_buttons);
1076#endif 1065#endif
1077#if defined(IAUDIO_X5) || defined(IAUDIO_M5) 1066#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
1078 debug_printf(line++, "ADC_REMOTE (%c): %02x", 1067 lcd_putsf(0, line++, "ADC_REMOTE (%c): %02x",
1079 remote_detect() ? '+' : '-', adc_remote); 1068 remote_detect() ? '+' : '-', adc_remote);
1080#else 1069#else
1081 debug_printf(line++, "ADC_REMOTE: %02x", adc_remote); 1070 lcd_putsf(0, line++, "ADC_REMOTE: %02x", adc_remote);
1082#endif 1071#endif
1083#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) 1072#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1084 debug_printf(line++, "ADC_REMOTEDETECT: %02x", 1073 lcd_putsf(0, line++, "ADC_REMOTEDETECT: %02x",
1085 adc_read(ADC_REMOTEDETECT)); 1074 adc_read(ADC_REMOTEDETECT));
1086#endif 1075#endif
1087 1076
1088 debug_printf(line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000, 1077 lcd_putsf(0, line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
1089 adc_battery_voltage % 1000, adc_battery_level); 1078 adc_battery_voltage % 1000, adc_battery_level);
1090 1079
1091#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) 1080#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1092 debug_printf(line++, "remotetype: %d", remote_type()); 1081 lcd_putsf(0, line++, "remotetype: %d", remote_type());
1093#endif 1082#endif
1094 1083
1095 lcd_update(); 1084 lcd_update();
@@ -1110,66 +1099,66 @@ bool dbg_ports(void)
1110 { 1099 {
1111 line = 0; 1100 line = 0;
1112 lcd_puts(0, line++, "GPIO STATES:"); 1101 lcd_puts(0, line++, "GPIO STATES:");
1113 debug_printf(line++, "A: %02x E: %02x I: %02x", 1102 lcd_putsf(0, line++, "A: %02x E: %02x I: %02x",
1114 (unsigned int)GPIOA_INPUT_VAL, 1103 (unsigned int)GPIOA_INPUT_VAL,
1115 (unsigned int)GPIOE_INPUT_VAL, 1104 (unsigned int)GPIOE_INPUT_VAL,
1116 (unsigned int)GPIOI_INPUT_VAL); 1105 (unsigned int)GPIOI_INPUT_VAL);
1117 debug_printf(line++, "B: %02x F: %02x J: %02x", 1106 lcd_putsf(0, line++, "B: %02x F: %02x J: %02x",
1118 (unsigned int)GPIOB_INPUT_VAL, 1107 (unsigned int)GPIOB_INPUT_VAL,
1119 (unsigned int)GPIOF_INPUT_VAL, 1108 (unsigned int)GPIOF_INPUT_VAL,
1120 (unsigned int)GPIOJ_INPUT_VAL); 1109 (unsigned int)GPIOJ_INPUT_VAL);
1121 debug_printf(line++, "C: %02x G: %02x K: %02x", 1110 lcd_putsf(0, line++, "C: %02x G: %02x K: %02x",
1122 (unsigned int)GPIOC_INPUT_VAL, 1111 (unsigned int)GPIOC_INPUT_VAL,
1123 (unsigned int)GPIOG_INPUT_VAL, 1112 (unsigned int)GPIOG_INPUT_VAL,
1124 (unsigned int)GPIOK_INPUT_VAL); 1113 (unsigned int)GPIOK_INPUT_VAL);
1125 debug_printf(line++, "D: %02x H: %02x L: %02x", 1114 lcd_putsf(0, line++, "D: %02x H: %02x L: %02x",
1126 (unsigned int)GPIOD_INPUT_VAL, 1115 (unsigned int)GPIOD_INPUT_VAL,
1127 (unsigned int)GPIOH_INPUT_VAL, 1116 (unsigned int)GPIOH_INPUT_VAL,
1128 (unsigned int)GPIOL_INPUT_VAL); 1117 (unsigned int)GPIOL_INPUT_VAL);
1129 line++; 1118 line++;
1130 debug_printf(line++, "GPO32_VAL: %08lx", GPO32_VAL); 1119 lcd_putsf(0, line++, "GPO32_VAL: %08lx", GPO32_VAL);
1131 debug_printf(line++, "GPO32_EN: %08lx", GPO32_ENABLE); 1120 lcd_putsf(0, line++, "GPO32_EN: %08lx", GPO32_ENABLE);
1132 debug_printf(line++, "DEV_EN: %08lx", DEV_EN); 1121 lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
1133 debug_printf(line++, "DEV_EN2: %08lx", DEV_EN2); 1122 lcd_putsf(0, line++, "DEV_EN2: %08lx", DEV_EN2);
1134 debug_printf(line++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */ 1123 lcd_putsf(0, line++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */
1135 debug_printf(line++, "DEV_INIT1: %08lx", DEV_INIT1); 1124 lcd_putsf(0, line++, "DEV_INIT1: %08lx", DEV_INIT1);
1136 debug_printf(line++, "DEV_INIT2: %08lx", DEV_INIT2); 1125 lcd_putsf(0, line++, "DEV_INIT2: %08lx", DEV_INIT2);
1137#ifdef ADC_ACCESSORY 1126#ifdef ADC_ACCESSORY
1138 debug_printf(line++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY)); 1127 lcd_putsf(0, line++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY));
1139#endif 1128#endif
1140 1129
1141#if defined(IPOD_ACCESSORY_PROTOCOL) 1130#if defined(IPOD_ACCESSORY_PROTOCOL)
1142extern unsigned char serbuf[]; 1131extern unsigned char serbuf[];
1143 debug_printf(line++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x", 1132 lcd_putsf(0, line++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
1144 serbuf[0], serbuf[1], serbuf[2], serbuf[3], serbuf[4], serbuf[5], 1133 serbuf[0], serbuf[1], serbuf[2], serbuf[3], serbuf[4], serbuf[5],
1145 serbuf[6], serbuf[7]); 1134 serbuf[6], serbuf[7]);
1146#endif 1135#endif
1147 1136
1148#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) 1137#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1149 line++; 1138 line++;
1150 debug_printf(line++, "BATT: %03x UNK1: %03x", 1139 lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
1151 adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1)); 1140 adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
1152 debug_printf(line++, "REM: %03x PAD: %03x", 1141 lcd_putsf(0, line++, "REM: %03x PAD: %03x",
1153 adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD)); 1142 adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD));
1154#elif defined(PHILIPS_HDD1630) 1143#elif defined(PHILIPS_HDD1630)
1155 line++; 1144 line++;
1156 debug_printf(line++, "BATT: %03x UNK1: %03x", 1145 lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
1157 adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1)); 1146 adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
1158#elif defined(SANSA_E200) || defined(PHILIPS_SA9200) 1147#elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
1159 debug_printf(line++, "ADC_BVDD: %4d", adc_read(ADC_BVDD)); 1148 lcd_putsf(0, line++, "ADC_BVDD: %4d", adc_read(ADC_BVDD));
1160 debug_printf(line++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP)); 1149 lcd_putsf(0, line++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP));
1161 debug_printf(line++, "ADC_UVDD: %4d", adc_read(ADC_UVDD)); 1150 lcd_putsf(0, line++, "ADC_UVDD: %4d", adc_read(ADC_UVDD));
1162 debug_printf(line++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN)); 1151 lcd_putsf(0, line++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN));
1163 debug_printf(line++, "ADC_CVDD: %4d", adc_read(ADC_CVDD)); 1152 lcd_putsf(0, line++, "ADC_CVDD: %4d", adc_read(ADC_CVDD));
1164 debug_printf(line++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP)); 1153 lcd_putsf(0, line++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP));
1165 debug_printf(line++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1)); 1154 lcd_putsf(0, line++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1));
1166 debug_printf(line++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2)); 1155 lcd_putsf(0, line++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2));
1167 debug_printf(line++, "ADC_VBE1: %4d", adc_read(ADC_VBE1)); 1156 lcd_putsf(0, line++, "ADC_VBE1: %4d", adc_read(ADC_VBE1));
1168 debug_printf(line++, "ADC_VBE2: %4d", adc_read(ADC_VBE2)); 1157 lcd_putsf(0, line++, "ADC_VBE2: %4d", adc_read(ADC_VBE2));
1169 debug_printf(line++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1)); 1158 lcd_putsf(0, line++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1));
1170#if !defined(PHILIPS_SA9200) 1159#if !defined(PHILIPS_SA9200)
1171 debug_printf(line++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2)); 1160 lcd_putsf(0, line++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2));
1172 debug_printf(line++, "ADC_VBAT: %4d", adc_read(ADC_VBAT)); 1161 lcd_putsf(0, line++, "ADC_VBAT: %4d", adc_read(ADC_VBAT));
1173#endif 1162#endif
1174#endif 1163#endif
1175 lcd_update(); 1164 lcd_update();
@@ -1189,19 +1178,19 @@ extern unsigned char serbuf[];
1189 while(1) 1178 while(1)
1190 { 1179 {
1191 line = 0; 1180 line = 0;
1192 debug_printf(line++, "GPIO_A: %02x GPIO_B: %02x", 1181 lcd_putsf(0, line++, "GPIO_A: %02x GPIO_B: %02x",
1193 (unsigned int)GPIOA_INPUT_VAL, (unsigned int)GPIOB_INPUT_VAL); 1182 (unsigned int)GPIOA_INPUT_VAL, (unsigned int)GPIOB_INPUT_VAL);
1194 debug_printf(line++, "GPIO_C: %02x GPIO_D: %02x", 1183 lcd_putsf(0, line++, "GPIO_C: %02x GPIO_D: %02x",
1195 (unsigned int)GPIOC_INPUT_VAL, (unsigned int)GPIOD_INPUT_VAL); 1184 (unsigned int)GPIOC_INPUT_VAL, (unsigned int)GPIOD_INPUT_VAL);
1196 1185
1197 debug_printf(line++, "DEV_EN: %08lx", DEV_EN); 1186 lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
1198 debug_printf(line++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE); 1187 lcd_putsf(0, line++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE);
1199 debug_printf(line++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE); 1188 lcd_putsf(0, line++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE);
1200 debug_printf(line++, "PLL_CONTROL: %08lx", PLL_CONTROL); 1189 lcd_putsf(0, line++, "PLL_CONTROL: %08lx", PLL_CONTROL);
1201 debug_printf(line++, "PLL_DIV: %08lx", PLL_DIV); 1190 lcd_putsf(0, line++, "PLL_DIV: %08lx", PLL_DIV);
1202 debug_printf(line++, "PLL_MULT: %08lx", PLL_MULT); 1191 lcd_putsf(0, line++, "PLL_MULT: %08lx", PLL_MULT);
1203 debug_printf(line++, "TIMING1_CTL: %08lx", TIMING1_CTL); 1192 lcd_putsf(0, line++, "TIMING1_CTL: %08lx", TIMING1_CTL);
1204 debug_printf(line++, "TIMING2_CTL: %08lx", TIMING2_CTL); 1193 lcd_putsf(0, line++, "TIMING2_CTL: %08lx", TIMING2_CTL);
1205 1194
1206 lcd_update(); 1195 lcd_update();
1207 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) 1196 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
@@ -1264,7 +1253,7 @@ bool dbg_ports(void)
1264 lcd_puts(0, 0, buf); 1253 lcd_puts(0, 0, buf);
1265 1254
1266 battery_read_info(&adc_battery_voltage, NULL); 1255 battery_read_info(&adc_battery_voltage, NULL);
1267 debug_printf(1, "Batt: %d.%03dV", adc_battery_voltage / 1000, 1256 lcd_putsf(0, 1, "Batt: %d.%03dV", adc_battery_voltage / 1000,
1268 adc_battery_voltage % 1000); 1257 adc_battery_voltage % 1000);
1269 lcd_update(); 1258 lcd_update();
1270 1259
@@ -1307,19 +1296,19 @@ static bool dbg_pcf(void)
1307 { 1296 {
1308 line = 0; 1297 line = 0;
1309 1298
1310 debug_printf(line++, "DCDC1: %02x", pcf50605_read(0x1b)); 1299 lcd_putsf(0, line++, "DCDC1: %02x", pcf50605_read(0x1b));
1311 debug_printf(line++, "DCDC2: %02x", pcf50605_read(0x1c)); 1300 lcd_putsf(0, line++, "DCDC2: %02x", pcf50605_read(0x1c));
1312 debug_printf(line++, "DCDC3: %02x", pcf50605_read(0x1d)); 1301 lcd_putsf(0, line++, "DCDC3: %02x", pcf50605_read(0x1d));
1313 debug_printf(line++, "DCDC4: %02x", pcf50605_read(0x1e)); 1302 lcd_putsf(0, line++, "DCDC4: %02x", pcf50605_read(0x1e));
1314 debug_printf(line++, "DCDEC1: %02x", pcf50605_read(0x1f)); 1303 lcd_putsf(0, line++, "DCDEC1: %02x", pcf50605_read(0x1f));
1315 debug_printf(line++, "DCDEC2: %02x", pcf50605_read(0x20)); 1304 lcd_putsf(0, line++, "DCDEC2: %02x", pcf50605_read(0x20));
1316 debug_printf(line++, "DCUDC1: %02x", pcf50605_read(0x21)); 1305 lcd_putsf(0, line++, "DCUDC1: %02x", pcf50605_read(0x21));
1317 debug_printf(line++, "DCUDC2: %02x", pcf50605_read(0x22)); 1306 lcd_putsf(0, line++, "DCUDC2: %02x", pcf50605_read(0x22));
1318 debug_printf(line++, "IOREGC: %02x", pcf50605_read(0x23)); 1307 lcd_putsf(0, line++, "IOREGC: %02x", pcf50605_read(0x23));
1319 debug_printf(line++, "D1REGC: %02x", pcf50605_read(0x24)); 1308 lcd_putsf(0, line++, "D1REGC: %02x", pcf50605_read(0x24));
1320 debug_printf(line++, "D2REGC: %02x", pcf50605_read(0x25)); 1309 lcd_putsf(0, line++, "D2REGC: %02x", pcf50605_read(0x25));
1321 debug_printf(line++, "D3REGC: %02x", pcf50605_read(0x26)); 1310 lcd_putsf(0, line++, "D3REGC: %02x", pcf50605_read(0x26));
1322 debug_printf(line++, "LPREG1: %02x", pcf50605_read(0x27)); 1311 lcd_putsf(0, line++, "LPREG1: %02x", pcf50605_read(0x27));
1323 lcd_update(); 1312 lcd_update();
1324 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) 1313 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
1325 { 1314 {
@@ -1348,8 +1337,8 @@ static bool dbg_cpufreq(void)
1348 { 1337 {
1349 line = 0; 1338 line = 0;
1350 1339
1351 debug_printf(line++, "Frequency: %ld", FREQ); 1340 lcd_putsf(0, line++, "Frequency: %ld", FREQ);
1352 debug_printf(line++, "boost_counter: %d", get_cpu_boost_counter()); 1341 lcd_putsf(0, line++, "boost_counter: %d", get_cpu_boost_counter());
1353 1342
1354 lcd_update(); 1343 lcd_update();
1355 button = get_action(CONTEXT_STD,HZ/10); 1344 button = get_action(CONTEXT_STD,HZ/10);
@@ -1484,9 +1473,9 @@ static bool view_battery(void)
1484 minv = power_history[i]; 1473 minv = power_history[i];
1485 } 1474 }
1486 1475
1487 debug_printf(0, "Battery %d.%03d", power_history[0] / 1000, 1476 lcd_putsf(0, 0, "Battery %d.%03d", power_history[0] / 1000,
1488 power_history[0] % 1000); 1477 power_history[0] % 1000);
1489 debug_printf(1, "scale %d.%03d-%d.%03dV", 1478 lcd_putsf(0, 1, "scale %d.%03d-%d.%03dV",
1490 minv / 1000, minv % 1000, maxv / 1000, maxv % 1000); 1479 minv / 1000, minv % 1000, maxv / 1000, maxv % 1000);
1491 1480
1492 x = 0; 1481 x = 0;
@@ -1506,23 +1495,23 @@ static bool view_battery(void)
1506 lcd_puts(0, 0, "Power status:"); 1495 lcd_puts(0, 0, "Power status:");
1507 1496
1508 battery_read_info(&y, NULL); 1497 battery_read_info(&y, NULL);
1509 debug_printf(1, "Battery: %d.%03d V", y / 1000, y % 1000); 1498 lcd_putsf(0, 1, "Battery: %d.%03d V", y / 1000, y % 1000);
1510#ifdef ADC_EXT_POWER 1499#ifdef ADC_EXT_POWER
1511 y = (adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 1000; 1500 y = (adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 1000;
1512 debug_printf(2, "External: %d.%03d V", y / 1000, y % 1000); 1501 lcd_putsf(0, 2, "External: %d.%03d V", y / 1000, y % 1000);
1513#endif 1502#endif
1514#if CONFIG_CHARGING 1503#if CONFIG_CHARGING
1515#if defined ARCHOS_RECORDER 1504#if defined ARCHOS_RECORDER
1516 debug_printf(3, "Chgr: %s %s", 1505 lcd_putsf(0, 3, "Chgr: %s %s",
1517 charger_inserted() ? "present" : "absent", 1506 charger_inserted() ? "present" : "absent",
1518 charger_enabled() ? "on" : "off"); 1507 charger_enabled() ? "on" : "off");
1519 debug_printf(5, "short delta: %d", short_delta); 1508 lcd_putsf(0, 5, "short delta: %d", short_delta);
1520 debug_printf(6, "long delta: %d", long_delta); 1509 lcd_putsf(0, 6, "long delta: %d", long_delta);
1521 lcd_puts(0, 7, power_message); 1510 lcd_puts(0, 7, power_message);
1522 debug_printf(8, "USB Inserted: %s", 1511 lcd_putsf(0, 8, "USB Inserted: %s",
1523 usb_inserted() ? "yes" : "no"); 1512 usb_inserted() ? "yes" : "no");
1524#elif defined IRIVER_H300_SERIES 1513#elif defined IRIVER_H300_SERIES
1525 debug_printf(9, "USB Charging Enabled: %s", 1514 lcd_putsf(0, 9, "USB Charging Enabled: %s",
1526 usb_charging_enabled() ? "yes" : "no"); 1515 usb_charging_enabled() ? "yes" : "no");
1527#elif defined IPOD_NANO || defined IPOD_VIDEO 1516#elif defined IPOD_NANO || defined IPOD_VIDEO
1528 int usb_pwr = (GPIOL_INPUT_VAL & 0x10)?true:false; 1517 int usb_pwr = (GPIOL_INPUT_VAL & 0x10)?true:false;
@@ -1531,15 +1520,15 @@ static bool view_battery(void)
1531 int charging = (GPIOB_INPUT_VAL & 0x01)?false:true; 1520 int charging = (GPIOB_INPUT_VAL & 0x01)?false:true;
1532 int headphone= (GPIOA_INPUT_VAL & 0x80)?true:false; 1521 int headphone= (GPIOA_INPUT_VAL & 0x80)?true:false;
1533 1522
1534 debug_printf(3, "USB pwr: %s", 1523 lcd_putsf(0, 3, "USB pwr: %s",
1535 usb_pwr ? "present" : "absent"); 1524 usb_pwr ? "present" : "absent");
1536 debug_printf(4, "EXT pwr: %s", 1525 lcd_putsf(0, 4, "EXT pwr: %s",
1537 ext_pwr ? "present" : "absent"); 1526 ext_pwr ? "present" : "absent");
1538 debug_printf(5, "Battery: %s", 1527 lcd_putsf(0, 5, "Battery: %s",
1539 charging ? "charging" : (usb_pwr||ext_pwr) ? "charged" : "discharging"); 1528 charging ? "charging" : (usb_pwr||ext_pwr) ? "charged" : "discharging");
1540 debug_printf(6, "Dock mode: %s", 1529 lcd_putsf(0, 6, "Dock mode: %s",
1541 dock ? "enabled" : "disabled"); 1530 dock ? "enabled" : "disabled");
1542 debug_printf(7, "Headphone: %s", 1531 lcd_putsf(0, 7, "Headphone: %s",
1543 headphone ? "connected" : "disconnected"); 1532 headphone ? "connected" : "disconnected");
1544#elif defined TOSHIBA_GIGABEAT_S 1533#elif defined TOSHIBA_GIGABEAT_S
1545 int line = 3; 1534 int line = 3;
@@ -1556,16 +1545,16 @@ static bool view_battery(void)
1556 "<unknown>", 1545 "<unknown>",
1557 }; 1546 };
1558 1547
1559 debug_printf(line++, "Charger: %s", 1548 lcd_putsf(0, line++, "Charger: %s",
1560 charger_inserted() ? "present" : "absent"); 1549 charger_inserted() ? "present" : "absent");
1561 1550
1562 st = power_input_status() & 1551 st = power_input_status() &
1563 (POWER_INPUT_CHARGER | POWER_INPUT_BATTERY); 1552 (POWER_INPUT_CHARGER | POWER_INPUT_BATTERY);
1564 debug_printf(line++, "%s%s", 1553 lcd_putsf(0, line++, "%s%s",
1565 (st & POWER_INPUT_MAIN_CHARGER) ? " Main" : "", 1554 (st & POWER_INPUT_MAIN_CHARGER) ? " Main" : "",
1566 (st & POWER_INPUT_USB_CHARGER) ? " USB" : ""); 1555 (st & POWER_INPUT_USB_CHARGER) ? " USB" : "");
1567 1556
1568 debug_printf(line++, "IUSB Max: %d", usb_allowed_current()); 1557 lcd_putsf(0, line++, "IUSB Max: %d", usb_allowed_current());
1569 1558
1570 y = ARRAYLEN(chrgstate_strings) - 1; 1559 y = ARRAYLEN(chrgstate_strings) - 1;
1571 1560
@@ -1580,36 +1569,36 @@ static bool view_battery(void)
1580 default:; 1569 default:;
1581 } 1570 }
1582 1571
1583 debug_printf(line++, "State: %s", chrgstate_strings[y]); 1572 lcd_putsf(0, line++, "State: %s", chrgstate_strings[y]);
1584 1573
1585 debug_printf(line++, "Battery Switch: %s", 1574 lcd_putsf(0, line++, "Battery Switch: %s",
1586 (st & POWER_INPUT_BATTERY) ? "On" : "Off"); 1575 (st & POWER_INPUT_BATTERY) ? "On" : "Off");
1587 1576
1588 y = chrgraw_adc_voltage(); 1577 y = chrgraw_adc_voltage();
1589 debug_printf(line++, "CHRGRAW: %d.%03d V", 1578 lcd_putsf(0, line++, "CHRGRAW: %d.%03d V",
1590 y / 1000, y % 1000); 1579 y / 1000, y % 1000);
1591 1580
1592 y = application_supply_adc_voltage(); 1581 y = application_supply_adc_voltage();
1593 debug_printf(line++, "BP : %d.%03d V", 1582 lcd_putsf(0, line++, "BP : %d.%03d V",
1594 y / 1000, y % 1000); 1583 y / 1000, y % 1000);
1595 1584
1596 y = battery_adc_charge_current(); 1585 y = battery_adc_charge_current();
1597 if (y < 0) x = '-', y = -y; 1586 if (y < 0) x = '-', y = -y;
1598 else x = ' '; 1587 else x = ' ';
1599 debug_printf(line++, "CHRGISN:%c%d mA", x, y); 1588 lcd_putsf(0, line++, "CHRGISN:%c%d mA", x, y);
1600 1589
1601 y = cccv_regulator_dissipation(); 1590 y = cccv_regulator_dissipation();
1602 debug_printf(line++, "P CCCV : %d mW", y); 1591 lcd_putsf(0, line++, "P CCCV : %d mW", y);
1603 1592
1604 y = battery_charge_current(); 1593 y = battery_charge_current();
1605 if (y < 0) x = '-', y = -y; 1594 if (y < 0) x = '-', y = -y;
1606 else x = ' '; 1595 else x = ' ';
1607 debug_printf(line++, "I Charge:%c%d mA", x, y); 1596 lcd_putsf(0, line++, "I Charge:%c%d mA", x, y);
1608 1597
1609 y = battery_adc_temp(); 1598 y = battery_adc_temp();
1610 1599
1611 if (y != INT_MIN) { 1600 if (y != INT_MIN) {
1612 debug_printf(line++, "T Battery: %dC (%dF)", y, 1601 lcd_putsf(0, line++, "T Battery: %dC (%dF)", y,
1613 (9*y + 160) / 5); 1602 (9*y + 160) / 5);
1614 } else { 1603 } else {
1615 /* Conversion disabled */ 1604 /* Conversion disabled */
@@ -1627,23 +1616,23 @@ static bool view_battery(void)
1627 }; 1616 };
1628 const char *str = NULL; 1617 const char *str = NULL;
1629 1618
1630 debug_printf(3, "Charger: %s", 1619 lcd_putsf(0, 3, "Charger: %s",
1631 charger_inserted() ? "present" : "absent"); 1620 charger_inserted() ? "present" : "absent");
1632 1621
1633 y = charge_state - first; 1622 y = charge_state - first;
1634 if ((unsigned)y < ARRAYLEN(chrgstate_strings)) 1623 if ((unsigned)y < ARRAYLEN(chrgstate_strings))
1635 str = chrgstate_strings[y]; 1624 str = chrgstate_strings[y];
1636 1625
1637 debug_printf(4, "State: %s", 1626 lcd_putsf(0, 4, "State: %s",
1638 str ? str : "<unknown>"); 1627 str ? str : "<unknown>");
1639 1628
1640 debug_printf(5, "CHARGER: %02X", 1629 lcd_putsf(0, 5, "CHARGER: %02X",
1641 ascodec_read(AS3514_CHARGER)); 1630 ascodec_read(AS3514_CHARGER));
1642#elif defined(IPOD_NANO2G) 1631#elif defined(IPOD_NANO2G)
1643 y = pmu_read_battery_current(); 1632 y = pmu_read_battery_current();
1644 debug_printf(2, "Battery current: %d mA", y); 1633 lcd_putsf(0, 2, "Battery current: %d mA", y);
1645#else 1634#else
1646 debug_printf(3, "Charger: %s", 1635 lcd_putsf(0, 3, "Charger: %s",
1647 charger_inserted() ? "present" : "absent"); 1636 charger_inserted() ? "present" : "absent");
1648#endif /* target type */ 1637#endif /* target type */
1649#endif /* CONFIG_CHARGING */ 1638#endif /* CONFIG_CHARGING */
@@ -1654,7 +1643,7 @@ static bool view_battery(void)
1654 1643
1655 for (i = 0; i <= 6; i++) { 1644 for (i = 0; i <= 6; i++) {
1656 y = power_history[i] - power_history[i+1]; 1645 y = power_history[i] - power_history[i+1];
1657 debug_printf(i+1, "-%d min: %s%d.%03d V", i, 1646 lcd_putsf(0, i+1, "-%d min: %s%d.%03d V", i,
1658 (y < 0) ? "-" : "", ((y < 0) ? y * -1 : y) / 1000, 1647 (y < 0) ? "-" : "", ((y < 0) ? y * -1 : y) / 1000,
1659 ((y < 0) ? y * -1 : y ) % 1000); 1648 ((y < 0) ? y * -1 : y ) % 1000);
1660 } 1649 }
@@ -1663,24 +1652,24 @@ static bool view_battery(void)
1663 case 3: /* remaining time estimation: */ 1652 case 3: /* remaining time estimation: */
1664 1653
1665#ifdef ARCHOS_RECORDER 1654#ifdef ARCHOS_RECORDER
1666 debug_printf(0, "charge_state: %d", charge_state); 1655 lcd_putsf(0, 0, "charge_state: %d", charge_state);
1667 1656
1668 debug_printf(1, "Cycle time: %d m", powermgmt_last_cycle_startstop_min); 1657 lcd_putsf(0, 1, "Cycle time: %d m", powermgmt_last_cycle_startstop_min);
1669 1658
1670 debug_printf(2, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level); 1659 lcd_putsf(0, 2, "Lvl@cyc st: %d%%", powermgmt_last_cycle_level);
1671 1660
1672 debug_printf(3, "P=%2d I=%2d", pid_p, pid_i); 1661 lcd_putsf(0, 3, "P=%2d I=%2d", pid_p, pid_i);
1673 1662
1674 debug_printf(4, "Trickle sec: %d/60", trickle_sec); 1663 lcd_putsf(0, 4, "Trickle sec: %d/60", trickle_sec);
1675#endif /* ARCHOS_RECORDER */ 1664#endif /* ARCHOS_RECORDER */
1676 1665
1677 debug_printf(5, "Last PwrHist: %d.%03dV", 1666 lcd_putsf(0, 5, "Last PwrHist: %d.%03dV",
1678 power_history[0] / 1000, 1667 power_history[0] / 1000,
1679 power_history[0] % 1000); 1668 power_history[0] % 1000);
1680 1669
1681 debug_printf(6, "battery level: %d%%", battery_level()); 1670 lcd_putsf(0, 6, "battery level: %d%%", battery_level());
1682 1671
1683 debug_printf(7, "Est. remain: %d m", battery_time()); 1672 lcd_putsf(0, 7, "Est. remain: %d m", battery_time());
1684 break; 1673 break;
1685 } 1674 }
1686 1675
@@ -2447,16 +2436,16 @@ static bool dbg_scrollwheel(void)
2447 lcd_clear_display(); 2436 lcd_clear_display();
2448 2437
2449 /* show internal variables of scrollwheel driver */ 2438 /* show internal variables of scrollwheel driver */
2450 debug_printf(0, "wheel touched: %s", (wheel_is_touched) ? "true" : "false"); 2439 lcd_putsf(0, 0, "wheel touched: %s", (wheel_is_touched) ? "true" : "false");
2451 debug_printf(1, "new position: %2d", new_wheel_value); 2440 lcd_putsf(0, 1, "new position: %2d", new_wheel_value);
2452 debug_printf(2, "old position: %2d", old_wheel_value); 2441 lcd_putsf(0, 2, "old position: %2d", old_wheel_value);
2453 debug_printf(3, "wheel delta: %2d", wheel_delta); 2442 lcd_putsf(0, 3, "wheel delta: %2d", wheel_delta);
2454 debug_printf(4, "accumulated delta: %2d", accumulated_wheel_delta); 2443 lcd_putsf(0, 4, "accumulated delta: %2d", accumulated_wheel_delta);
2455 debug_printf(5, "velo [deg/s]: %4d", (int)wheel_velocity); 2444 lcd_putsf(0, 5, "velo [deg/s]: %4d", (int)wheel_velocity);
2456 2445
2457 /* show effective accelerated scrollspeed */ 2446 /* show effective accelerated scrollspeed */
2458 speed = button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity); 2447 speed = button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity);
2459 debug_printf(6, "accel. speed: %4d", speed); 2448 lcd_putsf(0, 6, "accel. speed: %4d", speed);
2460 2449
2461 lcd_update(); 2450 lcd_update();
2462 } 2451 }
diff --git a/apps/main.c b/apps/main.c
index ca0cded351..3c93b4fea4 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -242,9 +242,6 @@ static void init_tagcache(void)
242 242
243 while (!tagcache_is_initialized()) 243 while (!tagcache_is_initialized())
244 { 244 {
245#ifdef HAVE_LCD_CHARCELLS
246 char buf[32];
247#endif
248 int ret = tagcache_get_commit_step(); 245 int ret = tagcache_get_commit_step();
249 246
250 if (ret > 0) 247 if (ret > 0)
@@ -277,9 +274,8 @@ static void init_tagcache(void)
277 } 274 }
278#else 275#else
279 lcd_double_height(false); 276 lcd_double_height(false);
280 snprintf(buf, sizeof(buf), " DB [%d/%d]", ret, 277 lcd_putsf(0, 1, " DB [%d/%d]", ret,
281 tagcache_get_max_commit_step()); 278 tagcache_get_max_commit_step());
282 lcd_puts(0, 1, buf);
283 lcd_update(); 279 lcd_update();
284#endif 280#endif
285 clear = true; 281 clear = true;
@@ -464,10 +460,8 @@ static void init(void)
464 if(rc) 460 if(rc)
465 { 461 {
466#ifdef HAVE_LCD_BITMAP 462#ifdef HAVE_LCD_BITMAP
467 char str[32];
468 lcd_clear_display(); 463 lcd_clear_display();
469 snprintf(str, 31, "ATA error: %d", rc); 464 lcd_putsf(0, 1, "ATA error: %d", rc);
470 lcd_puts(0, 1, str);
471 lcd_puts(0, 3, "Press ON to debug"); 465 lcd_puts(0, 3, "Press ON to debug");
472 lcd_update(); 466 lcd_update();
473 while(!(button_get(true) & BUTTON_REL)); /*DO NOT CHANGE TO ACTION SYSTEM */ 467 while(!(button_get(true) & BUTTON_REL)); /*DO NOT CHANGE TO ACTION SYSTEM */
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index da97306cfe..37244a65c6 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -1786,13 +1786,16 @@ bool recording_screen(bool no_source)
1786 /* draw the clipcounter just in front of the peakmeter */ 1786 /* draw the clipcounter just in front of the peakmeter */
1787 if(global_settings.peak_meter_clipcounter) 1787 if(global_settings.peak_meter_clipcounter)
1788 { 1788 {
1789 char clpstr[32]; 1789 int clipcount = pm_get_clipcount();
1790 snprintf(clpstr, 32, "%4d", pm_get_clipcount());
1791 FOR_NB_ACTIVE_SCREENS(i) 1790 FOR_NB_ACTIVE_SCREENS(i)
1792 { 1791 {
1793 if(!compact_view[i]) 1792 if(!compact_view[i])
1794 screens[i].puts(0, 2,str(LANG_PM_CLIPCOUNT)); 1793 {
1795 screens[i].puts(0, compact_view[i] ? 2 : 3, clpstr); 1794 screens[i].puts(0, 2, str(LANG_PM_CLIPCOUNT));
1795 screens[i].putsf(0, 3, "%4d", clipcount);
1796 }
1797 else
1798 screens[i].putsf(0, 2, "%4d", clipcount);
1796 } 1799 }
1797 } 1800 }
1798 1801
diff --git a/apps/screen_access.c b/apps/screen_access.c
index 5b2b4724f1..19ab77654e 100644
--- a/apps/screen_access.c
+++ b/apps/screen_access.c
@@ -182,6 +182,7 @@ struct screen screens[NB_SCREENS] =
182 182
183 .putsxy=&lcd_putsxy, 183 .putsxy=&lcd_putsxy,
184 .puts=&lcd_puts, 184 .puts=&lcd_puts,
185 .putsf=&lcd_putsf,
185 .puts_offset=&lcd_puts_offset, 186 .puts_offset=&lcd_puts_offset,
186 .puts_scroll=&lcd_puts_scroll, 187 .puts_scroll=&lcd_puts_scroll,
187 .puts_scroll_offset=&lcd_puts_scroll_offset, 188 .puts_scroll_offset=&lcd_puts_scroll_offset,
@@ -267,6 +268,7 @@ struct screen screens[NB_SCREENS] =
267#endif /* 0 */ 268#endif /* 0 */
268 .putsxy=&lcd_remote_putsxy, 269 .putsxy=&lcd_remote_putsxy,
269 .puts=&lcd_remote_puts, 270 .puts=&lcd_remote_puts,
271 .putsf=&lcd_remote_putsf,
270 .puts_offset=&lcd_remote_puts_offset, 272 .puts_offset=&lcd_remote_puts_offset,
271 .puts_scroll=&lcd_remote_puts_scroll, 273 .puts_scroll=&lcd_remote_puts_scroll,
272 .puts_scroll_offset=&lcd_remote_puts_scroll_offset, 274 .puts_scroll_offset=&lcd_remote_puts_scroll_offset,
diff --git a/apps/screen_access.h b/apps/screen_access.h
index 07fc36451d..be6247886e 100644
--- a/apps/screen_access.h
+++ b/apps/screen_access.h
@@ -129,6 +129,7 @@ struct screen
129#endif 129#endif
130 void (*putsxy)(int x, int y, const unsigned char *str); 130 void (*putsxy)(int x, int y, const unsigned char *str);
131 void (*puts)(int x, int y, const unsigned char *str); 131 void (*puts)(int x, int y, const unsigned char *str);
132 void (*putsf)(int x, int y, const unsigned char *str, ...);
132 void (*puts_offset)(int x, int y, const unsigned char *str, int offset); 133 void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
133 void (*puts_scroll)(int x, int y, const unsigned char *string); 134 void (*puts_scroll)(int x, int y, const unsigned char *string);
134 void (*puts_scroll_offset)(int x, int y, const unsigned char *string, 135 void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
diff --git a/apps/screens.c b/apps/screens.c
index eb34103a4a..cebe5df023 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -300,11 +300,9 @@ static void charging_display_info(bool animate)
300 if (ide_powered()) /* FM and V2 can only measure when ATA power is on */ 300 if (ide_powered()) /* FM and V2 can only measure when ATA power is on */
301#endif 301#endif
302 { 302 {
303 char buf[32];
304 int battv = battery_voltage(); 303 int battv = battery_voltage();
305 snprintf(buf, 32, " Batt: %d.%02dV %d%% ", battv / 1000, 304 lcd_putsf(0, 7, " Batt: %d.%02dV %d%% ", battv / 1000,
306 (battv % 1000) / 10, battery_level()); 305 (battv % 1000) / 10, battery_level());
307 lcd_puts(0, 7, buf);
308 } 306 }
309 307
310#ifdef ARCHOS_RECORDER 308#ifdef ARCHOS_RECORDER
@@ -400,8 +398,7 @@ static void charging_display_info(bool animate)
400 char buf[32]; 398 char buf[32];
401 399
402 battv = battery_voltage(); 400 battv = battery_voltage();
403 snprintf(buf, sizeof(buf), " %d.%02dV", battv / 1000, (battv % 1000) / 10); 401 lcd_putsf(4, 1, " %d.%02dV", battv / 1000, (battv % 1000) / 10);
404 lcd_puts(4, 1, buf);
405 402
406 memcpy(buf, logo_pattern, 32); /* copy logo patterns */ 403 memcpy(buf, logo_pattern, 32); /* copy logo patterns */
407 404