More M:Robe 500 work: PCM stopping and pausing roughly works, added some keymaps for the WPS screen, and peakmeter now works properly.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20511 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Karl Kurbjun 2009-03-24 16:40:31 +00:00
parent a5501d68cc
commit 2670e3f038
11 changed files with 210 additions and 117 deletions

View file

@ -29,15 +29,31 @@
#include "dsp/ipc.h"
#include "mmu-arm.h"
/* These are global to save some latency when pcm_play_dma_get_peak_buffer is
* called.
*/
static unsigned char *start;
static size_t size;
void pcm_postinit(void)
{
audiohw_postinit();
}
/* Return the current location in the SDRAM to SARAM transfer along with the
* number of bytes read in the current buffer (count). There is latency with
* this method equivalent to ~ the size of the SARAM buffer since there is
* another buffer between your ears and this calculation, but this works for
* key clicks and an approximate peak meter.
*/
const void * pcm_play_dma_get_peak_buffer(int *count)
{
(void) count;
return 0;
int cnt = DSP_(_sdem_level);
unsigned long addr = (unsigned long) start +cnt;
*count = (cnt & 0xFFFFF) >> 1;
return (void *)((addr + 2) & ~3);
}
void pcm_play_dma_init(void)
@ -49,6 +65,7 @@ void pcm_play_dma_init(void)
dsp_reset();
dsp_load(dsp_image);
dsp_wake();
}
void pcm_dma_apply_settings(void)
@ -56,6 +73,9 @@ void pcm_dma_apply_settings(void)
audiohw_set_frequency(pcm_fsel);
}
/* Note that size is actually limited to the size of a short right now due to
* the implementation on the DSP side (and the way that we access it)
*/
void pcm_play_dma_start(const void *addr, size_t size)
{
unsigned long sdem_addr=(unsigned long)addr - CONFIG_SDRAM_START;
@ -63,12 +83,14 @@ void pcm_play_dma_start(const void *addr, size_t size)
DSP_(_sdem_addrl) = sdem_addr & 0xffff;
DSP_(_sdem_addrh) = sdem_addr >> 16;
DSP_(_sdem_dsp_size) = size;
DSP_(_dma0_stopped)=0;
dsp_wake();
}
void pcm_play_dma_stop(void)
{
DSP_(_dma0_stopped)=1;
}
void pcm_play_lock(void)
@ -83,7 +105,15 @@ void pcm_play_unlock(void)
void pcm_play_dma_pause(bool pause)
{
(void) pause;
if (pause)
{
DSP_(_dma0_stopped)=2;
}
else
{
DSP_(_dma0_stopped)=0;
dsp_wake();
}
}
size_t pcm_get_bytes_waiting(void)
@ -93,8 +123,6 @@ size_t pcm_get_bytes_waiting(void)
void DSPHINT(void)
{
static unsigned char *start;
static size_t size;
register pcm_more_callback_type get_more; /* No stack for this */
unsigned int i;
@ -111,9 +139,6 @@ void DSPHINT(void)
buffer[i] = dsp_message.payload.debugf.buffer[i];
}
/* Release shared area to DSP. */
dsp_wake();
DEBUGF("DSP: %s", buffer);
break;
@ -121,27 +146,28 @@ void DSPHINT(void)
/* Buffer empty. Try to get more. */
get_more = pcm_callback_for_more;
size = 0;
if (get_more == NULL || (get_more(&start, &size), size == 0))
{
/* Callback missing or no more DMA to do */
pcm_play_dma_stop();
pcm_play_dma_stopped_callback();
/* Callback missing or no more DMA to do */
pcm_play_dma_stop();
pcm_play_dma_stopped_callback();
}
else
{
unsigned long sdem_addr=(unsigned long)start - CONFIG_SDRAM_START;
/* Flush any pending cache writes */
clean_dcache_range(start, size);
clean_dcache_range(start, size);
/* set the new DMA values */
DSP_(_sdem_addrl) = sdem_addr & 0xffff;
/* set the new DMA values */
DSP_(_sdem_addrl) = sdem_addr & 0xffff;
DSP_(_sdem_addrh) = sdem_addr >> 16;
DSP_(_sdem_dsp_size) = size;
DEBUGF("pcm_sdram at 0x%08lx, sdem_addr 0x%08lx",
DEBUGF("pcm_sdram at 0x%08lx, sdem_addr 0x%08lx",
(unsigned long)start, (unsigned long)sdem_addr);
}
break;
default:
DEBUGF("DSP: unknown msg 0x%04x", dsp_message.msg);