summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-06-23 04:34:18 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-06-23 04:34:18 +0000
commit2494afccc4d1e0dbd085c5b7ed5518815281b422 (patch)
tree4ad37b2a4800ce99687fcb9d5eb0877c888eaa55
parent6281d8e21434878a72e63bf917f6c5520f9fb2c1 (diff)
downloadrockbox-2494afccc4d1e0dbd085c5b7ed5518815281b422.tar.gz
rockbox-2494afccc4d1e0dbd085c5b7ed5518815281b422.zip
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.c3
-rw-r--r--apps/playback.c12
-rw-r--r--firmware/export/system.h2
3 files changed, 8 insertions, 9 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index c2cecddf03..489a4500cc 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -1577,8 +1577,7 @@ bool buffering_reset(char *buf, size_t buflen)
1577 return false; 1577 return false;
1578 1578
1579 buffer = buf; 1579 buffer = buf;
1580 /* Preserve alignment when wrapping around */ 1580 buffer_len = buflen;
1581 buffer_len = STORAGE_ALIGN_DOWN(buflen);
1582 guard_buffer = buf + buflen; 1581 guard_buffer = buf + buflen;
1583 1582
1584 buf_widx = 0; 1583 buf_widx = 0;
diff --git a/apps/playback.c b/apps/playback.c
index 4a28a9d008..e8a6efc109 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1850,13 +1850,13 @@ static void audio_reset_buffer(void)
1850 1850
1851 /* Initially set up file buffer as all space available */ 1851 /* Initially set up file buffer as all space available */
1852 malloc_buf = audiobuf + talk_get_bufsize(); 1852 malloc_buf = audiobuf + talk_get_bufsize();
1853 /* Align the malloc buf to line size. Especially important to cf
1854 targets that do line reads/writes. */
1855 malloc_buf = (unsigned char *)(((uintptr_t)malloc_buf + 15) & ~15);
1856 filebuf = malloc_buf; /* filebuf line align implied */
1857 filebuflen = audiobufend - filebuf;
1858 1853
1859 filebuflen &= ~15; 1854 /* Align the malloc buf to line size.
1855 * Especially important to cf targets that do line reads/writes.
1856 * Also for targets which need aligned DMA storage buffers */
1857 malloc_buf = (unsigned char *)(((uintptr_t)malloc_buf + (CACHEALIGN_SIZE - 1)) & ~(CACHEALIGN_SIZE - 1));
1858 filebuf = malloc_buf; /* filebuf line align implied */
1859 filebuflen = (audiobufend - filebuf) & ~(CACHEALIGN_SIZE - 1);
1860 1860
1861 /* Subtract whatever the pcm buffer says it used plus the guard buffer */ 1861 /* Subtract whatever the pcm buffer says it used plus the guard buffer */
1862 const size_t pcmbuf_size = pcmbuf_init(filebuf + filebuflen) +GUARD_BUFSIZE; 1862 const size_t pcmbuf_size = pcmbuf_init(filebuf + filebuflen) +GUARD_BUFSIZE;
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 7a04422b06..fe8121ce20 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -304,7 +304,7 @@ static inline void cpucache_flush(void)
304/* 2^CACHEALIGN_BITS = the byte size */ 304/* 2^CACHEALIGN_BITS = the byte size */
305#define CACHEALIGN_SIZE (1u << CACHEALIGN_BITS) 305#define CACHEALIGN_SIZE (1u << CACHEALIGN_BITS)
306#else 306#else
307#define CACHEALIGN_SIZE sizeof(int) 307#define CACHEALIGN_SIZE 16 /* FIXME */
308#endif 308#endif
309#endif /* CACHEALIGN_SIZE */ 309#endif /* CACHEALIGN_SIZE */
310 310