summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-10-24 22:06:36 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-10-24 22:06:36 +0000
commitfb709522283bfb7558bf2b824a4143a919d59e97 (patch)
tree70b1c52bcd1c3e6aaa89e322674b5afe2b780467
parent4c22f0bf73ce06b4c82cc92d636067aacf061d72 (diff)
downloadrockbox-fb709522283bfb7558bf2b824a4143a919d59e97.zip
rockbox-fb709522283bfb7558bf2b824a4143a919d59e97.tar.gz
rockbox-fb709522283bfb7558bf2b824a4143a919d59e97.tar.bz2
rockbox-fb709522283bfb7558bf2b824a4143a919d59e97.tar.xz
logf changes:
* Disable logf by default and allow per-file enabling with "#define LOGF_ENABLE". To enable globally add that define in the config.h file. * Transform logf calls into DEBUGF calls when ROCKBOX_HAS_LOGF isn't defined, so that they get printed to the console in the sim. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15291 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs.c4
-rw-r--r--apps/playback.c9
-rw-r--r--firmware/export/logf.h13
3 files changed, 20 insertions, 6 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index 35cce6a..e41e047 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -30,7 +30,6 @@
#include "file.h"
#include "kernel.h"
#include "sprintf.h"
-#include "logf.h"
#include "screens.h"
#include "misc.h"
#include "mas.h"
@@ -51,6 +50,9 @@
#include "splash.h"
#include "general.h"
+#define LOGF_ENABLE
+#include "logf.h"
+
#ifdef SIMULATOR
#if CONFIG_CODEC == SWCODEC
unsigned char codecbuf[CODEC_SIZE];
diff --git a/apps/playback.c b/apps/playback.c
index 5443ef5..03bbb9d 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -46,7 +46,6 @@
#include "settings.h"
#include "codecs.h"
#include "audio.h"
-#include "logf.h"
#include "mp3_playback.h"
#include "usb.h"
#include "status.h"
@@ -98,13 +97,17 @@
* for their correct seeek target, 32k seems a good size */
#define AUDIO_REBUFFER_GUESS_SIZE (1024*32)
+/* Define LOGF_ENABLE to enable logf output in this file */
+/*#define LOGF_ENABLE*/
+#include "logf.h"
+
/* macros to enable logf for queues
logging on SYS_TIMEOUT can be disabled */
#ifdef SIMULATOR
/* Define this for logf output of all queuing except SYS_TIMEOUT */
#define PLAYBACK_LOGQUEUES
/* Define this to logf SYS_TIMEOUT messages */
-#define PLAYBACK_LOGQUEUES_SYS_TIMEOUT
+/*#define PLAYBACK_LOGQUEUES_SYS_TIMEOUT*/
#endif
#ifdef PLAYBACK_LOGQUEUES
@@ -3556,7 +3559,7 @@ static void audio_reset_buffer(void)
/* Clear any references to the file buffer */
buffer_state = BUFFER_STATE_INITIALIZED;
-#ifdef ROCKBOX_HAS_LOGF
+#if defined(ROCKBOX_HAS_LOGF) && defined(LOGF_ENABLE)
/* Make sure everything adds up - yes, some info is a bit redundant but
aids viewing and the sumation of certain variables should add up to
the location of others. */
diff --git a/firmware/export/logf.h b/firmware/export/logf.h
index 868e8fc..b706f3a 100644
--- a/firmware/export/logf.h
+++ b/firmware/export/logf.h
@@ -21,6 +21,7 @@
#include <config.h>
#include <stdbool.h>
#include "../include/_ansi.h"
+#include "debug.h"
#ifdef ROCKBOX_HAS_LOGF
@@ -38,8 +39,16 @@ extern bool logfwrap;
void _logf(const char *format, ...) ATTRIBUTE_PRINTF(1, 2);
#else /* !ROCKBOX_HAS_LOGF */
-/* built without logf() support enabled */
-#define logf(...)
+
+/* built without logf() support enabled, replace logf() by DEBUGF() */
+#define logf(f,args...) DEBUGF(f"\n",##args)
+
#endif /* !ROCKBOX_HAS_LOGF */
#endif /* LOGF_H */
+
+/* Allow fine tuning (per file) of the logf output */
+#ifndef LOGF_ENABLE
+#undef logf
+#define logf(...)
+#endif