1 | /* ---------------------------------------------------------------------------- */ |
---|
2 | /* Atmel Microcontroller Software Support */ |
---|
3 | /* SAM Software Package License */ |
---|
4 | /* ---------------------------------------------------------------------------- */ |
---|
5 | /* Copyright (c) 2015, Atmel Corporation */ |
---|
6 | /* */ |
---|
7 | /* All rights reserved. */ |
---|
8 | /* */ |
---|
9 | /* Redistribution and use in source and binary forms, with or without */ |
---|
10 | /* modification, are permitted provided that the following condition is met: */ |
---|
11 | /* */ |
---|
12 | /* - Redistributions of source code must retain the above copyright notice, */ |
---|
13 | /* this list of conditions and the disclaimer below. */ |
---|
14 | /* */ |
---|
15 | /* Atmel's name may not be used to endorse or promote products derived from */ |
---|
16 | /* this software without specific prior written permission. */ |
---|
17 | /* */ |
---|
18 | /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ |
---|
19 | /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ |
---|
20 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ |
---|
21 | /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ |
---|
22 | /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ |
---|
23 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ |
---|
24 | /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ |
---|
25 | /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ |
---|
26 | /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ |
---|
27 | /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
---|
28 | /* ---------------------------------------------------------------------------- */ |
---|
29 | |
---|
30 | /** |
---|
31 | * \file |
---|
32 | * |
---|
33 | * Implementation WM8904 driver. |
---|
34 | * |
---|
35 | */ |
---|
36 | |
---|
37 | #ifndef WM8904_H |
---|
38 | #define WM8904_H |
---|
39 | |
---|
40 | #include "board.h" |
---|
41 | |
---|
42 | /*---------------------------------------------------------------------------- |
---|
43 | * Definitions |
---|
44 | *----------------------------------------------------------------------------*/ |
---|
45 | #define WM8904_CSB_STATE (0x0 << 0) |
---|
46 | |
---|
47 | /** Slave address */ |
---|
48 | #define WM8904_SLAVE_ADDRESS 0x1a | WM8904_CSB_STATE |
---|
49 | #define CS2100_SLAVE_ADDRESS 0x4E |
---|
50 | |
---|
51 | |
---|
52 | /** Reset register*/ |
---|
53 | #define WM8904_REG_RESET 0x00 |
---|
54 | |
---|
55 | /** Bias control 0 register*/ |
---|
56 | #define WM8904_REG_BIAS_CTRL0 0x04 |
---|
57 | |
---|
58 | /** VMID control 0 register*/ |
---|
59 | #define WM8904_REG_VMID_CTRL0 0x05 |
---|
60 | |
---|
61 | /** MIC Bias control 0 register*/ |
---|
62 | #define WM8904_REG_MICBIAS_CTRL0 0x06 |
---|
63 | |
---|
64 | /** Bias control 1 register*/ |
---|
65 | #define WM8904_REG_BIAS_CTRL1 0x07 |
---|
66 | |
---|
67 | /** Power management control 0 register*/ |
---|
68 | #define WM8904_REG_POWER_MANG0 0x0C |
---|
69 | /** Power management control 2 register*/ |
---|
70 | #define WM8904_REG_POWER_MANG2 0x0E |
---|
71 | /** Power management control 3 register*/ |
---|
72 | #define WM8904_REG_POWER_MANG3 0x0F |
---|
73 | /** Power management control 6 register*/ |
---|
74 | #define WM8904_REG_POWER_MANG6 0x12 |
---|
75 | |
---|
76 | /** Clock rate0 register*/ |
---|
77 | #define WM8904_REG_CLOCK_RATE0 0x14 |
---|
78 | /** Clock rate1 register*/ |
---|
79 | #define WM8904_REG_CLOCK_RATE1 0x15 |
---|
80 | |
---|
81 | /** Clock rate2 register*/ |
---|
82 | #define WM8904_REG_CLOCK_RATE2 0x16 |
---|
83 | |
---|
84 | /** Audio interface0 register*/ |
---|
85 | #define WM8904_REG_AUD_INF0 0x18 |
---|
86 | |
---|
87 | /** Audio interface1 register*/ |
---|
88 | #define WM8904_REG_AUD_INF1 0x19 |
---|
89 | /** Audio interface2 register*/ |
---|
90 | #define WM8904_REG_AUD_INF2 0x1A |
---|
91 | /** Audio interface3 register*/ |
---|
92 | #define WM8904_REG_AUD_INF3 0x1B |
---|
93 | |
---|
94 | /** ADC digital 0 register*/ |
---|
95 | #define WM8904_REG_ADC_DIG0 0x20 |
---|
96 | /** ADC digital 1 register*/ |
---|
97 | #define WM8904_REG_ADC_DIG1 0x21 |
---|
98 | |
---|
99 | /** Analogue left input 0 register*/ |
---|
100 | #define WM8904_REG_ANALOGUE_LIN0 0x2C |
---|
101 | /** Analogue right input 0 register*/ |
---|
102 | #define WM8904_REG_ANALOGUE_RIN0 0x2D |
---|
103 | |
---|
104 | /** Analogue left input 1 register*/ |
---|
105 | #define WM8904_REG_ANALOGUE_LIN1 0x2E |
---|
106 | /** Analogue right input 1 register*/ |
---|
107 | #define WM8904_REG_ANALOGUE_RIN1 0x2F |
---|
108 | |
---|
109 | /** Analogue left output 1 register*/ |
---|
110 | #define WM8904_REG_ANALOGUE_LOUT1 0x39 |
---|
111 | /** Analogue right output 1 register*/ |
---|
112 | #define WM8904_REG_ANALOGUE_ROUT1 0x3A |
---|
113 | |
---|
114 | /** Analogue left output 2 register*/ |
---|
115 | #define WM8904_REG_ANALOGUE_LOUT2 0x3B |
---|
116 | /** Analogue right output 2 register*/ |
---|
117 | #define WM8904_REG_ANALOGUE_ROUT2 0x3C |
---|
118 | |
---|
119 | /** Analogue output 12 ZC register*/ |
---|
120 | #define WM8904_REG_ANALOGUE_OUT12ZC 0x3D |
---|
121 | |
---|
122 | /** DC servo 0 register*/ |
---|
123 | #define WM8904_REG_DC_SERVO0 0x43 |
---|
124 | |
---|
125 | /** Analogue HP 0 register*/ |
---|
126 | #define WM8904_REG_ANALOGUE_HP0 0x5A |
---|
127 | |
---|
128 | /** Charge pump 0 register*/ |
---|
129 | #define WM8904_REG_CHARGE_PUMP0 0x62 |
---|
130 | |
---|
131 | /** Class W 0 register*/ |
---|
132 | #define WM8904_REG_CLASS0 0x68 |
---|
133 | |
---|
134 | /** FLL control 1 register*/ |
---|
135 | #define WM8904_REG_FLL_CRTL1 0x74 |
---|
136 | /** FLL control 2 register*/ |
---|
137 | #define WM8904_REG_FLL_CRTL2 0x75 |
---|
138 | /** FLL control 3 register*/ |
---|
139 | #define WM8904_REG_FLL_CRTL3 0x76 |
---|
140 | /** FLL control 4 register*/ |
---|
141 | #define WM8904_REG_FLL_CRTL4 0x77 |
---|
142 | /** FLL control 5 register*/ |
---|
143 | #define WM8904_REG_FLL_CRTL5 0x78 |
---|
144 | |
---|
145 | /** DUMMY register*/ |
---|
146 | #define WM8904_REG_END 0xFF |
---|
147 | |
---|
148 | /*---------------------------------------------------------------------------- |
---|
149 | * Exported functions |
---|
150 | *----------------------------------------------------------------------------*/ |
---|
151 | |
---|
152 | extern uint16_t WM8904_Read(Twid *pTwid, uint32_t device, uint32_t regAddr); |
---|
153 | extern void WM8904_Write(Twid *pTwid, uint32_t device, uint32_t regAddr, |
---|
154 | uint16_t data); |
---|
155 | extern uint8_t WM8904_Init(Twid *pTwid, uint32_t device, uint32_t PCK); |
---|
156 | extern uint8_t WM8904_VolumeSet(Twid *pTwid, uint32_t device, uint16_t value); |
---|
157 | extern void WM8904_IN2R_IN1L(Twid *pTwid, uint32_t device); |
---|
158 | #endif // WM8904_H |
---|
159 | |
---|
160 | |
---|