diff options
| author | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-23 04:34:18 +0000 |
|---|---|---|
| committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-23 04:34:18 +0000 |
| commit | 2494afccc4d1e0dbd085c5b7ed5518815281b422 (patch) | |
| tree | 4ad37b2a4800ce99687fcb9d5eb0877c888eaa55 | |
| parent | 6281d8e21434878a72e63bf917f6c5520f9fb2c1 (diff) | |
| download | rockbox-2494afccc4d1e0dbd085c5b7ed5518815281b422.zip rockbox-2494afccc4d1e0dbd085c5b7ed5518815281b422.tar.gz rockbox-2494afccc4d1e0dbd085c5b7ed5518815281b422.tar.bz2 rockbox-2494afccc4d1e0dbd085c5b7ed5518815281b422.tar.xz | |
playback.c: don't assume cacheline size is 16 bytes
ideally all targets should define CACHEALIGN_BITS, for now we default it
to 16 bytes if it's not specified
Since the buffer is already aligned in playback.c no need to align it
again in buffering.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27073 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/buffering.c | 3 | ||||
| -rw-r--r-- | apps/playback.c | 12 | ||||
| -rw-r--r-- | firmware/export/system.h | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index c2cecdd..489a450 100644 --- a/apps/buffering.c +++ b/apps/buffering.c @@ -1577,8 +1577,7 @@ bool buffering_reset(char *buf, size_t buflen) return false; buffer = buf; - /* Preserve alignment when wrapping around */ - buffer_len = STORAGE_ALIGN_DOWN(buflen); + buffer_len = buflen; guard_buffer = buf + buflen; buf_widx = 0; diff --git a/apps/playback.c b/apps/playback.c index 4a28a9d..e8a6efc 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -1850,13 +1850,13 @@ static void audio_reset_buffer(void) /* Initially set up file buffer as all space available */ malloc_buf = audiobuf + talk_get_bufsize(); - /* Align the malloc buf to line size. Especially important to cf - targets that do line reads/writes. */ - malloc_buf = (unsigned char *)(((uintptr_t)malloc_buf + 15) & ~15); - filebuf = malloc_buf; /* filebuf line align implied */ - filebuflen = audiobufend - filebuf; - filebuflen &= ~15; + /* Align the malloc buf to line size. + * Especially important to cf targets that do line reads/writes. + * Also for targets which need aligned DMA storage buffers */ + malloc_buf = (unsigned char *)(((uintptr_t)malloc_buf + (CACHEALIGN_SIZE - 1)) & ~(CACHEALIGN_SIZE - 1)); + filebuf = malloc_buf; /* filebuf line align implied */ + filebuflen = (audiobufend - filebuf) & ~(CACHEALIGN_SIZE - 1); /* Subtract whatever the pcm buffer says it used plus the guard buffer */ const size_t pcmbuf_size = pcmbuf_init(filebuf + filebuflen) +GUARD_BUFSIZE; diff --git a/firmware/export/system.h b/firmware/export/system.h index 7a04422..fe8121c 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h @@ -304,7 +304,7 @@ static inline void cpucache_flush(void) /* 2^CACHEALIGN_BITS = the byte size */ #define CACHEALIGN_SIZE (1u << CACHEALIGN_BITS) #else -#define CACHEALIGN_SIZE sizeof(int) +#define CACHEALIGN_SIZE 16 /* FIXME */ #endif #endif /* CACHEALIGN_SIZE */ |