(Optional) logf support

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6538 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2005-05-30 13:00:43 +00:00
parent c3b1eceff1
commit edc07922eb
9 changed files with 103 additions and 39 deletions

View File

@ -1,3 +1,4 @@
logfdisp.c
alarm_menu.c
bookmark.c
credits.c

View File

@ -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
};

View File

@ -17,6 +17,8 @@
*
****************************************************************************/
#include "config.h"
#ifdef ROCKBOX_HAS_LOGF
#include <timefuncs.h>
#include <string.h>
#include <kernel.h>
@ -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 */

View File

@ -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 */

View File

@ -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
};

View File

@ -1,3 +1,4 @@
logf.c
#ifndef SIMULATOR
backlight.c
#endif

View File

@ -18,6 +18,9 @@
****************************************************************************/
#ifndef LOGF_H
#define LOGF_H
#include <config.h>
#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 */

View File

@ -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

79
tools/configure vendored
View File

@ -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" \
<<EOF
/* This header was made by configure */
#ifndef __BUILD_AUTOCONF_H
@ -602,6 +644,9 @@ sed > 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