mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Remove malloc_buf references from playback.c since it's no longer used for anything and align the codec slack space buffer that is now use as the malloc buffer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29533 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d5e1faa2d2
commit
7d2ab2df5f
2 changed files with 16 additions and 18 deletions
|
@ -193,10 +193,15 @@ void codec_thread_do_callback(void (*fn)(void), unsigned int *id)
|
||||||
|
|
||||||
static void* codec_get_buffer(size_t *size)
|
static void* codec_get_buffer(size_t *size)
|
||||||
{
|
{
|
||||||
if (codec_size >= CODEC_SIZE)
|
ssize_t s = CODEC_SIZE - codec_size;
|
||||||
|
void *buf = &codecbuf[codec_size];
|
||||||
|
ALIGN_BUFFER(buf, s, CACHEALIGN_SIZE);
|
||||||
|
|
||||||
|
if (s <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
*size = CODEC_SIZE - codec_size;
|
|
||||||
return &codecbuf[codec_size];
|
*size = s;
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void codec_pcmbuf_insert_callback(
|
static void codec_pcmbuf_insert_callback(
|
||||||
|
|
|
@ -116,7 +116,6 @@ static volatile bool paused SHAREDBSS_ATTR = false; /* Is audio paused? (A/C-) *
|
||||||
|
|
||||||
/* Ring buffer where compressed audio and codecs are loaded */
|
/* Ring buffer where compressed audio and codecs are loaded */
|
||||||
static unsigned char *filebuf = NULL; /* Start of buffer (A/C-) */
|
static unsigned char *filebuf = NULL; /* Start of buffer (A/C-) */
|
||||||
static unsigned char *malloc_buf = NULL; /* Start of malloc buffer (A/C-) */
|
|
||||||
static size_t filebuflen = 0; /* Size of buffer (A/C-) */
|
static size_t filebuflen = 0; /* Size of buffer (A/C-) */
|
||||||
/* FIXME: make buf_ridx (C/A-) */
|
/* FIXME: make buf_ridx (C/A-) */
|
||||||
|
|
||||||
|
@ -2014,26 +2013,21 @@ static void audio_reset_buffer(void)
|
||||||
as it will likely be affected and need sliding over */
|
as it will likely be affected and need sliding over */
|
||||||
|
|
||||||
/* Initially set up file buffer as all space available */
|
/* Initially set up file buffer as all space available */
|
||||||
malloc_buf = audiobuf + talk_get_bufsize();
|
filebuf = audiobuf + talk_get_bufsize();
|
||||||
|
filebuflen = audiobufend - filebuf;
|
||||||
|
|
||||||
/* Align the malloc buf to line size.
|
ALIGN_BUFFER(filebuf, filebuflen, sizeof (intptr_t));
|
||||||
* 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 */
|
/* Subtract whatever the pcm buffer says it used plus the guard buffer */
|
||||||
const size_t pcmbuf_size = pcmbuf_init(filebuf + filebuflen) +GUARD_BUFSIZE;
|
size_t pcmbuf_size = pcmbuf_init(filebuf + filebuflen) + GUARD_BUFSIZE;
|
||||||
|
|
||||||
|
/* Make sure filebuflen is a pointer sized multiple after adjustment */
|
||||||
|
pcmbuf_size = ALIGN_UP(pcmbuf_size, sizeof (intptr_t));
|
||||||
|
|
||||||
if(pcmbuf_size > filebuflen)
|
if(pcmbuf_size > filebuflen)
|
||||||
panicf("%s(): EOM (%zu > %zu)", __func__, pcmbuf_size, filebuflen);
|
panicf("%s(): EOM (%zu > %zu)", __func__, pcmbuf_size, filebuflen);
|
||||||
|
|
||||||
filebuflen -= pcmbuf_size;
|
filebuflen -= pcmbuf_size;
|
||||||
|
|
||||||
/* Make sure filebuflen is a longword multiple after adjustment - filebuf
|
|
||||||
will already be line aligned */
|
|
||||||
filebuflen &= ~3;
|
|
||||||
|
|
||||||
buffering_reset(filebuf, filebuflen);
|
buffering_reset(filebuf, filebuflen);
|
||||||
|
|
||||||
/* Clear any references to the file buffer */
|
/* Clear any references to the file buffer */
|
||||||
|
@ -2046,7 +2040,6 @@ static void audio_reset_buffer(void)
|
||||||
{
|
{
|
||||||
size_t pcmbufsize;
|
size_t pcmbufsize;
|
||||||
const unsigned char *pcmbuf = pcmbuf_get_meminfo(&pcmbufsize);
|
const unsigned char *pcmbuf = pcmbuf_get_meminfo(&pcmbufsize);
|
||||||
logf("mabuf: %08X", (unsigned)malloc_buf);
|
|
||||||
logf("fbuf: %08X", (unsigned)filebuf);
|
logf("fbuf: %08X", (unsigned)filebuf);
|
||||||
logf("fbufe: %08X", (unsigned)(filebuf + filebuflen));
|
logf("fbufe: %08X", (unsigned)(filebuf + filebuflen));
|
||||||
logf("gbuf: %08X", (unsigned)(filebuf + filebuflen));
|
logf("gbuf: %08X", (unsigned)(filebuf + filebuflen));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue