summaryrefslogtreecommitdiff
path: root/firmware/export/uda1380.h
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-03-18 11:35:11 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-03-18 11:35:11 +0000
commitb8577dd5828b962238569277f96fe1a09321d813 (patch)
tree4111002c89c847621e731661c2cb19bf96eff722 /firmware/export/uda1380.h
parenta3176e4d828e335b16c60948fea10ba0b078057e (diff)
downloadrockbox-b8577dd5828b962238569277f96fe1a09321d813.tar.gz
rockbox-b8577dd5828b962238569277f96fe1a09321d813.zip
iRiver UDA1380 driver by Andy Young
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6204 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/uda1380.h')
-rw-r--r--firmware/export/uda1380.h161
1 files changed, 161 insertions, 0 deletions
diff --git a/firmware/export/uda1380.h b/firmware/export/uda1380.h
new file mode 100644
index 0000000000..2d560e537e
--- /dev/null
+++ b/firmware/export/uda1380.h
@@ -0,0 +1,161 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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/*
21 * Driver for UDA1380 Audio-Codec
22 * 2005-02-17 hubble@mochine.com
23 *
24 */
25
26#ifndef _UDA1380_H
27#define _UDA1380_H
28
29extern int uda1380_init(void);
30extern int uda1380_setvol(int vol);
31extern int uda1380_mute(int mute);
32extern void uda1380_close(void);
33
34#define UDA1380_ADDR 0x30
35
36/* REG_0: Misc settings */
37#define REG_0 0x00
38
39#define EN_ADC (1 << 11) /* Enable ADC */
40#define EN_DEC (1 << 10) /* Enable Decimator */
41#define EN_DAC (1 << 9) /* Enable DAC */
42#define EN_INT (1 << 8) /* Enable Interpolator */
43#define ADC_CLK (1 << 5) /* ADC_CLK: WSPLL (1) SYSCLK (0) */
44#define DAC_CLK (1 << 4) /* DAC_CLK: WSPLL (1) SYSCLK (0) */
45
46/* SYSCLK freqency select */
47#define SYSCLK_256FS (0 << 2)
48#define SYSCLK_384FS (1 << 2)
49#define SYSCLK_512FS (2 << 2)
50#define SYSCLK_768FS (3 << 2)
51
52/* WSPLL Input frequency range (kHz) */
53#define WSPLL_625_125 (0 << 0) /* 6.25 - 12.5 */
54#define WSPLL_125_25 (1 << 0) /* 12.5 - 25 */
55#define WSPLL_25_50 (2 << 0) /* 25 - 50 */
56#define WSPLL_50_100 (3 << 0) /* 50 - 100 */
57
58
59/* REG_I2S: I2S settings */
60#define REG_I2S 0x01
61#define I2S_IFMT_IIS (0 << 8)
62#define I2S_IFMT_LSB16 (1 << 8)
63#define I2S_IFMT_LSB18 (2 << 8)
64#define I2S_IFMT_LSB20 (3 << 8)
65#define I2S_IFMT_MSB (5 << 8)
66#define I2S_OFMT_IIS (0 << 0)
67#define I2S_OFMT_LSB16 (1 << 0)
68#define I2S_OFMT_LSB18 (2 << 0)
69#define I2S_OFMT_LSB20 (3 << 0)
70#define I2S_OFMT_LSB24 (4 << 0)
71#define I2S_OFMT_MSB (5 << 0)
72
73
74/* REG_PWR: Power control */
75#define REG_PWR 0x02
76#define PON_PLL (1 << 15) /* Power-on WSPLL */
77#define PON_HP (1 << 13) /* Power-on Headphone driver */
78#define PON_DAC (1 << 10) /* Power-on DAC */
79#define PON_BIAS (1 << 8) /* Power-on BIAS for ADC, AVC, FSDAC */
80#define EN_AVC (1 << 7) /* Enable analog mixer */
81#define PON_AVC (1 << 6) /* Power-on analog mixer */
82#define PON_LNA (1 << 4) /* Power-on LNA & SDC */
83#define PON_PGAL (1 << 3) /* Power-on PGA left */
84#define PON_ADCL (1 << 2) /* Power-on ADC left */
85#define PON_PGAR (1 << 1) /* Power-on PGA right */
86#define PON_ADCR (1 << 0) /* Power-on ADC right */
87
88
89/* REG_AMIX: Analog mixer */
90#define REG_AMIX 0x03
91#define AMIX_LEFT(x) (((x) & 0x3f) << 8)
92#define AMIX_RIGHT(x) (((x) & 0x3f) << 0)
93
94/* REG_HP: Headphone amp */
95#define REG_HP 0x04
96
97/* REG_MV: Master Volume control */
98#define REG_MASTER_VOL 0x10
99
100#define MASTER_VOL_RIGHT(x) (((x) & 0xff) << 8)
101#define MASTER_VOL_LEFT(x) (((x) & 0xff) << 0)
102
103/* REG_MIX: Mixer volume control */
104/* Channel 1 is from digital data from I2S */
105/* Channel 2 is from decimation filter */
106
107#define REG_MIX_VOL 0x11
108#define MIX_VOL_CHANNEL_1(x) (((x) & 0xff) << 0)
109#define MIX_VOL_CHANNEL_2(x) (((x) & 0xff) << 8)
110
111/* REG_EQ: Bass boost and tremble */
112#define REG_EQ 0x12
113
114/* REG_MUTE: Master Mute */
115#define REG_MUTE 0x13
116#define MUTE_MASTER (1 << 14) /* Master Mute (soft) */
117#define MUTE_CH2 (1 << 11) /* Channel 2 mute */
118#define MUTE_CH1 (1 << 3) /* Channel 1 mute */
119
120/* REG_MIX_CTL: Mixer, silence detector and oversampling settings */
121#define REG_MIX_CTL 0x14
122#define MIX_CTL_MIX_POS (1 << 13)
123#define MIX_CTL_MIX (1 << 12)
124
125/* REG_DEC_VOL: Decimator Volume control */
126#define REG_DEC_VOL 0x20
127
128/* REG_PGA: PGA settings and mute */
129#define REG_PGA 0x21
130#define MUTE_ADC (1 << 15) /* Mute ADC */
131
132/* REG_ADC: */
133#define REG_ADC 0x22
134
135/* REG_AGC: Attack / Gain */
136#define REG_AGC 0x23
137#define SKIP_DCFIL ( 1 << 1)
138
139
140/* Audio tick interrupt */
141#define AUDIO_TICK_NUMBER 8
142#define AUDIO_TICK_BIT (1 << 8)
143
144
145/* AUDIOGLOB bits */
146
147#define TICK_COUNT(x) ((x) << 3)
148
149#define TICK_SOURCE_IIS1_TX 1
150#define TICK_SOURCE_IIS2_TX 2
151#define TICK_SOURCE_EBU_TX 3
152#define TICK_SOURCE_IIS1_RX 4
153#define TICK_SOURCE_IIS3_RX 5
154#define TICK_SOURCE_IIS4_RX 6
155#define TICK_SOURCE_EBU1_RX 7
156#define TICK_SOURCE_EBU2_RX (1 << 11)
157
158
159
160
161#endif /* _UDA_1380_H */