SAMV71 Xplained Ultra Software Package 1.4

wm8904.h

Go to the documentation of this file.
00001 /* ----------------------------------------------------------------------------
00002  *         SAM Software Package License 
00003  * ----------------------------------------------------------------------------
00004  * Copyright (c) 2012, Atmel Corporation
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the disclaimer below.
00013  *
00014  * Atmel's name may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  *
00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  * ----------------------------------------------------------------------------
00028  */
00029 
00030 /**
00031   * \file
00032   *
00033   * Implementation WM8904 driver.
00034   *
00035   */
00036 
00037 #ifndef WM8904_H
00038 #define WM8904_H
00039 
00040 #include "board.h"
00041 
00042 /*----------------------------------------------------------------------------
00043  *         Definitions
00044  *----------------------------------------------------------------------------*/
00045 #define WM8904_CSB_STATE            (0x0 << 0)
00046 
00047 /** Slave address */
00048 #define WM8904_SLAVE_ADDRESS        0x1a | WM8904_CSB_STATE
00049 #define CS2100_SLAVE_ADDRESS        0x4E
00050 
00051 
00052 /** Reset register*/
00053 #define WM8904_REG_RESET                           0x00
00054 
00055 /** Bias control 0 register*/
00056 #define WM8904_REG_BIAS_CTRL0                      0x04
00057 
00058 /** VMID control 0 register*/
00059 #define WM8904_REG_VMID_CTRL0                      0x05
00060 
00061 /** MIC Bias control 0 register*/
00062 #define WM8904_REG_MICBIAS_CTRL0                   0x06
00063 
00064 /** Bias control 1 register*/
00065 #define WM8904_REG_BIAS_CTRL1                      0x07
00066 
00067 /** Power management control 0 register*/
00068 #define WM8904_REG_POWER_MANG0                     0x0C
00069 /** Power management control 2 register*/
00070 #define WM8904_REG_POWER_MANG2                     0x0E
00071 /** Power management control 3 register*/
00072 #define WM8904_REG_POWER_MANG3                     0x0F
00073 /** Power management control 6 register*/
00074 #define WM8904_REG_POWER_MANG6                     0x12
00075 
00076 /** Clock rate0 register*/
00077 #define WM8904_REG_CLOCK_RATE0                     0x14
00078 /** Clock rate1 register*/
00079 #define WM8904_REG_CLOCK_RATE1                     0x15
00080 
00081 /** Clock rate2 register*/
00082 #define WM8904_REG_CLOCK_RATE2                     0x16
00083 
00084 /** Audio interface0 register*/
00085 #define WM8904_REG_AUD_INF0                        0x18
00086 
00087 /** Audio interface1 register*/
00088 #define WM8904_REG_AUD_INF1                        0x19
00089 /** Audio interface2 register*/
00090 #define WM8904_REG_AUD_INF2                        0x1A
00091 /** Audio interface3 register*/
00092 #define WM8904_REG_AUD_INF3                        0x1B
00093 
00094 /** ADC digital 0 register*/
00095 #define WM8904_REG_ADC_DIG0                        0x20
00096 /** ADC digital 1 register*/
00097 #define WM8904_REG_ADC_DIG1                        0x21
00098 
00099 /** Analogue left input 0 register*/
00100 #define WM8904_REG_ANALOGUE_LIN0                   0x2C
00101 /** Analogue right input 0 register*/
00102 #define WM8904_REG_ANALOGUE_RIN0                   0x2D
00103 
00104 /** Analogue left input 1 register*/
00105 #define WM8904_REG_ANALOGUE_LIN1                   0x2E
00106 /** Analogue right input 1 register*/
00107 #define WM8904_REG_ANALOGUE_RIN1                   0x2F
00108 
00109 /** Analogue left output 1 register*/
00110 #define WM8904_REG_ANALOGUE_LOUT1                  0x39
00111 /** Analogue right output 1 register*/
00112 #define WM8904_REG_ANALOGUE_ROUT1                  0x3A
00113 
00114 /** Analogue left output 2 register*/
00115 #define WM8904_REG_ANALOGUE_LOUT2                  0x3B
00116 /** Analogue right output 2 register*/
00117 #define WM8904_REG_ANALOGUE_ROUT2                  0x3C
00118 
00119 /** Analogue output 12 ZC register*/
00120 #define WM8904_REG_ANALOGUE_OUT12ZC                0x3D
00121 
00122 /** DC servo 0 register*/
00123 #define WM8904_REG_DC_SERVO0                       0x43
00124 
00125 /** Analogue HP 0 register*/
00126 #define WM8904_REG_ANALOGUE_HP0                    0x5A
00127 
00128 /** Charge pump 0 register*/
00129 #define WM8904_REG_CHARGE_PUMP0                    0x62
00130 
00131 /** Class W 0 register*/
00132 #define WM8904_REG_CLASS0                          0x68
00133 
00134 /** FLL control 1 register*/
00135 #define WM8904_REG_FLL_CRTL1                       0x74
00136 /** FLL control 2 register*/
00137 #define WM8904_REG_FLL_CRTL2                       0x75
00138 /** FLL control 3 register*/
00139 #define WM8904_REG_FLL_CRTL3                       0x76
00140 /** FLL control 4 register*/
00141 #define WM8904_REG_FLL_CRTL4                       0x77
00142 /** FLL control 5 register*/
00143 #define WM8904_REG_FLL_CRTL5                       0x78
00144 
00145 /** DUMMY register*/
00146 #define WM8904_REG_END                             0xFF
00147 
00148 /*----------------------------------------------------------------------------
00149  *         Exported functions
00150  *----------------------------------------------------------------------------*/
00151 
00152 extern uint16_t WM8904_Read(Twid *pTwid, uint32_t device, uint32_t regAddr);
00153 extern void WM8904_Write(Twid *pTwid, uint32_t device, uint32_t regAddr,
00154                 uint16_t data);
00155 extern uint8_t WM8904_Init(Twid *pTwid, uint32_t device, uint32_t PCK);
00156 extern uint8_t WM8904_VolumeSet(Twid *pTwid,  uint32_t device, uint16_t value);
00157 extern void WM8904_IN2R_IN1L(Twid *pTwid, uint32_t device);
00158 #endif // WM8904_H
00159 
00160 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines