diff options
| author | Brandon Low <lostlogic@rockbox.org> | 2006-01-21 16:47:36 +0000 |
|---|---|---|
| committer | Brandon Low <lostlogic@rockbox.org> | 2006-01-21 16:47:36 +0000 |
| commit | d8a6c0665da7d9b6bd7d5aa2840f86b4a931d0f5 (patch) | |
| tree | 72043a0c3a903092638fd38e1d846508bcdbd56b | |
| parent | 33914a7dfc82fd6badaf774619539b92f3b7c255 (diff) | |
| download | rockbox-d8a6c0665da7d9b6bd7d5aa2840f86b4a931d0f5.zip rockbox-d8a6c0665da7d9b6bd7d5aa2840f86b4a931d0f5.tar.gz rockbox-d8a6c0665da7d9b6bd7d5aa2840f86b4a931d0f5.tar.bz2 rockbox-d8a6c0665da7d9b6bd7d5aa2840f86b4a931d0f5.tar.xz | |
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
| -rw-r--r-- | apps/pcmbuf.c | 19 | ||||
| -rw-r--r-- | firmware/pcm_playback.c | 6 |
2 files changed, 11 insertions, 14 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 66dd47e..2d75185 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -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) diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index fe71fa3..36c6ab6 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c @@ -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)) { |