summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-05-30 13:00:43 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-05-30 13:00:43 +0000
commitedc07922eb9e179e7cada5bae60828d72f71c207 (patch)
tree81c6c560b1b2bbe39e6c229ffa4d6f248f28c295
parentc3b1eceff1daae7fdb7348bb70b309c37d3f6376 (diff)
downloadrockbox-edc07922eb9e179e7cada5bae60828d72f71c207.tar.gz
rockbox-edc07922eb9e179e7cada5bae60828d72f71c207.zip
(Optional) logf support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6538 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES1
-rw-r--r--apps/debug_menu.c4
-rw-r--r--apps/logfdisp.c13
-rw-r--r--apps/logfdisp.h7
-rw-r--r--apps/main_menu.c25
-rw-r--r--firmware/SOURCES1
-rw-r--r--firmware/export/logf.h7
-rw-r--r--firmware/logf.c5
-rwxr-xr-xtools/configure79
9 files changed, 103 insertions, 39 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 10a04da6ea..8bf0ed37db 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -1,3 +1,4 @@
1logfdisp.c
1alarm_menu.c 2alarm_menu.c
2bookmark.c 3bookmark.c
3credits.c 4credits.c
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 044e5f73e3..5f4e67f537 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -57,6 +57,7 @@
57#ifdef HAVE_MMC 57#ifdef HAVE_MMC
58#include "ata_mmc.h" 58#include "ata_mmc.h"
59#endif 59#endif
60#include "logfdisp.h"
60 61
61#ifdef IRIVER_H100 62#ifdef IRIVER_H100
62#include "uda1380.h" 63#include "uda1380.h"
@@ -2047,6 +2048,9 @@ bool debug_menu(void)
2047#ifdef CONFIG_TUNER 2048#ifdef CONFIG_TUNER
2048 { "FM Radio", dbg_fm_radio }, 2049 { "FM Radio", dbg_fm_radio },
2049#endif 2050#endif
2051#ifdef ROCKBOX_HAS_LOGF
2052 {"logf", logfdisplay },
2053#endif
2050 }; 2054 };
2051 2055
2052 m=menu_init( items, sizeof items / sizeof(struct menu_item), NULL, 2056 m=menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
diff --git a/apps/logfdisp.c b/apps/logfdisp.c
index 510cb28b57..36c4997aa8 100644
--- a/apps/logfdisp.c
+++ b/apps/logfdisp.c
@@ -17,6 +17,8 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "config.h" 19#include "config.h"
20
21#ifdef ROCKBOX_HAS_LOGF
20#include <timefuncs.h> 22#include <timefuncs.h>
21#include <string.h> 23#include <string.h>
22#include <kernel.h> 24#include <kernel.h>
@@ -74,4 +76,13 @@ bool logfdisplay(void)
74 76
75 return false; 77 return false;
76} 78}
77#endif 79#else /* HAVE_LCD_BITMAP */
80bool logfdisplay(void)
81
82{
83 /* TODO: implement a browser for charcell bitmaps */
84 return false;
85}
86#endif /* HAVE_LCD_BITMAP */
87
88#endif /* ROCKBOX_HAS_LOGF */
diff --git a/apps/logfdisp.h b/apps/logfdisp.h
index 58ec9b9969..1b0d8c9ddb 100644
--- a/apps/logfdisp.h
+++ b/apps/logfdisp.h
@@ -16,6 +16,9 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#ifdef HAVE_LCD_BITMAP 19#ifndef LOGFDISP_H
20#define LOGFDISP_H
20bool logfdisplay(void); 21bool logfdisplay(void);
21#endif 22
23#endif /* LOGFDISP_H */
24
diff --git a/apps/main_menu.c b/apps/main_menu.c
index e1bf424d36..44321142c8 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -51,6 +51,7 @@
51#endif 51#endif
52#include "misc.h" 52#include "misc.h"
53#include "lang.h" 53#include "lang.h"
54#include "logfdisp.h"
54 55
55#ifdef HAVE_RECORDING 56#ifdef HAVE_RECORDING
56#include "recording.h" 57#include "recording.h"
@@ -80,25 +81,8 @@ int show_logo( void )
80#endif 81#endif
81 82
82#ifdef HAVE_REMOTE_LCD 83#ifdef HAVE_REMOTE_LCD
83 lcd_remote_bitmap(rockbox112x37,10,14,112,37, false); 84 lcd_remote_clear_display();
84#endif 85 lcd_remote_bitmap(rockbox112x37,10,14,112,37, false);
85
86#if 0
87 /*
88 * This code is not used anymore, but I kept it here since it shows
89 * one way of using the BMP reader function to display an externally
90 * providing logo.
91 */
92 unsigned char buffer[112 * 8];
93 int width, height;
94
95 int failure;
96 failure = read_bmp_file("/rockbox112.bmp", &width, &height, buffer);
97
98 debugf("read_bmp_file() returned %d, width %d height %d\n",
99 failure, width, height);
100
101 lcd_bitmap(&buffer, 0, 10, width, height, false);
102#endif 86#endif
103 87
104 snprintf(version, sizeof(version), "Ver. %s", appsversion); 88 snprintf(version, sizeof(version), "Ver. %s", appsversion);
@@ -365,6 +349,9 @@ bool info_menu(void)
365 { ID2P(LANG_DEBUG), debug_menu }, 349 { ID2P(LANG_DEBUG), debug_menu },
366#else 350#else
367 { ID2P(LANG_USB), simulate_usb }, 351 { ID2P(LANG_USB), simulate_usb },
352#ifdef ROCKBOX_HAS_LOGF
353 {"logf", logfdisplay },
354#endif
368#endif 355#endif
369 }; 356 };
370 357
diff --git a/firmware/SOURCES b/firmware/SOURCES
index b6eeaec3f1..0ea55b382f 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1,3 +1,4 @@
1logf.c
1#ifndef SIMULATOR 2#ifndef SIMULATOR
2backlight.c 3backlight.c
3#endif 4#endif
diff --git a/firmware/export/logf.h b/firmware/export/logf.h
index af7d7eeb34..f74f50377e 100644
--- a/firmware/export/logf.h
+++ b/firmware/export/logf.h
@@ -18,6 +18,9 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19#ifndef LOGF_H 19#ifndef LOGF_H
20#define LOGF_H 20#define LOGF_H
21#include <config.h>
22
23#ifdef ROCKBOX_HAS_LOGF
21 24
22#define MAX_LOGF_LINES 1000 25#define MAX_LOGF_LINES 1000
23#define MAX_LOGF_DATASIZE (16*MAX_LOGF_LINES) 26#define MAX_LOGF_DATASIZE (16*MAX_LOGF_LINES)
@@ -27,5 +30,9 @@ extern int logfindex;
27extern bool logfwrap; 30extern bool logfwrap;
28 31
29void logf(const char *format, ...); 32void logf(const char *format, ...);
33#else
34/* built without logf() support enabled */
35#define logf(...)
36#endif
30 37
31#endif /* LOGF_H */ 38#endif /* LOGF_H */
diff --git a/firmware/logf.c b/firmware/logf.c
index ac25d65690..ab3d621428 100644
--- a/firmware/logf.c
+++ b/firmware/logf.c
@@ -33,6 +33,9 @@
33#include "lcd-remote.h" 33#include "lcd-remote.h"
34#include "logf.h" 34#include "logf.h"
35 35
36/* Only provide all this if asked to */
37#ifdef ROCKBOX_HAS_LOGF
38
36unsigned char logfbuffer[MAX_LOGF_LINES][16]; 39unsigned char logfbuffer[MAX_LOGF_LINES][16];
37int logfindex; 40int logfindex;
38bool logfwrap; 41bool logfwrap;
@@ -96,3 +99,5 @@ void logf(const char *format, ...)
96 99
97 displayremote(); 100 displayremote();
98} 101}
102
103#endif
diff --git a/tools/configure b/tools/configure
index 2f4c83581d..1af5d2a54e 100755
--- a/tools/configure
+++ b/tools/configure
@@ -11,6 +11,8 @@
11# global CC options for all platforms 11# global CC options for all platforms
12CCOPTS="-W -Wall -O -nostdlib -ffreestanding -Wstrict-prototypes" 12CCOPTS="-W -Wall -O -nostdlib -ffreestanding -Wstrict-prototypes"
13 13
14use_logf="#undef ROCKBOX_HAS_LOGF"
15
14# 16#
15# Begin Function Definitions 17# Begin Function Definitions
16# 18#
@@ -171,6 +173,48 @@ whichaddr () {
171 esac 173 esac
172} 174}
173 175
176whichdevel () {
177 ##################################################################
178 # Prompt for specific developer options
179 #
180 echo ""
181 echo "Enter your developer options (press enter when done)"
182 echo "(D)EBUG, (L)ogf, (S)imulator"
183 cont=1
184
185 while [ $cont = "1" ]; do
186
187 option=`input`;
188
189 case $option in
190 [Dd])
191 echo "define DEBUG"
192 debug="1"
193 GCCOPTS="$GCCOPTS -g -DDEBUG"
194 ;;
195 [Ll])
196 logf="yes"
197 echo "logf() support enabled"
198 use_logf="#define ROCKBOX_HAS_LOGF 1"
199 ;;
200 [Ss])
201 echo "Simulator build enabled"
202 simulator="yes"
203 ;;
204 *)
205 echo "done"
206 cont=0
207 ;;
208 esac
209 done
210
211 if [ "yes" = "$simulator" ]; then
212 debug="1"
213 extradefines="-DSIMULATOR"
214 whichsim
215 fi
216}
217
174whichsim () { 218whichsim () {
175 219
176if [ -z "$simver" ]; then 220if [ -z "$simver" ]; then
@@ -230,9 +274,6 @@ whichlang() {
230 done 274 done
231} 275}
232 276
233target=$1
234debug=$2
235
236if test "$1" = "--help"; then 277if test "$1" = "--help"; then
237 echo "Rockbox configure script." 278 echo "Rockbox configure script."
238 echo "Invoke this in a directory to generate a Makefile to build Rockbox" 279 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
@@ -318,8 +359,6 @@ fi
318apps="apps" 359apps="apps"
319appsdir='\$(ROOTDIR)/apps' 360appsdir='\$(ROOTDIR)/apps'
320 361
321if [ -z "$archos" ]; then
322
323################################################################## 362##################################################################
324# Figure out target platform 363# Figure out target platform
325# 364#
@@ -469,7 +508,10 @@ if [ -z "$archos" ]; then
469 508
470 echo "Platform set to $archos" 509 echo "Platform set to $archos"
471 510
472fi 511
512############################################################################
513# Amount of memory, for those that can differ.
514#
473 515
474if [ -z "$memory" ]; then 516if [ -z "$memory" ]; then
475 size="2" 517 size="2"
@@ -490,11 +532,11 @@ if [ -z "$memory" ]; then
490 echo "Memory size selected: $memory MB" 532 echo "Memory size selected: $memory MB"
491fi 533fi
492 534
493if [ -z "$debug" ]; then 535##################################################################
494 ################################################################## 536# Figure out build "type"
495 # Figure out debug on/off 537#
496 # 538 echo ""
497 echo "Build (N)ormal, (D)ebug, (S)imulator, (B)ootloader? (N)" 539 echo "Build (N)ormal, (D)evel, (S)imulator, (B)ootloader? (N)"
498 540
499 option=`input`; 541 option=`input`;
500 542
@@ -518,9 +560,8 @@ if [ -z "$debug" ]; then
518 whichsim 560 whichsim
519 ;; 561 ;;
520 [Dd]) 562 [Dd])
521 debug="1" 563 echo "Devel build selected"
522 echo "Debug build selected" 564 whichdevel
523 GCCOPTS="$GCCOPTS -g -DDEBUG"
524 ;; 565 ;;
525 *) 566 *)
526 debug="" 567 debug=""
@@ -529,11 +570,12 @@ if [ -z "$debug" ]; then
529 ;; 570 ;;
530 571
531 esac 572 esac
532fi 573
533 574
534whichaddr 575whichaddr
535 576
536if [ -z "$language" ]; then 577############################################################################
578# language
537 579
538 echo "Select a number for the language to use (default is english)" 580 echo "Select a number for the language to use (default is english)"
539 581
@@ -545,7 +587,6 @@ if [ -z "$language" ]; then
545 language="english" 587 language="english"
546 fi 588 fi
547 echo "Language set to $language" 589 echo "Language set to $language"
548fi
549 590
550uname=`uname` 591uname=`uname`
551 592
@@ -594,6 +635,7 @@ fi
594 635
595sed > autoconf.h \ 636sed > autoconf.h \
596 -e "s,@ENDIAN@,${defendian},g" \ 637 -e "s,@ENDIAN@,${defendian},g" \
638 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
597<<EOF 639<<EOF
598/* This header was made by configure */ 640/* This header was made by configure */
599#ifndef __BUILD_AUTOCONF_H 641#ifndef __BUILD_AUTOCONF_H
@@ -602,6 +644,9 @@ sed > autoconf.h \
602/* Define endianess for the target or simulator platform */ 644/* Define endianess for the target or simulator platform */
603#define @ENDIAN@ 1 645#define @ENDIAN@ 1
604 646
647/* Define this if you build rockbox to support the logf logging and display */
648#undef ROCKBOX_HAS_LOGF
649
605#endif /* __BUILD_AUTOCONF_H */ 650#endif /* __BUILD_AUTOCONF_H */
606EOF 651EOF
607 652