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
This commit is contained in:
Rafaël Carré 2010-06-23 04:34:18 +00:00
parent 6281d8e214
commit 2494afccc4
3 changed files with 8 additions and 9 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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 */