Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:22:44

0001 /* ---------------------------------------------------------------------------- */
0002 /*                  Atmel Microcontroller Software Support                      */
0003 /*                       SAM Software Package License                           */
0004 /* ---------------------------------------------------------------------------- */
0005 /* Copyright (c) 2015, Atmel Corporation                                        */
0006 /*                                                                              */
0007 /* All rights reserved.                                                         */
0008 /*                                                                              */
0009 /* Redistribution and use in source and binary forms, with or without           */
0010 /* modification, are permitted provided that the following condition is met:    */
0011 /*                                                                              */
0012 /* - Redistributions of source code must retain the above copyright notice,     */
0013 /* this list of conditions and the disclaimer below.                            */
0014 /*                                                                              */
0015 /* Atmel's name may not be used to endorse or promote products derived from     */
0016 /* this software without specific prior written permission.                     */
0017 /*                                                                              */
0018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
0019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
0020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
0021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
0022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
0023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
0024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
0025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
0026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
0027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
0028 /* ---------------------------------------------------------------------------- */
0029 
0030 /**
0031   * \file
0032   *
0033   * Implementation WM8904 driver.
0034   *
0035   */
0036 
0037 #ifndef WM8904_H
0038 #define WM8904_H
0039 
0040 #include "board.h"
0041 
0042 /*----------------------------------------------------------------------------
0043  *         Definitions
0044  *----------------------------------------------------------------------------*/
0045 #define WM8904_CSB_STATE            (0x0 << 0)
0046 
0047 /** Slave address */
0048 #define WM8904_SLAVE_ADDRESS        0x1a | WM8904_CSB_STATE
0049 #define CS2100_SLAVE_ADDRESS        0x4E
0050 
0051 
0052 /** Reset register*/
0053 #define WM8904_REG_RESET                           0x00
0054 
0055 /** Bias control 0 register*/
0056 #define WM8904_REG_BIAS_CTRL0                      0x04
0057 
0058 /** VMID control 0 register*/
0059 #define WM8904_REG_VMID_CTRL0                      0x05
0060 
0061 /** MIC Bias control 0 register*/
0062 #define WM8904_REG_MICBIAS_CTRL0                   0x06
0063 
0064 /** Bias control 1 register*/
0065 #define WM8904_REG_BIAS_CTRL1                      0x07
0066 
0067 /** Power management control 0 register*/
0068 #define WM8904_REG_POWER_MANG0                     0x0C
0069 /** Power management control 2 register*/
0070 #define WM8904_REG_POWER_MANG2                     0x0E
0071 /** Power management control 3 register*/
0072 #define WM8904_REG_POWER_MANG3                     0x0F
0073 /** Power management control 6 register*/
0074 #define WM8904_REG_POWER_MANG6                     0x12
0075 
0076 /** Clock rate0 register*/
0077 #define WM8904_REG_CLOCK_RATE0                     0x14
0078 /** Clock rate1 register*/
0079 #define WM8904_REG_CLOCK_RATE1                     0x15
0080 
0081 /** Clock rate2 register*/
0082 #define WM8904_REG_CLOCK_RATE2                     0x16
0083 
0084 /** Audio interface0 register*/
0085 #define WM8904_REG_AUD_INF0                        0x18
0086 
0087 /** Audio interface1 register*/
0088 #define WM8904_REG_AUD_INF1                        0x19
0089 /** Audio interface2 register*/
0090 #define WM8904_REG_AUD_INF2                        0x1A
0091 /** Audio interface3 register*/
0092 #define WM8904_REG_AUD_INF3                        0x1B
0093 
0094 /** ADC digital 0 register*/
0095 #define WM8904_REG_ADC_DIG0                        0x20
0096 /** ADC digital 1 register*/
0097 #define WM8904_REG_ADC_DIG1                        0x21
0098 
0099 /** Analogue left input 0 register*/
0100 #define WM8904_REG_ANALOGUE_LIN0                   0x2C
0101 /** Analogue right input 0 register*/
0102 #define WM8904_REG_ANALOGUE_RIN0                   0x2D
0103 
0104 /** Analogue left input 1 register*/
0105 #define WM8904_REG_ANALOGUE_LIN1                   0x2E
0106 /** Analogue right input 1 register*/
0107 #define WM8904_REG_ANALOGUE_RIN1                   0x2F
0108 
0109 /** Analogue left output 1 register*/
0110 #define WM8904_REG_ANALOGUE_LOUT1                  0x39
0111 /** Analogue right output 1 register*/
0112 #define WM8904_REG_ANALOGUE_ROUT1                  0x3A
0113 
0114 /** Analogue left output 2 register*/
0115 #define WM8904_REG_ANALOGUE_LOUT2                  0x3B
0116 /** Analogue right output 2 register*/
0117 #define WM8904_REG_ANALOGUE_ROUT2                  0x3C
0118 
0119 /** Analogue output 12 ZC register*/
0120 #define WM8904_REG_ANALOGUE_OUT12ZC                0x3D
0121 
0122 /** DC servo 0 register*/
0123 #define WM8904_REG_DC_SERVO0                       0x43
0124 
0125 /** Analogue HP 0 register*/
0126 #define WM8904_REG_ANALOGUE_HP0                    0x5A
0127 
0128 /** Charge pump 0 register*/
0129 #define WM8904_REG_CHARGE_PUMP0                    0x62
0130 
0131 /** Class W 0 register*/
0132 #define WM8904_REG_CLASS0                          0x68
0133 
0134 /** FLL control 1 register*/
0135 #define WM8904_REG_FLL_CRTL1                       0x74
0136 /** FLL control 2 register*/
0137 #define WM8904_REG_FLL_CRTL2                       0x75
0138 /** FLL control 3 register*/
0139 #define WM8904_REG_FLL_CRTL3                       0x76
0140 /** FLL control 4 register*/
0141 #define WM8904_REG_FLL_CRTL4                       0x77
0142 /** FLL control 5 register*/
0143 #define WM8904_REG_FLL_CRTL5                       0x78
0144 
0145 /** DUMMY register*/
0146 #define WM8904_REG_END                             0xFF
0147 
0148 /*----------------------------------------------------------------------------
0149  *         Exported functions
0150  *----------------------------------------------------------------------------*/
0151 
0152 extern uint16_t WM8904_Read(Twid *pTwid, uint32_t device, uint32_t regAddr);
0153 extern void WM8904_Write(Twid *pTwid, uint32_t device, uint32_t regAddr,
0154                          uint16_t data);
0155 extern uint8_t WM8904_Init(Twid *pTwid, uint32_t device, uint32_t PCK);
0156 extern uint8_t WM8904_VolumeSet(Twid *pTwid,  uint32_t device, uint16_t value);
0157 extern void WM8904_IN2R_IN1L(Twid *pTwid, uint32_t device);
0158 #endif // WM8904_H
0159 
0160