1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Portalplayer specific code for I2S
12 * Based on code from the ipodlinux project - http://ipodlinux.org/
13 * Adapted for Rockbox in December 2005
15 * Original file: linux/arch/armnommu/mach-ipod/audio.c
17 * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org)
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
25 * KIND, either express or implied.
27 ****************************************************************************/
31 #if defined (SANSA_E200) || defined (SANSA_C200)
33 #include "pcm_sampr.h"
36 #if CONFIG_CPU == PP5002
39 /* I2S device reset */
43 /* I2S controller enable */
44 IISCONFIG
|= IIS_ENABLE
;
46 /* reset DAC and ADC fifo */
47 IISFIFO_CFG
|= IIS_RXCLR
| IIS_TXCLR
;
52 * Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit
57 IISCONFIG
|= IIS_RESET
;
58 IISCONFIG
&= ~IIS_RESET
;
61 IISCONFIG
= ((IISCONFIG
& ~IIS_FORMAT_MASK
) | IIS_FORMAT_IIS
);
63 IISCONFIG
= ((IISCONFIG
& ~IIS_SIZE_MASK
) | IIS_SIZE_16BIT
);
66 /* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */
68 /* AS3514 can only operate as I2S Slave */
69 IISCONFIG
|= IIS_MASTER
;
71 /* Set I2S to 44.1kHz */
73 /* values taken from the SA9200 OF */
74 IISCLK
= (IISCLK
& ~0x1ff) | 31;
75 IISDIV
= (IISDIV
& ~0xc0000000) | (2 << 30);
76 IISDIV
= (IISDIV
& ~0x3f) | 16;
77 #elif defined (SANSA_E200) || defined (SANSA_C200)
78 audiohw_set_sampr_dividers(HW_FREQ_DEFAULT
);
80 IISCLK
= (IISCLK
& ~0x1ff) | 33;
83 #endif /* HAVE_AS3514 */
85 IISCONFIG
= ((IISCONFIG
& ~IIS_FIFO_FORMAT_MASK
) | IIS_FIFO_FORMAT_LE16_2
);
87 /* RX_ATN_LVL = when 12 slots full */
88 /* TX_ATN_LVL = DMA request when 4 slots empty */
89 IISFIFO_CFG
|= IIS_RX_FULL_LVL_12
| IIS_TX_EMPTY_LVL_4
;
91 /* Rx.CLR = 1, TX.CLR = 1 */
92 IISFIFO_CFG
|= IIS_RXCLR
| IIS_TXCLR
;
95 #endif /* CONFIG_CPU == */