diff --git a/apps/SOURCES b/apps/SOURCES index 10a04da6ea..8bf0ed37db 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -1,3 +1,4 @@ +logfdisp.c alarm_menu.c bookmark.c credits.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 @@ #ifdef HAVE_MMC #include "ata_mmc.h" #endif +#include "logfdisp.h" #ifdef IRIVER_H100 #include "uda1380.h" @@ -2046,6 +2047,9 @@ bool debug_menu(void) { "View runtime", view_runtime }, #ifdef CONFIG_TUNER { "FM Radio", dbg_fm_radio }, +#endif +#ifdef ROCKBOX_HAS_LOGF + {"logf", logfdisplay }, #endif }; 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 @@ * ****************************************************************************/ #include "config.h" + +#ifdef ROCKBOX_HAS_LOGF #include #include #include @@ -74,4 +76,13 @@ bool logfdisplay(void) return false; } -#endif +#else /* HAVE_LCD_BITMAP */ +bool logfdisplay(void) + +{ + /* TODO: implement a browser for charcell bitmaps */ + return false; +} +#endif /* HAVE_LCD_BITMAP */ + +#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 @@ * KIND, either express or implied. * ****************************************************************************/ -#ifdef HAVE_LCD_BITMAP +#ifndef LOGFDISP_H +#define LOGFDISP_H bool logfdisplay(void); -#endif + +#endif /* LOGFDISP_H */ + 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 @@ #endif #include "misc.h" #include "lang.h" +#include "logfdisp.h" #ifdef HAVE_RECORDING #include "recording.h" @@ -80,25 +81,8 @@ int show_logo( void ) #endif #ifdef HAVE_REMOTE_LCD - lcd_remote_bitmap(rockbox112x37,10,14,112,37, false); -#endif - -#if 0 - /* - * This code is not used anymore, but I kept it here since it shows - * one way of using the BMP reader function to display an externally - * providing logo. - */ - unsigned char buffer[112 * 8]; - int width, height; - - int failure; - failure = read_bmp_file("/rockbox112.bmp", &width, &height, buffer); - - debugf("read_bmp_file() returned %d, width %d height %d\n", - failure, width, height); - - lcd_bitmap(&buffer, 0, 10, width, height, false); + lcd_remote_clear_display(); + lcd_remote_bitmap(rockbox112x37,10,14,112,37, false); #endif snprintf(version, sizeof(version), "Ver. %s", appsversion); @@ -365,6 +349,9 @@ bool info_menu(void) { ID2P(LANG_DEBUG), debug_menu }, #else { ID2P(LANG_USB), simulate_usb }, +#ifdef ROCKBOX_HAS_LOGF + {"logf", logfdisplay }, +#endif #endif }; diff --git a/firmware/SOURCES b/firmware/SOURCES index b6eeaec3f1..0ea55b382f 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -1,3 +1,4 @@ +logf.c #ifndef SIMULATOR backlight.c #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 @@ ****************************************************************************/ #ifndef LOGF_H #define LOGF_H +#include + +#ifdef ROCKBOX_HAS_LOGF #define MAX_LOGF_LINES 1000 #define MAX_LOGF_DATASIZE (16*MAX_LOGF_LINES) @@ -27,5 +30,9 @@ extern int logfindex; extern bool logfwrap; void logf(const char *format, ...); +#else +/* built without logf() support enabled */ +#define logf(...) +#endif #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 @@ #include "lcd-remote.h" #include "logf.h" +/* Only provide all this if asked to */ +#ifdef ROCKBOX_HAS_LOGF + unsigned char logfbuffer[MAX_LOGF_LINES][16]; int logfindex; bool logfwrap; @@ -96,3 +99,5 @@ void logf(const char *format, ...) displayremote(); } + +#endif diff --git a/tools/configure b/tools/configure index 2f4c83581d..1af5d2a54e 100755 --- a/tools/configure +++ b/tools/configure @@ -11,6 +11,8 @@ # global CC options for all platforms CCOPTS="-W -Wall -O -nostdlib -ffreestanding -Wstrict-prototypes" +use_logf="#undef ROCKBOX_HAS_LOGF" + # # Begin Function Definitions # @@ -171,6 +173,48 @@ whichaddr () { esac } +whichdevel () { + ################################################################## + # Prompt for specific developer options + # + echo "" + echo "Enter your developer options (press enter when done)" + echo "(D)EBUG, (L)ogf, (S)imulator" + cont=1 + + while [ $cont = "1" ]; do + + option=`input`; + + case $option in + [Dd]) + echo "define DEBUG" + debug="1" + GCCOPTS="$GCCOPTS -g -DDEBUG" + ;; + [Ll]) + logf="yes" + echo "logf() support enabled" + use_logf="#define ROCKBOX_HAS_LOGF 1" + ;; + [Ss]) + echo "Simulator build enabled" + simulator="yes" + ;; + *) + echo "done" + cont=0 + ;; + esac + done + + if [ "yes" = "$simulator" ]; then + debug="1" + extradefines="-DSIMULATOR" + whichsim + fi +} + whichsim () { if [ -z "$simver" ]; then @@ -230,9 +274,6 @@ whichlang() { done } -target=$1 -debug=$2 - if test "$1" = "--help"; then echo "Rockbox configure script." echo "Invoke this in a directory to generate a Makefile to build Rockbox" @@ -318,8 +359,6 @@ fi apps="apps" appsdir='\$(ROOTDIR)/apps' -if [ -z "$archos" ]; then - ################################################################## # Figure out target platform # @@ -469,7 +508,10 @@ if [ -z "$archos" ]; then echo "Platform set to $archos" -fi + +############################################################################ +# Amount of memory, for those that can differ. +# if [ -z "$memory" ]; then size="2" @@ -490,11 +532,11 @@ if [ -z "$memory" ]; then echo "Memory size selected: $memory MB" fi -if [ -z "$debug" ]; then - ################################################################## - # Figure out debug on/off - # - echo "Build (N)ormal, (D)ebug, (S)imulator, (B)ootloader? (N)" +################################################################## +# Figure out build "type" +# + echo "" + echo "Build (N)ormal, (D)evel, (S)imulator, (B)ootloader? (N)" option=`input`; @@ -518,9 +560,8 @@ if [ -z "$debug" ]; then whichsim ;; [Dd]) - debug="1" - echo "Debug build selected" - GCCOPTS="$GCCOPTS -g -DDEBUG" + echo "Devel build selected" + whichdevel ;; *) debug="" @@ -529,11 +570,12 @@ if [ -z "$debug" ]; then ;; esac -fi + whichaddr -if [ -z "$language" ]; then +############################################################################ +# language echo "Select a number for the language to use (default is english)" @@ -545,7 +587,6 @@ if [ -z "$language" ]; then language="english" fi echo "Language set to $language" -fi uname=`uname` @@ -594,6 +635,7 @@ fi sed > autoconf.h \ -e "s,@ENDIAN@,${defendian},g" \ + -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \ < autoconf.h \ /* Define endianess for the target or simulator platform */ #define @ENDIAN@ 1 +/* Define this if you build rockbox to support the logf logging and display */ +#undef ROCKBOX_HAS_LOGF + #endif /* __BUILD_AUTOCONF_H */ EOF