Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Miscellany
Saturday, December 9th, 2006 at 6:13:51pm UTC 

  1. /***************************************************************************
  2.  *             __________               __   ___.
  3.  *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  4.  *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  5.  *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  6.  *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  7.  *                     \/            \/     \/    \/            \/
  8.  * $Id: wmcodec-pp.c,v 1.2 2006-10-27 11:24:23 bagder Exp $
  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 (0x011 << 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

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right