2006-12-09 19:18:18 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Portalplayer specific code for I2S
|
|
|
|
*
|
|
|
|
* Based on code from the ipodlinux project - http://ipodlinux.org/
|
|
|
|
* Adapted for Rockbox in December 2005
|
|
|
|
*
|
|
|
|
* Original file: linux/arch/armnommu/mach-ipod/audio.c
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org)
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-12-09 19:18:18 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include "system.h"
|
2007-07-26 10:46:17 +00:00
|
|
|
#include "cpu.h"
|
2008-04-28 10:22:05 +00:00
|
|
|
#include "i2s.h"
|
2006-12-09 19:18:18 +00:00
|
|
|
|
|
|
|
#if CONFIG_CPU == PP5002
|
|
|
|
void i2s_reset(void)
|
|
|
|
{
|
|
|
|
/* I2S device reset */
|
2008-12-12 11:01:07 +00:00
|
|
|
DEV_RS |= DEV_I2S;
|
|
|
|
DEV_RS &= ~DEV_I2S;
|
2006-12-09 19:18:18 +00:00
|
|
|
|
|
|
|
/* I2S controller enable */
|
2008-12-12 11:01:07 +00:00
|
|
|
IISCONFIG |= IIS_ENABLE;
|
2006-12-09 19:18:18 +00:00
|
|
|
|
|
|
|
/* reset DAC and ADC fifo */
|
2008-12-12 11:01:07 +00:00
|
|
|
IISFIFO_CFG |= IIS_RXCLR | IIS_TXCLR;
|
2006-12-09 19:18:18 +00:00
|
|
|
}
|
|
|
|
#else /* PP502X */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit
|
|
|
|
*/
|
|
|
|
void i2s_reset(void)
|
|
|
|
{
|
|
|
|
/* I2S soft reset */
|
2007-10-06 22:27:27 +00:00
|
|
|
IISCONFIG |= IIS_RESET;
|
|
|
|
IISCONFIG &= ~IIS_RESET;
|
2006-12-09 19:18:18 +00:00
|
|
|
|
|
|
|
/* BIT.FORMAT */
|
2007-10-07 06:10:08 +00:00
|
|
|
IISCONFIG = ((IISCONFIG & ~IIS_FORMAT_MASK) | IIS_FORMAT_IIS);
|
2007-10-07 20:14:32 +00:00
|
|
|
/* BIT.SIZE */
|
|
|
|
IISCONFIG = ((IISCONFIG & ~IIS_SIZE_MASK) | IIS_SIZE_16BIT);
|
2006-12-09 19:18:18 +00:00
|
|
|
|
|
|
|
/* FIFO.FORMAT */
|
|
|
|
/* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */
|
2007-03-11 17:38:08 +00:00
|
|
|
#ifdef HAVE_AS3514
|
|
|
|
/* AS3514 can only operate as I2S Slave */
|
2007-10-06 22:27:27 +00:00
|
|
|
IISCONFIG |= IIS_MASTER;
|
2007-03-11 17:38:08 +00:00
|
|
|
/* Set I2S to 44.1kHz */
|
2007-10-07 20:14:32 +00:00
|
|
|
IISCLK = (IISCLK & ~0x1ff) | 33;
|
|
|
|
IISDIV = 7;
|
2007-10-09 20:12:26 +00:00
|
|
|
#endif /* HAVE_AS3514 */
|
|
|
|
|
2007-10-07 20:14:32 +00:00
|
|
|
IISCONFIG = ((IISCONFIG & ~IIS_FIFO_FORMAT_MASK) | IIS_FIFO_FORMAT_LE16_2);
|
2006-12-09 19:18:18 +00:00
|
|
|
|
2007-10-06 22:27:27 +00:00
|
|
|
/* RX_ATN_LVL = when 12 slots full */
|
|
|
|
/* TX_ATN_LVL = when 12 slots empty */
|
|
|
|
IISFIFO_CFG |= IIS_RX_FULL_LVL_12 | IIS_TX_EMPTY_LVL_12;
|
2006-12-09 19:18:18 +00:00
|
|
|
|
|
|
|
/* Rx.CLR = 1, TX.CLR = 1 */
|
2007-10-06 22:27:27 +00:00
|
|
|
IISFIFO_CFG |= IIS_RXCLR | IIS_TXCLR;
|
2006-12-09 19:18:18 +00:00
|
|
|
}
|
2007-07-26 10:46:17 +00:00
|
|
|
|
2007-10-04 04:53:01 +00:00
|
|
|
#endif /* CONFIG_CPU == */
|