forked from len0rd/rockbox
Improve performance by putting more of the code and variables that are called by the DMA0 interrupt into IRAM (3% boost improvement on my test track).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8404 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
33914a7dfc
commit
d8a6c0665d
2 changed files with 11 additions and 14 deletions
|
|
@ -46,8 +46,8 @@
|
|||
static long pcmbuf_size = 0; /* Size of the PCM buffer. */
|
||||
static char *audiobuffer;
|
||||
static long audiobuffer_pos; /* Current audio buffer write index. */
|
||||
long audiobuffer_free; /* Amount of bytes left in the buffer. */
|
||||
static long audiobuffer_fillpos; /* Amount audiobuffer_pos will be increased. */
|
||||
long audiobuffer_free IDATA_ATTR; /* Amount of bytes left in the buffer. */
|
||||
static long audiobuffer_fillpos; /* Amount audiobuffer_pos will be increased.*/
|
||||
static char *guardbuf;
|
||||
|
||||
static void (*pcmbuf_event_handler)(void);
|
||||
|
|
@ -81,11 +81,11 @@ struct pcmbufdesc
|
|||
int size;
|
||||
/* Call this when the buffer has been played */
|
||||
void (*callback)(void);
|
||||
} pcmbuffers[NUM_PCM_BUFFERS];
|
||||
} pcmbuffers[NUM_PCM_BUFFERS] IDATA_ATTR;
|
||||
|
||||
volatile int pcmbuf_read_index;
|
||||
volatile int pcmbuf_write_index;
|
||||
int pcmbuf_unplayed_bytes;
|
||||
int pcmbuf_unplayed_bytes IDATA_ATTR;
|
||||
int pcmbuf_mix_used_bytes;
|
||||
int pcmbuf_watermark;
|
||||
void (*pcmbuf_watermark_event)(int bytes_left);
|
||||
|
|
@ -121,6 +121,7 @@ int pcmbuf_num_used_buffers(void)
|
|||
return (pcmbuf_write_index - pcmbuf_read_index) & NUM_PCM_BUFFERS_MASK;
|
||||
}
|
||||
|
||||
static void pcmbuf_callback(unsigned char** start, long* size) ICODE_ATTR;
|
||||
static void pcmbuf_callback(unsigned char** start, long* size)
|
||||
{
|
||||
struct pcmbufdesc *desc = &pcmbuffers[pcmbuf_read_index];
|
||||
|
|
@ -206,14 +207,10 @@ void pcmbuf_add_event(void (*event_handler)(void))
|
|||
|
||||
unsigned int pcmbuf_get_latency(void)
|
||||
{
|
||||
int latency;
|
||||
int latency = (pcmbuf_unplayed_bytes + pcm_get_bytes_waiting())
|
||||
* 1000 / 4 / 44100;
|
||||
|
||||
latency = (pcmbuf_unplayed_bytes + pcm_get_bytes_waiting())
|
||||
* 1000 / 4 / 44100;
|
||||
if (latency < 0)
|
||||
latency = 0;
|
||||
|
||||
return latency;
|
||||
return latency<0?0:latency;
|
||||
}
|
||||
|
||||
bool pcmbuf_is_lowdata(void)
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ static bool pcm_playing;
|
|||
static bool pcm_paused;
|
||||
static int pcm_freq = 0x6; /* 44.1 is default */
|
||||
|
||||
static unsigned char *next_start;
|
||||
static long next_size;
|
||||
static unsigned char *next_start IDATA_ATTR;
|
||||
static long next_size IDATA_ATTR;
|
||||
|
||||
/* Set up the DMA transfer that kicks in when the audio FIFO gets empty */
|
||||
static void dma_start(const void *addr, long size)
|
||||
|
|
@ -193,7 +193,7 @@ void pcm_set_frequency(unsigned int frequency)
|
|||
}
|
||||
|
||||
/* the registered callback function to ask for more mp3 data */
|
||||
static void (*callback_for_more)(unsigned char**, long*) = NULL;
|
||||
static void (*callback_for_more)(unsigned char**, long*) IDATA_ATTR = NULL;
|
||||
|
||||
void pcm_play_data(void (*get_more)(unsigned char** start, long* size))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue