diff options
Diffstat (limited to 'firmware/target/coldfire/wmcodec-coldfire.c')
-rw-r--r-- | firmware/target/coldfire/wmcodec-coldfire.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/firmware/target/coldfire/wmcodec-coldfire.c b/firmware/target/coldfire/wmcodec-coldfire.c new file mode 100644 index 0000000000..4403b9a2a2 --- /dev/null +++ b/firmware/target/coldfire/wmcodec-coldfire.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id:$ | ||
9 | * | ||
10 | * Coldfire specific code for Wolfson audio codecs based on | ||
11 | * wmcodec-pp.c | ||
12 | * | ||
13 | * Based on code from the ipodlinux project - http://ipodlinux.org/ | ||
14 | * Adapted for Rockbox in December 2005 | ||
15 | * | ||
16 | * Original file: linux/arch/armnommu/mach-ipod/audio.c | ||
17 | * | ||
18 | * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org) | ||
19 | * | ||
20 | * This program is free software; you can redistribute it and/or | ||
21 | * modify it under the terms of the GNU General Public License | ||
22 | * as published by the Free Software Foundation; either version 2 | ||
23 | * of the License, or (at your option) any later version. | ||
24 | * | ||
25 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
26 | * KIND, either express or implied. | ||
27 | * | ||
28 | ****************************************************************************/ | ||
29 | #include "system.h" | ||
30 | #include "audiohw.h" | ||
31 | #include "i2c-coldfire.h" | ||
32 | #include "i2s.h" | ||
33 | #include "wmcodec.h" | ||
34 | |||
35 | #if defined(MPIO_HD200) | ||
36 | #define I2C_CODEC_ADDRESS 0x34 | ||
37 | #define I2C_IFACE I2C_IFACE_1 | ||
38 | #endif | ||
39 | |||
40 | void audiohw_init(void) | ||
41 | { | ||
42 | audiohw_preinit(); | ||
43 | } | ||
44 | |||
45 | void wmcodec_write(int reg, int data) | ||
46 | { | ||
47 | unsigned char wmdata[2]; | ||
48 | wmdata[0] = (reg << 1) | ((data & 0x100)>>8); | ||
49 | wmdata[1] = data & 0xff; | ||
50 | i2c_write(I2C_IFACE,I2C_CODEC_ADDRESS,wmdata,2); | ||
51 | return; | ||
52 | } | ||