summaryrefslogtreecommitdiff
path: root/lib/rbcodec/test
diff options
context:
space:
mode:
authorSean Bartell <wingedtachikoma@gmail.com>2011-10-30 12:05:04 -0400
committerNils Wallménius <nils@rockbox.org>2012-05-03 14:49:35 +0200
commitcadb3627fcc32cec3a97183c0a1462fe0ff04755 (patch)
treeed3ec41d5231a604a7c3d368dbf8172d9ab1ea0a /lib/rbcodec/test
parent5f0cb713615c844d9133f3664333a73816bbfd17 (diff)
Add rbcodecplatform.h and rbcodecconfig.h.
librbcodec users must provide these two files when the library is built. rbcodecconfig.h provides configuration #defines and basic types, and will be included by public librbcodec headers, so it must not conflict with the user's code. rbcodecplatform.h provides various OS functions, and will only be included by source files and private headers. This system is intended to provide maximum flexibility for use on embedded systems, where no operating system headers are included. Unix systems can just copy rbcodecconfig-example.h and rbcodecplatform-unix.h with minimal changes. Change-Id: I350a2274d173da391fd1ca00c4202e9760d91def Reviewed-on: http://gerrit.rockbox.org/143 Reviewed-by: Nils Wallménius <nils@rockbox.org> Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/test')
-rw-r--r--lib/rbcodec/test/rbcodecconfig.h2
-rw-r--r--lib/rbcodec/test/rbcodecplatform.h2
-rw-r--r--lib/rbcodec/test/warble.c30
-rw-r--r--lib/rbcodec/test/warble.make16
4 files changed, 39 insertions, 11 deletions
diff --git a/lib/rbcodec/test/rbcodecconfig.h b/lib/rbcodec/test/rbcodecconfig.h
new file mode 100644
index 0000000000..5e9c3bd0e8
--- /dev/null
+++ b/lib/rbcodec/test/rbcodecconfig.h
@@ -0,0 +1,2 @@
+#include "../rbcodecconfig-example.h"
+
diff --git a/lib/rbcodec/test/rbcodecplatform.h b/lib/rbcodec/test/rbcodecplatform.h
new file mode 100644
index 0000000000..1b51a9707c
--- /dev/null
+++ b/lib/rbcodec/test/rbcodecplatform.h
@@ -0,0 +1,2 @@
+#include "../rbcodecplatform-unix.h"
+
diff --git a/lib/rbcodec/test/warble.c b/lib/rbcodec/test/warble.c
index 2f52062e50..53d360d89e 100644
--- a/lib/rbcodec/test/warble.c
+++ b/lib/rbcodec/test/warble.c
@@ -34,12 +34,13 @@
#include "buffering.h" /* TYPE_PACKET_AUDIO */
#include "codecs.h"
#include "core_alloc.h" /* core_allocator_init */
-#include "debug.h"
#include "dsp_core.h"
#include "metadata.h"
#include "settings.h"
#include "sound.h"
#include "tdspeed.h"
+#include "kernel.h"
+#include "platform.h"
/***************** EXPORTED *****************/
@@ -581,6 +582,29 @@ static unsigned ci_sleep(unsigned ticks)
return 0;
}
+static void ci_debugf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+}
+
+#ifdef ROCKBOX_HAS_LOGF
+static void ci_logf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ putc('\n', stderr);
+ va_end(ap);
+}
+#endif
+
+static void commit_dcache(void) {}
+static void commit_discard_dcache(void) {}
+static void commit_discard_idcache(void) {}
+
static struct codec_api ci = {
0, /* filesize */
@@ -628,10 +652,10 @@ static struct codec_api ci = {
memcmp,
memchr,
#if defined(DEBUG) || defined(SIMULATOR)
- debugf,
+ ci_debugf,
#endif
#ifdef ROCKBOX_HAS_LOGF
- debugf, /* logf */
+ ci_logf,
#endif
qsort,
diff --git a/lib/rbcodec/test/warble.make b/lib/rbcodec/test/warble.make
index f2234c03b5..b238a2ed63 100644
--- a/lib/rbcodec/test/warble.make
+++ b/lib/rbcodec/test/warble.make
@@ -7,20 +7,20 @@
# $Id$
#
-
-
RBCODECLIB_DIR = $(ROOTDIR)/lib/rbcodec
RBCODEC_BLD = $(BUILDDIR)/lib/rbcodec
-GCCOPTS += -D__PCTOOL__ $(TARGET) -DDEBUG -g -std=gnu99 `$(SDLCONFIG) --cflags` -DCODECDIR="\"$(CODECDIR)\""
+GCCOPTS += -D__PCTOOL__ $(TARGET) -DDEBUG -g -std=gnu99 \
+ `$(SDLCONFIG) --cflags` -DCODECDIR="\"$(CODECDIR)\""
+RBCODEC_CFLAGS += -D_FILE_H_ #-DLOGF_H -DDEBUG_H -D_KERNEL_H_ # will be removed later
SRC= $(call preprocess, $(ROOTDIR)/lib/rbcodec/test/SOURCES)
-INCLUDES += -I$(ROOTDIR)/apps -I$(ROOTDIR)/apps/gui
-INCLUDES += -I$(ROOTDIR)/firmware/export -I$(ROOTDIR)/firmware/include \
- -I$(ROOTDIR)/firmware/target/hosted \
- -I$(ROOTDIR)/firmware/target/hosted/sdl
-
+INCLUDES += -I$(ROOTDIR)/lib/rbcodec/test \
+ -I$(ROOTDIR)/apps -I$(ROOTDIR)/apps/gui \
+ -I$(ROOTDIR)/firmware/export -I$(ROOTDIR)/firmware/include \
+ -I$(ROOTDIR)/firmware/target/hosted \
+ -I$(ROOTDIR)/firmware/target/hosted/sdl
.SECONDEXPANSION: # $$(OBJ) is not populated until after this