1
0
Fork 0
forked from len0rd/rockbox

Finally get packed samples to work in a nice way on H10 in IIS mode. Add some more register defs.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15026 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2007-10-07 20:14:32 +00:00
parent 1de497228a
commit 4512f1a14f
3 changed files with 22 additions and 14 deletions

View file

@ -307,8 +307,11 @@
#define INIT_USB 0x80000000 #define INIT_USB 0x80000000
/* IIS */ /* IIS */
#define IISDIV (*(volatile unsigned long*)(0x60006080))
#define IISCONFIG (*(volatile unsigned long*)(0x70002800)) #define IISCONFIG (*(volatile unsigned long*)(0x70002800))
#define IISCLK (*(volatile unsigned long*)(0x70002808))
#define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c)) #define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c))
#define IISFIFO_WR (*(volatile unsigned long*)(0x70002840)) #define IISFIFO_WR (*(volatile unsigned long*)(0x70002840))
#define IISFIFO_WRH (*(volatile unsigned short*)(0x70002840)) #define IISFIFO_WRH (*(volatile unsigned short*)(0x70002840))
@ -358,10 +361,14 @@
* I forgot which is which size but did test them. */ * I forgot which is which size but did test them. */
#define IIS_FIFO_FORMAT_1 (0x1 << 4) #define IIS_FIFO_FORMAT_1 (0x1 << 4)
#define IIS_FIFO_FORMAT_2 (0x2 << 4) #define IIS_FIFO_FORMAT_2 (0x2 << 4)
/* 32bit-MSB-little endian */ /* 32bit-MSB-little endian */
#define IIS_FIFO_FORMAT_LE32 (0x3 << 4) #define IIS_FIFO_FORMAT_LE32 (0x3 << 4)
/* 16bit-MSB-little endian */ /* 16bit-MSB-little endian */
#define IIS_FIFO_FORMAT_LE16 (0x4 << 4) #define IIS_FIFO_FORMAT_LE16 (0x4 << 4)
#define IIS_FIFO_FORMAT_5 (0x5 << 4)
#define IIS_FIFO_FORMAT_6 (0x6 << 4)
/* A second one like IIS_FIFO_FORMAT_LE16? PP5020 only? */
#define IIS_FIFO_FORMAT_LE16_2 (0x7 << 4)
/* FIFO formats 0x5 and above seem equivalent to 0x4 ?? */ /* FIFO formats 0x5 and above seem equivalent to 0x4 ?? */

View file

@ -57,9 +57,9 @@ void i2s_reset(void)
IISCONFIG &= ~IIS_RESET; IISCONFIG &= ~IIS_RESET;
/* BIT.FORMAT */ /* BIT.FORMAT */
IISCONFIG = ((IISCONFIG & ~IIS_SIZE_MASK) | IIS_SIZE_16BIT);
/* BIT.SIZE */
IISCONFIG = ((IISCONFIG & ~IIS_FORMAT_MASK) | IIS_FORMAT_IIS); IISCONFIG = ((IISCONFIG & ~IIS_FORMAT_MASK) | IIS_FORMAT_IIS);
/* BIT.SIZE */
IISCONFIG = ((IISCONFIG & ~IIS_SIZE_MASK) | IIS_SIZE_16BIT);
/* FIFO.FORMAT */ /* FIFO.FORMAT */
/* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */ /* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */
@ -67,11 +67,11 @@ void i2s_reset(void)
/* AS3514 can only operate as I2S Slave */ /* AS3514 can only operate as I2S Slave */
IISCONFIG |= IIS_MASTER; IISCONFIG |= IIS_MASTER;
/* Set I2S to 44.1kHz */ /* Set I2S to 44.1kHz */
outl((inl(0x70002808) & ~(0x1ff)) | 33, 0x70002808); IISCLK = (IISCLK & ~0x1ff) | 33;
outl(7, 0x60006080); IISDIV = 7;
IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE16); IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE16);
#elif defined (IRIVER_H10) || defined (IRIVER_H10_5GB) #elif defined (IRIVER_H10) || defined (IRIVER_H10_5GB)
IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE_HALFWORD); IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE16_2);
#else #else
IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE32); IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE32);
#endif #endif

View file

@ -29,11 +29,12 @@
of working settings. DMA-compatible settings should be found for here, i2s, of working settings. DMA-compatible settings should be found for here, i2s,
and codec setup using "arithmetic" the hardware supports like halfword and codec setup using "arithmetic" the hardware supports like halfword
swapping. Try to use 32-bit packed in IIS modes if possible. */ swapping. Try to use 32-bit packed in IIS modes if possible. */
#if defined(SANSA_C200) || defined(SANSA_E200) #if defined(SANSA_C200) || defined(SANSA_E200) \
|| defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
/* 16-bit, L-R packed into 32 bits with left in the least significant halfword */ /* 16-bit, L-R packed into 32 bits with left in the least significant halfword */
#define SAMPLE_SIZE 16 #define SAMPLE_SIZE 16
#define TRANSFER_SIZE 32 #define TRANSFER_SIZE 32
#elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) #elif 0
/* 16-bit, one left 16-bit sample followed by one right 16-bit sample */ /* 16-bit, one left 16-bit sample followed by one right 16-bit sample */
#define SAMPLE_SIZE 16 #define SAMPLE_SIZE 16
#define TRANSFER_SIZE 16 #define TRANSFER_SIZE 16
@ -204,10 +205,10 @@ void fiq_playback(void)
} }
#if SAMPLE_SIZE == 16 #if SAMPLE_SIZE == 16
#if TRANSFER_SIZE == 16 #if TRANSFER_SIZE == 16
IISFIFO_WRH = *dma_play_data.p++; IISFIFO_WRH = *dma_play_data.p++;
IISFIFO_WRH = *dma_play_data.p++; IISFIFO_WRH = *dma_play_data.p++;
#elif TRANSFER_SIZE == 32 #elif TRANSFER_SIZE == 32
IISFIFO_WR = *dma_play_data.p++; IISFIFO_WR = *dma_play_data.p++;
#endif #endif
#elif SAMPLE_SIZE == 32 #elif SAMPLE_SIZE == 32
IISFIFO_WR = *dma_play_data.p++ << 16; IISFIFO_WR = *dma_play_data.p++ << 16;
@ -294,8 +295,8 @@ static void play_stop_pcm(void)
void pcm_play_dma_start(const void *addr, size_t size) void pcm_play_dma_start(const void *addr, size_t size)
{ {
dma_play_data.p = (void *)addr; dma_play_data.p = (void *)(((uintptr_t)addr + 2) & ~3);
dma_play_data.size = size; dma_play_data.size = (size & ~3);
#if NUM_CORES > 1 #if NUM_CORES > 1
/* This will become more important later - and different ! */ /* This will become more important later - and different ! */