summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/pp5020.h11
-rw-r--r--firmware/target/arm/i2s-pp.c10
-rw-r--r--firmware/target/arm/pcm-pp.c15
3 files changed, 22 insertions, 14 deletions
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 @@
307 307
308#define INIT_USB 0x80000000 308#define INIT_USB 0x80000000
309 309
310
310/* IIS */ 311/* IIS */
312#define IISDIV (*(volatile unsigned long*)(0x60006080))
311#define IISCONFIG (*(volatile unsigned long*)(0x70002800)) 313#define IISCONFIG (*(volatile unsigned long*)(0x70002800))
314#define IISCLK (*(volatile unsigned long*)(0x70002808))
312#define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c)) 315#define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c))
313#define IISFIFO_WR (*(volatile unsigned long*)(0x70002840)) 316#define IISFIFO_WR (*(volatile unsigned long*)(0x70002840))
314#define IISFIFO_WRH (*(volatile unsigned short*)(0x70002840)) 317#define IISFIFO_WRH (*(volatile unsigned short*)(0x70002840))
@@ -358,10 +361,14 @@
358 * I forgot which is which size but did test them. */ 361 * I forgot which is which size but did test them. */
359#define IIS_FIFO_FORMAT_1 (0x1 << 4) 362#define IIS_FIFO_FORMAT_1 (0x1 << 4)
360#define IIS_FIFO_FORMAT_2 (0x2 << 4) 363#define IIS_FIFO_FORMAT_2 (0x2 << 4)
361 /* 32bit-MSB-little endian */ 364/* 32bit-MSB-little endian */
362#define IIS_FIFO_FORMAT_LE32 (0x3 << 4) 365#define IIS_FIFO_FORMAT_LE32 (0x3 << 4)
363 /* 16bit-MSB-little endian */ 366/* 16bit-MSB-little endian */
364#define IIS_FIFO_FORMAT_LE16 (0x4 << 4) 367#define IIS_FIFO_FORMAT_LE16 (0x4 << 4)
368#define IIS_FIFO_FORMAT_5 (0x5 << 4)
369#define IIS_FIFO_FORMAT_6 (0x6 << 4)
370/* A second one like IIS_FIFO_FORMAT_LE16? PP5020 only? */
371#define IIS_FIFO_FORMAT_LE16_2 (0x7 << 4)
365 372
366/* FIFO formats 0x5 and above seem equivalent to 0x4 ?? */ 373/* FIFO formats 0x5 and above seem equivalent to 0x4 ?? */
367 374
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)
57 IISCONFIG &= ~IIS_RESET; 57 IISCONFIG &= ~IIS_RESET;
58 58
59 /* BIT.FORMAT */ 59 /* BIT.FORMAT */
60 IISCONFIG = ((IISCONFIG & ~IIS_SIZE_MASK) | IIS_SIZE_16BIT);
61 /* BIT.SIZE */
62 IISCONFIG = ((IISCONFIG & ~IIS_FORMAT_MASK) | IIS_FORMAT_IIS); 60 IISCONFIG = ((IISCONFIG & ~IIS_FORMAT_MASK) | IIS_FORMAT_IIS);
61 /* BIT.SIZE */
62 IISCONFIG = ((IISCONFIG & ~IIS_SIZE_MASK) | IIS_SIZE_16BIT);
63 63
64 /* FIFO.FORMAT */ 64 /* FIFO.FORMAT */
65 /* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */ 65 /* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */
@@ -67,11 +67,11 @@ void i2s_reset(void)
67 /* AS3514 can only operate as I2S Slave */ 67 /* AS3514 can only operate as I2S Slave */
68 IISCONFIG |= IIS_MASTER; 68 IISCONFIG |= IIS_MASTER;
69 /* Set I2S to 44.1kHz */ 69 /* Set I2S to 44.1kHz */
70 outl((inl(0x70002808) & ~(0x1ff)) | 33, 0x70002808); 70 IISCLK = (IISCLK & ~0x1ff) | 33;
71 outl(7, 0x60006080); 71 IISDIV = 7;
72 IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE16); 72 IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE16);
73#elif defined (IRIVER_H10) || defined (IRIVER_H10_5GB) 73#elif defined (IRIVER_H10) || defined (IRIVER_H10_5GB)
74 IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE_HALFWORD); 74 IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE16_2);
75#else 75#else
76 IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE32); 76 IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE32);
77#endif 77#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 @@
29 of working settings. DMA-compatible settings should be found for here, i2s, 29 of working settings. DMA-compatible settings should be found for here, i2s,
30 and codec setup using "arithmetic" the hardware supports like halfword 30 and codec setup using "arithmetic" the hardware supports like halfword
31 swapping. Try to use 32-bit packed in IIS modes if possible. */ 31 swapping. Try to use 32-bit packed in IIS modes if possible. */
32#if defined(SANSA_C200) || defined(SANSA_E200) 32#if defined(SANSA_C200) || defined(SANSA_E200) \
33 || defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
33/* 16-bit, L-R packed into 32 bits with left in the least significant halfword */ 34/* 16-bit, L-R packed into 32 bits with left in the least significant halfword */
34#define SAMPLE_SIZE 16 35#define SAMPLE_SIZE 16
35#define TRANSFER_SIZE 32 36#define TRANSFER_SIZE 32
36#elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) 37#elif 0
37/* 16-bit, one left 16-bit sample followed by one right 16-bit sample */ 38/* 16-bit, one left 16-bit sample followed by one right 16-bit sample */
38#define SAMPLE_SIZE 16 39#define SAMPLE_SIZE 16
39#define TRANSFER_SIZE 16 40#define TRANSFER_SIZE 16
@@ -204,10 +205,10 @@ void fiq_playback(void)
204 } 205 }
205#if SAMPLE_SIZE == 16 206#if SAMPLE_SIZE == 16
206#if TRANSFER_SIZE == 16 207#if TRANSFER_SIZE == 16
207 IISFIFO_WRH = *dma_play_data.p++; 208 IISFIFO_WRH = *dma_play_data.p++;
208 IISFIFO_WRH = *dma_play_data.p++; 209 IISFIFO_WRH = *dma_play_data.p++;
209#elif TRANSFER_SIZE == 32 210#elif TRANSFER_SIZE == 32
210 IISFIFO_WR = *dma_play_data.p++; 211 IISFIFO_WR = *dma_play_data.p++;
211#endif 212#endif
212#elif SAMPLE_SIZE == 32 213#elif SAMPLE_SIZE == 32
213 IISFIFO_WR = *dma_play_data.p++ << 16; 214 IISFIFO_WR = *dma_play_data.p++ << 16;
@@ -294,8 +295,8 @@ static void play_stop_pcm(void)
294 295
295void pcm_play_dma_start(const void *addr, size_t size) 296void pcm_play_dma_start(const void *addr, size_t size)
296{ 297{
297 dma_play_data.p = (void *)addr; 298 dma_play_data.p = (void *)(((uintptr_t)addr + 2) & ~3);
298 dma_play_data.size = size; 299 dma_play_data.size = (size & ~3);
299 300
300#if NUM_CORES > 1 301#if NUM_CORES > 1
301 /* This will become more important later - and different ! */ 302 /* This will become more important later - and different ! */