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.tar.gz
rockbox-fb709522283bfb7558bf2b824a4143a919d59e97.zip
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 35cce6a861..e41e047720 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -30,7 +30,6 @@
30#include "file.h" 30#include "file.h"
31#include "kernel.h" 31#include "kernel.h"
32#include "sprintf.h" 32#include "sprintf.h"
33#include "logf.h"
34#include "screens.h" 33#include "screens.h"
35#include "misc.h" 34#include "misc.h"
36#include "mas.h" 35#include "mas.h"
@@ -51,6 +50,9 @@
51#include "splash.h" 50#include "splash.h"
52#include "general.h" 51#include "general.h"
53 52
53#define LOGF_ENABLE
54#include "logf.h"
55
54#ifdef SIMULATOR 56#ifdef SIMULATOR
55#if CONFIG_CODEC == SWCODEC 57#if CONFIG_CODEC == SWCODEC
56unsigned char codecbuf[CODEC_SIZE]; 58unsigned char codecbuf[CODEC_SIZE];
diff --git a/apps/playback.c b/apps/playback.c
index 5443ef5b24..03bbb9ddd2 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -46,7 +46,6 @@
46#include "settings.h" 46#include "settings.h"
47#include "codecs.h" 47#include "codecs.h"
48#include "audio.h" 48#include "audio.h"
49#include "logf.h"
50#include "mp3_playback.h" 49#include "mp3_playback.h"
51#include "usb.h" 50#include "usb.h"
52#include "status.h" 51#include "status.h"
@@ -98,13 +97,17 @@
98 * for their correct seeek target, 32k seems a good size */ 97 * for their correct seeek target, 32k seems a good size */
99#define AUDIO_REBUFFER_GUESS_SIZE (1024*32) 98#define AUDIO_REBUFFER_GUESS_SIZE (1024*32)
100 99
100/* Define LOGF_ENABLE to enable logf output in this file */
101/*#define LOGF_ENABLE*/
102#include "logf.h"
103
101/* macros to enable logf for queues 104/* macros to enable logf for queues
102 logging on SYS_TIMEOUT can be disabled */ 105 logging on SYS_TIMEOUT can be disabled */
103#ifdef SIMULATOR 106#ifdef SIMULATOR
104/* Define this for logf output of all queuing except SYS_TIMEOUT */ 107/* Define this for logf output of all queuing except SYS_TIMEOUT */
105#define PLAYBACK_LOGQUEUES 108#define PLAYBACK_LOGQUEUES
106/* Define this to logf SYS_TIMEOUT messages */ 109/* Define this to logf SYS_TIMEOUT messages */
107#define PLAYBACK_LOGQUEUES_SYS_TIMEOUT 110/*#define PLAYBACK_LOGQUEUES_SYS_TIMEOUT*/
108#endif 111#endif
109 112
110#ifdef PLAYBACK_LOGQUEUES 113#ifdef PLAYBACK_LOGQUEUES
@@ -3556,7 +3559,7 @@ static void audio_reset_buffer(void)
3556 /* Clear any references to the file buffer */ 3559 /* Clear any references to the file buffer */
3557 buffer_state = BUFFER_STATE_INITIALIZED; 3560 buffer_state = BUFFER_STATE_INITIALIZED;
3558 3561
3559#ifdef ROCKBOX_HAS_LOGF 3562#if defined(ROCKBOX_HAS_LOGF) && defined(LOGF_ENABLE)
3560 /* Make sure everything adds up - yes, some info is a bit redundant but 3563 /* Make sure everything adds up - yes, some info is a bit redundant but
3561 aids viewing and the sumation of certain variables should add up to 3564 aids viewing and the sumation of certain variables should add up to
3562 the location of others. */ 3565 the location of others. */
diff --git a/firmware/export/logf.h b/firmware/export/logf.h
index 868e8fc723..b706f3a4b0 100644
--- a/firmware/export/logf.h
+++ b/firmware/export/logf.h
@@ -21,6 +21,7 @@
21#include <config.h> 21#include <config.h>
22#include <stdbool.h> 22#include <stdbool.h>
23#include "../include/_ansi.h" 23#include "../include/_ansi.h"
24#include "debug.h"
24 25
25#ifdef ROCKBOX_HAS_LOGF 26#ifdef ROCKBOX_HAS_LOGF
26 27
@@ -38,8 +39,16 @@ extern bool logfwrap;
38void _logf(const char *format, ...) ATTRIBUTE_PRINTF(1, 2); 39void _logf(const char *format, ...) ATTRIBUTE_PRINTF(1, 2);
39 40
40#else /* !ROCKBOX_HAS_LOGF */ 41#else /* !ROCKBOX_HAS_LOGF */
41/* built without logf() support enabled */ 42
42#define logf(...) 43/* built without logf() support enabled, replace logf() by DEBUGF() */
44#define logf(f,args...) DEBUGF(f"\n",##args)
45
43#endif /* !ROCKBOX_HAS_LOGF */ 46#endif /* !ROCKBOX_HAS_LOGF */
44 47
45#endif /* LOGF_H */ 48#endif /* LOGF_H */
49
50/* Allow fine tuning (per file) of the logf output */
51#ifndef LOGF_ENABLE
52#undef logf
53#define logf(...)
54#endif