diff options
-rw-r--r-- | firmware/SOURCES | 11 | ||||
-rw-r--r-- | firmware/drivers/wm8731l.c | 1 | ||||
-rw-r--r-- | firmware/drivers/wm8758.c | 1 | ||||
-rw-r--r-- | firmware/drivers/wm8975.c | 1 | ||||
-rw-r--r-- | firmware/export/i2s.h | 20 | ||||
-rw-r--r-- | firmware/export/wmcodec.h | 1 | ||||
-rw-r--r-- | firmware/target/arm/i2s-pp.c | 95 | ||||
-rw-r--r-- | firmware/target/arm/wmcodec-pp.c | 54 |
8 files changed, 130 insertions, 54 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 77c257879a..30431d71b2 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -328,6 +328,7 @@ target/arm/sandisk/sansa-e200/backlight-e200.c | |||
328 | target/arm/sandisk/sansa-e200/usb-e200.c | 328 | target/arm/sandisk/sansa-e200/usb-e200.c |
329 | target/arm/sandisk/sansa-e200/button-e200.c | 329 | target/arm/sandisk/sansa-e200/button-e200.c |
330 | target/arm/sandisk/sansa-e200/power-e200.c | 330 | target/arm/sandisk/sansa-e200/power-e200.c |
331 | target/arm/i2s-pp.c | ||
331 | #endif /* SIMULATOR */ | 332 | #endif /* SIMULATOR */ |
332 | #endif /* SANSA_E200 */ | 333 | #endif /* SANSA_E200 */ |
333 | 334 | ||
@@ -403,6 +404,7 @@ target/coldfire/iriver/h100/usb-h100.c | |||
403 | #ifndef SIMULATOR | 404 | #ifndef SIMULATOR |
404 | target/arm/ata-pp5020.c | 405 | target/arm/ata-pp5020.c |
405 | target/arm/wmcodec-pp.c | 406 | target/arm/wmcodec-pp.c |
407 | target/arm/i2s-pp.c | ||
406 | target/arm/iriver/h10/adc-h10.c | 408 | target/arm/iriver/h10/adc-h10.c |
407 | target/arm/iriver/h10/backlight-h10.c | 409 | target/arm/iriver/h10/backlight-h10.c |
408 | target/arm/iriver/h10/button-h10.c | 410 | target/arm/iriver/h10/button-h10.c |
@@ -416,6 +418,7 @@ target/arm/iriver/h10/usb-h10.c | |||
416 | #ifndef SIMULATOR | 418 | #ifndef SIMULATOR |
417 | target/arm/ata-pp5020.c | 419 | target/arm/ata-pp5020.c |
418 | target/arm/wmcodec-pp.c | 420 | target/arm/wmcodec-pp.c |
421 | target/arm/i2s-pp.c | ||
419 | target/arm/iriver/h10/adc-h10.c | 422 | target/arm/iriver/h10/adc-h10.c |
420 | target/arm/iriver/h10/backlight-h10.c | 423 | target/arm/iriver/h10/backlight-h10.c |
421 | target/arm/iriver/h10/button-h10.c | 424 | target/arm/iriver/h10/button-h10.c |
@@ -445,6 +448,7 @@ target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c | |||
445 | #ifndef SIMULATOR | 448 | #ifndef SIMULATOR |
446 | target/arm/ata-pp5020.c | 449 | target/arm/ata-pp5020.c |
447 | target/arm/wmcodec-pp.c | 450 | target/arm/wmcodec-pp.c |
451 | target/arm/i2s-pp.c | ||
448 | target/arm/tatung/tpj1022/adc-tpj1022.c | 452 | target/arm/tatung/tpj1022/adc-tpj1022.c |
449 | target/arm/tatung/tpj1022/backlight-tpj1022.c | 453 | target/arm/tatung/tpj1022/backlight-tpj1022.c |
450 | target/arm/tatung/tpj1022/button-tpj1022.c | 454 | target/arm/tatung/tpj1022/button-tpj1022.c |
@@ -459,6 +463,7 @@ target/arm/tatung/tpj1022/usb-tpj1022.c | |||
459 | drivers/lcd-ipod.c | 463 | drivers/lcd-ipod.c |
460 | drivers/pcf50605.c | 464 | drivers/pcf50605.c |
461 | target/arm/wmcodec-pp.c | 465 | target/arm/wmcodec-pp.c |
466 | target/arm/i2s-pp.c | ||
462 | target/arm/ata-pp5020.c | 467 | target/arm/ata-pp5020.c |
463 | target/arm/ipod/adc-ipod.c | 468 | target/arm/ipod/adc-ipod.c |
464 | target/arm/ipod/backlight-4g_color.c | 469 | target/arm/ipod/backlight-4g_color.c |
@@ -474,6 +479,7 @@ drivers/lcd-ipod.c | |||
474 | drivers/pcf50605.c | 479 | drivers/pcf50605.c |
475 | target/arm/ata-pp5020.c | 480 | target/arm/ata-pp5020.c |
476 | target/arm/wmcodec-pp.c | 481 | target/arm/wmcodec-pp.c |
482 | target/arm/i2s-pp.c | ||
477 | target/arm/ipod/adc-ipod.c | 483 | target/arm/ipod/adc-ipod.c |
478 | target/arm/ipod/backlight-4g_color.c | 484 | target/arm/ipod/backlight-4g_color.c |
479 | target/arm/ipod/button-clickwheel.c | 485 | target/arm/ipod/button-clickwheel.c |
@@ -488,6 +494,7 @@ drivers/lcd-ipod.c | |||
488 | drivers/pcf50605.c | 494 | drivers/pcf50605.c |
489 | target/arm/ata-pp5020.c | 495 | target/arm/ata-pp5020.c |
490 | target/arm/wmcodec-pp.c | 496 | target/arm/wmcodec-pp.c |
497 | target/arm/i2s-pp.c | ||
491 | target/arm/ipod/adc-ipod.c | 498 | target/arm/ipod/adc-ipod.c |
492 | target/arm/ipod/backlight-nano_video.c | 499 | target/arm/ipod/backlight-nano_video.c |
493 | target/arm/ipod/button-clickwheel.c | 500 | target/arm/ipod/button-clickwheel.c |
@@ -502,6 +509,7 @@ drivers/lcd-ipodvideo.c | |||
502 | drivers/pcf50605.c | 509 | drivers/pcf50605.c |
503 | target/arm/ata-pp5020.c | 510 | target/arm/ata-pp5020.c |
504 | target/arm/wmcodec-pp.c | 511 | target/arm/wmcodec-pp.c |
512 | target/arm/i2s-pp.c | ||
505 | target/arm/ipod/adc-ipod.c | 513 | target/arm/ipod/adc-ipod.c |
506 | target/arm/ipod/backlight-nano_video.c | 514 | target/arm/ipod/backlight-nano_video.c |
507 | target/arm/ipod/button-clickwheel.c | 515 | target/arm/ipod/button-clickwheel.c |
@@ -516,6 +524,7 @@ drivers/lcd-ipod.c | |||
516 | drivers/pcf50605.c | 524 | drivers/pcf50605.c |
517 | target/arm/ata-pp5002.c | 525 | target/arm/ata-pp5002.c |
518 | target/arm/wmcodec-pp.c | 526 | target/arm/wmcodec-pp.c |
527 | target/arm/i2s-pp.c | ||
519 | target/arm/ipod/adc-ipod.c | 528 | target/arm/ipod/adc-ipod.c |
520 | target/arm/ipod/3g/backlight-3g.c | 529 | target/arm/ipod/3g/backlight-3g.c |
521 | target/arm/ipod/3g/button-3g.c | 530 | target/arm/ipod/3g/button-3g.c |
@@ -530,6 +539,7 @@ drivers/lcd-ipod.c | |||
530 | drivers/pcf50605.c | 539 | drivers/pcf50605.c |
531 | target/arm/ata-pp5020.c | 540 | target/arm/ata-pp5020.c |
532 | target/arm/wmcodec-pp.c | 541 | target/arm/wmcodec-pp.c |
542 | target/arm/i2s-pp.c | ||
533 | target/arm/ipod/adc-ipod.c | 543 | target/arm/ipod/adc-ipod.c |
534 | target/arm/ipod/backlight-mini1g_mini2g.c | 544 | target/arm/ipod/backlight-mini1g_mini2g.c |
535 | target/arm/ipod/button-mini1g.c | 545 | target/arm/ipod/button-mini1g.c |
@@ -544,6 +554,7 @@ drivers/lcd-ipod.c | |||
544 | drivers/pcf50605.c | 554 | drivers/pcf50605.c |
545 | target/arm/ata-pp5020.c | 555 | target/arm/ata-pp5020.c |
546 | target/arm/wmcodec-pp.c | 556 | target/arm/wmcodec-pp.c |
557 | target/arm/i2s-pp.c | ||
547 | target/arm/ipod/adc-ipod.c | 558 | target/arm/ipod/adc-ipod.c |
548 | target/arm/ipod/backlight-mini1g_mini2g.c | 559 | target/arm/ipod/backlight-mini1g_mini2g.c |
549 | target/arm/ipod/button-clickwheel.c | 560 | target/arm/ipod/button-clickwheel.c |
diff --git a/firmware/drivers/wm8731l.c b/firmware/drivers/wm8731l.c index 30521339e9..a690aade48 100644 --- a/firmware/drivers/wm8731l.c +++ b/firmware/drivers/wm8731l.c | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include "wmcodec.h" | 40 | #include "wmcodec.h" |
41 | #include "wm8731l.h" | 41 | #include "wm8731l.h" |
42 | #include "i2s.h" | ||
42 | 43 | ||
43 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ | 44 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ |
44 | 45 | ||
diff --git a/firmware/drivers/wm8758.c b/firmware/drivers/wm8758.c index 268df13f07..22bef73e45 100644 --- a/firmware/drivers/wm8758.c +++ b/firmware/drivers/wm8758.c | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include "wmcodec.h" | 40 | #include "wmcodec.h" |
41 | #include "wm8758.h" | 41 | #include "wm8758.h" |
42 | #include "i2s.h" | ||
42 | 43 | ||
43 | /* convert tenth of dB volume (-57..6) to master volume register value */ | 44 | /* convert tenth of dB volume (-57..6) to master volume register value */ |
44 | int tenthdb2master(int db) | 45 | int tenthdb2master(int db) |
diff --git a/firmware/drivers/wm8975.c b/firmware/drivers/wm8975.c index 7f2f2c4a7d..d2b1fa64b2 100644 --- a/firmware/drivers/wm8975.c +++ b/firmware/drivers/wm8975.c | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include "wmcodec.h" | 40 | #include "wmcodec.h" |
41 | #include "wm8975.h" | 41 | #include "wm8975.h" |
42 | #include "i2s.h" | ||
42 | 43 | ||
43 | /* convert tenth of dB volume (-730..60) to master volume register value */ | 44 | /* convert tenth of dB volume (-730..60) to master volume register value */ |
44 | int tenthdb2master(int db) | 45 | int tenthdb2master(int db) |
diff --git a/firmware/export/i2s.h b/firmware/export/i2s.h new file mode 100644 index 0000000000..13dba68391 --- /dev/null +++ b/firmware/export/i2s.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Daniel Ankers | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | void i2s_reset(void); | ||
diff --git a/firmware/export/wmcodec.h b/firmware/export/wmcodec.h index 1079a80498..d810469d02 100644 --- a/firmware/export/wmcodec.h +++ b/firmware/export/wmcodec.h | |||
@@ -17,7 +17,6 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | void i2s_reset(void); | ||
21 | int audiohw_init(void); | 20 | int audiohw_init(void); |
22 | void wmcodec_write(int reg, int data); | 21 | void wmcodec_write(int reg, int data); |
23 | 22 | ||
diff --git a/firmware/target/arm/i2s-pp.c b/firmware/target/arm/i2s-pp.c new file mode 100644 index 0000000000..1485147de8 --- /dev/null +++ b/firmware/target/arm/i2s-pp.c | |||
@@ -0,0 +1,95 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Portalplayer specific code for I2S | ||
11 | * | ||
12 | * Based on code from the ipodlinux project - http://ipodlinux.org/ | ||
13 | * Adapted for Rockbox in December 2005 | ||
14 | * | ||
15 | * Original file: linux/arch/armnommu/mach-ipod/audio.c | ||
16 | * | ||
17 | * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org) | ||
18 | * | ||
19 | * All files in this archive are subject to the GNU General Public License. | ||
20 | * See the file COPYING in the source tree root for full license agreement. | ||
21 | * | ||
22 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
23 | * KIND, either express or implied. | ||
24 | * | ||
25 | ****************************************************************************/ | ||
26 | |||
27 | #include "system.h" | ||
28 | |||
29 | /* TODO: Add in PP5002 defs */ | ||
30 | #if CONFIG_CPU == PP5002 | ||
31 | void i2s_reset(void) | ||
32 | { | ||
33 | /* I2S device reset */ | ||
34 | DEV_RS |= 0x80; | ||
35 | DEV_RS &= ~0x80; | ||
36 | |||
37 | /* I2S controller enable */ | ||
38 | IISCONFIG |= 1; | ||
39 | |||
40 | /* BIT.FORMAT [11:10] = I2S (default) */ | ||
41 | /* BIT.SIZE [9:8] = 24bit */ | ||
42 | /* FIFO.FORMAT = 24 bit LSB */ | ||
43 | |||
44 | /* reset DAC and ADC fifo */ | ||
45 | IISFIFO_CFG |= 0x30000; | ||
46 | } | ||
47 | #else /* PP502X */ | ||
48 | |||
49 | /* Data format on the I2S bus */ | ||
50 | #define FORMAT_MASK (0x3 << 10) | ||
51 | #define FORMAT_I2S (0x00 << 10) | ||
52 | /* Other formats not yet known */ | ||
53 | |||
54 | /* Data size on I2S bus */ | ||
55 | #define SIZE_MASK (0x3 << 8) | ||
56 | #define SIZE_16BIT (0x00 << 10) | ||
57 | /* Other sizes not yet known */ | ||
58 | |||
59 | /* Data size/format on I2S FIFO */ | ||
60 | #define FIFO_FORMAT_MASK (0x7 << 4) | ||
61 | #define FIFO_FORMAT_32LSB (0x03 << 4) | ||
62 | /* Other formats not yet known */ | ||
63 | |||
64 | /* Are we I2S Master or slave? */ | ||
65 | #define I2S_MASTER (0x25) | ||
66 | |||
67 | #define I2S_RESET (0x1 << 31) | ||
68 | |||
69 | /* | ||
70 | * Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit | ||
71 | */ | ||
72 | void i2s_reset(void) | ||
73 | { | ||
74 | /* I2S soft reset */ | ||
75 | IISCONFIG |= I2S_RESET; | ||
76 | IISCONFIG &= ~I2S_RESET; | ||
77 | |||
78 | /* BIT.FORMAT */ | ||
79 | IISCONFIG = ((IISCONFIG & ~FORMAT_MASK) | FORMAT_I2S); | ||
80 | |||
81 | /* BIT.SIZE */ | ||
82 | IISCONFIG = ((IISCONFIG & ~SIZE_MASK) | SIZE_16BIT); | ||
83 | |||
84 | /* FIFO.FORMAT */ | ||
85 | /* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */ | ||
86 | IISCONFIG = ((IISCONFIG & ~FIFO_FORMAT_MASK) | FIFO_FORMAT_32LSB); | ||
87 | |||
88 | /* RX_ATN_LVL=1 == when 12 slots full */ | ||
89 | /* TX_ATN_LVL=1 == when 12 slots empty */ | ||
90 | IISFIFO_CFG |= 0x33; | ||
91 | |||
92 | /* Rx.CLR = 1, TX.CLR = 1 */ | ||
93 | IISFIFO_CFG |= 0x1100; | ||
94 | } | ||
95 | #endif | ||
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c index 8aa862c187..471cd8f4a5 100644 --- a/firmware/target/arm/wmcodec-pp.c +++ b/firmware/target/arm/wmcodec-pp.c | |||
@@ -23,19 +23,8 @@ | |||
23 | * KIND, either express or implied. | 23 | * KIND, either express or implied. |
24 | * | 24 | * |
25 | ****************************************************************************/ | 25 | ****************************************************************************/ |
26 | #include "lcd.h" | 26 | |
27 | #include "cpu.h" | ||
28 | #include "kernel.h" | ||
29 | #include "thread.h" | ||
30 | #include "power.h" | ||
31 | #include "debug.h" | ||
32 | #include "system.h" | 27 | #include "system.h" |
33 | #include "sprintf.h" | ||
34 | #include "button.h" | ||
35 | #include "string.h" | ||
36 | #include "file.h" | ||
37 | #include "buffer.h" | ||
38 | #include "audio.h" | ||
39 | 28 | ||
40 | #if CONFIG_CPU == PP5020 | 29 | #if CONFIG_CPU == PP5020 |
41 | #include "i2c-pp5020.h" | 30 | #include "i2c-pp5020.h" |
@@ -51,47 +40,6 @@ | |||
51 | #define I2C_AUDIO_ADDRESS 0x1a | 40 | #define I2C_AUDIO_ADDRESS 0x1a |
52 | #endif | 41 | #endif |
53 | 42 | ||
54 | /* | ||
55 | * Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit | ||
56 | */ | ||
57 | void i2s_reset(void) | ||
58 | { | ||
59 | #if CONFIG_CPU == PP5020 | ||
60 | /* I2S soft reset */ | ||
61 | outl(inl(0x70002800) | 0x80000000, 0x70002800); | ||
62 | outl(inl(0x70002800) & ~0x80000000, 0x70002800); | ||
63 | |||
64 | /* BIT.FORMAT [11:10] = I2S (default) */ | ||
65 | outl(inl(0x70002800) & ~0xc00, 0x70002800); | ||
66 | /* BIT.SIZE [9:8] = 16bit (default) */ | ||
67 | outl(inl(0x70002800) & ~0x300, 0x70002800); | ||
68 | |||
69 | /* FIFO.FORMAT [6:4] = 32 bit LSB */ | ||
70 | /* since BIT.SIZ < FIFO.FORMAT low 16 bits will be 0 */ | ||
71 | outl(inl(0x70002800) | 0x30, 0x70002800); | ||
72 | |||
73 | /* RX_ATN_LVL=1 == when 12 slots full */ | ||
74 | /* TX_ATN_LVL=1 == when 12 slots empty */ | ||
75 | outl(inl(0x7000280c) | 0x33, 0x7000280c); | ||
76 | |||
77 | /* Rx.CLR = 1, TX.CLR = 1 */ | ||
78 | outl(inl(0x7000280c) | 0x1100, 0x7000280c); | ||
79 | #elif CONFIG_CPU == PP5002 | ||
80 | /* I2S device reset */ | ||
81 | outl(inl(0xcf005030) | 0x80, 0xcf005030); | ||
82 | outl(inl(0xcf005030) & ~0x80, 0xcf005030); | ||
83 | |||
84 | /* I2S controller enable */ | ||
85 | outl(inl(0xc0002500) | 0x1, 0xc0002500); | ||
86 | |||
87 | /* BIT.FORMAT [11:10] = I2S (default) */ | ||
88 | /* BIT.SIZE [9:8] = 24bit */ | ||
89 | /* FIFO.FORMAT = 24 bit LSB */ | ||
90 | |||
91 | /* reset DAC and ADC fifo */ | ||
92 | outl(inl(0xc000251c) | 0x30000, 0xc000251c); | ||
93 | #endif | ||
94 | } | ||
95 | 43 | ||
96 | /* | 44 | /* |
97 | * Initialise the WM8975 for playback via headphone and line out. | 45 | * Initialise the WM8975 for playback via headphone and line out. |