From 4512f1a14f78b764df1df934b8f95907ca7635cc Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 7 Oct 2007 20:14:32 +0000 Subject: 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 --- firmware/export/pp5020.h | 11 +++++++++-- firmware/target/arm/i2s-pp.c | 10 +++++----- firmware/target/arm/pcm-pp.c | 15 ++++++++------- 3 files changed, 22 insertions(+), 14 deletions(-) (limited to 'firmware') diff --git a/firmware/export/pp5020.h b/firmware/export/pp5020.h index df8c8fb058..2c939300ab 100644 --- a/firmware/export/pp5020.h +++ b/firmware/export/pp5020.h @@ -307,8 +307,11 @@ #define INIT_USB 0x80000000 + /* IIS */ +#define IISDIV (*(volatile unsigned long*)(0x60006080)) #define IISCONFIG (*(volatile unsigned long*)(0x70002800)) +#define IISCLK (*(volatile unsigned long*)(0x70002808)) #define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c)) #define IISFIFO_WR (*(volatile unsigned long*)(0x70002840)) #define IISFIFO_WRH (*(volatile unsigned short*)(0x70002840)) @@ -358,10 +361,14 @@ * I forgot which is which size but did test them. */ #define IIS_FIFO_FORMAT_1 (0x1 << 4) #define IIS_FIFO_FORMAT_2 (0x2 << 4) - /* 32bit-MSB-little endian */ +/* 32bit-MSB-little endian */ #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_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 ?? */ diff --git a/firmware/target/arm/i2s-pp.c b/firmware/target/arm/i2s-pp.c index 09170c818b..0c33fbce28 100644 --- a/firmware/target/arm/i2s-pp.c +++ b/firmware/target/arm/i2s-pp.c @@ -57,9 +57,9 @@ void i2s_reset(void) IISCONFIG &= ~IIS_RESET; /* BIT.FORMAT */ - IISCONFIG = ((IISCONFIG & ~IIS_SIZE_MASK) | IIS_SIZE_16BIT); - /* BIT.SIZE */ IISCONFIG = ((IISCONFIG & ~IIS_FORMAT_MASK) | IIS_FORMAT_IIS); + /* BIT.SIZE */ + IISCONFIG = ((IISCONFIG & ~IIS_SIZE_MASK) | IIS_SIZE_16BIT); /* FIFO.FORMAT */ /* 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 */ IISCONFIG |= IIS_MASTER; /* Set I2S to 44.1kHz */ - outl((inl(0x70002808) & ~(0x1ff)) | 33, 0x70002808); - outl(7, 0x60006080); + IISCLK = (IISCLK & ~0x1ff) | 33; + IISDIV = 7; IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE16); #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 IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE32); #endif diff --git a/firmware/target/arm/pcm-pp.c b/firmware/target/arm/pcm-pp.c index 119c54d71b..ba2b6e5ada 100644 --- a/firmware/target/arm/pcm-pp.c +++ b/firmware/target/arm/pcm-pp.c @@ -29,11 +29,12 @@ of working settings. DMA-compatible settings should be found for here, i2s, and codec setup using "arithmetic" the hardware supports like halfword 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 */ #define SAMPLE_SIZE 16 #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 */ #define SAMPLE_SIZE 16 #define TRANSFER_SIZE 16 @@ -204,10 +205,10 @@ void fiq_playback(void) } #if SAMPLE_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 - IISFIFO_WR = *dma_play_data.p++; + IISFIFO_WR = *dma_play_data.p++; #endif #elif SAMPLE_SIZE == 32 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) { - dma_play_data.p = (void *)addr; - dma_play_data.size = size; + dma_play_data.p = (void *)(((uintptr_t)addr + 2) & ~3); + dma_play_data.size = (size & ~3); #if NUM_CORES > 1 /* This will become more important later - and different ! */ -- cgit v1.2.3