diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-10-30 12:05:04 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-05-03 14:49:35 +0200 |
commit | cadb3627fcc32cec3a97183c0a1462fe0ff04755 (patch) | |
tree | ed3ec41d5231a604a7c3d368dbf8172d9ab1ea0a /lib/rbcodec/platform.h | |
parent | 5f0cb713615c844d9133f3664333a73816bbfd17 (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/platform.h')
-rw-r--r-- | lib/rbcodec/platform.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/lib/rbcodec/platform.h b/lib/rbcodec/platform.h new file mode 100644 index 0000000000..47df8fe6a2 --- /dev/null +++ b/lib/rbcodec/platform.h @@ -0,0 +1,122 @@ +#ifndef PLATFORM_H_INCLUDED +#define PLATFORM_H_INCLUDED + +#include "rbcodecconfig.h" +#include "rbcodecplatform.h" + +/* + +#ifndef ROCKBOX +# define __PCTOOL__ +# define RBCODEC_NOT_ROCKBOX +# define ROCKBOX +#endif + +#ifndef HAVE_STRLCPY +size_t strlcpy(char *dst, const char *src, size_t siz); +#endif +*/ +#ifndef ARRAYLEN +# define ARRAYLEN(a) (sizeof(a) / sizeof((a)[0])) +#endif + +#ifndef MIN +# define MIN(x, y) ((x)<(y) ? (x) : (y)) +#endif + +#ifndef MAX +# define MAX(x, y) ((x)>(y) ? (x) : (y)) +#endif + +#ifndef BIT_N +# define BIT_N(n) (1U << (n)) +#endif +/* +#ifdef CODEC + +# ifdef debugf +# undef debugf +# endif + +# ifdef logf +# undef logf +# endif + +#else + +# ifndef DEBUGF +# define DEBUGF debugf +# endif + +# ifndef debugf +# define debugf(...) do { } while (0) +# endif + +# ifndef logf +# define logf(...) do { } while (0) +# endif + +#endif + +#ifndef ATTRIBUTE_PRINTF +# define ATTRIBUTE_PRINTF(fmt, arg1) +#endif + +#ifndef LIKELY +# define LIKELY(x) (x) +#endif + +#ifndef UNLIKELY +# define UNLIKELY(x) (x) +#endif +*/ +#ifndef CACHEALIGN_ATTR +# define CACHEALIGN_ATTR +#endif +/* +#ifndef DATA_ATTR +# define DATA_ATTR +#endif +*/ +#ifndef IBSS_ATTR +# define IBSS_ATTR +#endif + +#ifndef ICODE_ATTR +# define ICODE_ATTR +#endif + +#ifndef ICONST_ATTR +# define ICONST_ATTR +#endif + +#ifndef IDATA_ATTR +# define IDATA_ATTR +#endif +/* +#ifndef INIT_ATTR +# define INIT_ATTR +#endif +*/ +#ifndef MEM_ALIGN_ATTR +# define MEM_ALIGN_ATTR +#endif +/* +#ifndef STATICIRAM +# define STATICIRAM +#endif +*/ +#ifndef CACHEALIGN_SIZE +# define CACHEALIGN_SIZE 1 +#endif +/* +#ifndef HAVE_CLIP_SAMPLE_16 +static inline int32_t clip_sample_16(int32_t sample) +{ + if ((int16_t)sample != sample) + sample = 0x7fff ^ (sample >> 31); + return sample; +} +#endif +*/ +#endif /* PLATFORM_H_INCLUDED */ |