fsdfsdf

Fork of BSP_DISCO_F469NI by ST

Committer:
bcostm
Date:
Fri Dec 18 07:32:01 2015 +0000
Revision:
0:0002c86c2220
Initial version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:0002c86c2220 1 /**
bcostm 0:0002c86c2220 2 ******************************************************************************
bcostm 0:0002c86c2220 3 * @file cs43l22.h
bcostm 0:0002c86c2220 4 * @author MCD Application Team
bcostm 0:0002c86c2220 5 * @version V2.0.2
bcostm 0:0002c86c2220 6 * @date 06-October-2015
bcostm 0:0002c86c2220 7 * @brief This file contains all the functions prototypes for the cs43l22.c driver.
bcostm 0:0002c86c2220 8 ******************************************************************************
bcostm 0:0002c86c2220 9 * @attention
bcostm 0:0002c86c2220 10 *
bcostm 0:0002c86c2220 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bcostm 0:0002c86c2220 12 *
bcostm 0:0002c86c2220 13 * Redistribution and use in source and binary forms, with or without modification,
bcostm 0:0002c86c2220 14 * are permitted provided that the following conditions are met:
bcostm 0:0002c86c2220 15 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 0:0002c86c2220 16 * this list of conditions and the following disclaimer.
bcostm 0:0002c86c2220 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 0:0002c86c2220 18 * this list of conditions and the following disclaimer in the documentation
bcostm 0:0002c86c2220 19 * and/or other materials provided with the distribution.
bcostm 0:0002c86c2220 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 0:0002c86c2220 21 * may be used to endorse or promote products derived from this software
bcostm 0:0002c86c2220 22 * without specific prior written permission.
bcostm 0:0002c86c2220 23 *
bcostm 0:0002c86c2220 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 0:0002c86c2220 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 0:0002c86c2220 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 0:0002c86c2220 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 0:0002c86c2220 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 0:0002c86c2220 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 0:0002c86c2220 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 0:0002c86c2220 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 0:0002c86c2220 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 0:0002c86c2220 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 0:0002c86c2220 34 *
bcostm 0:0002c86c2220 35 ******************************************************************************
bcostm 0:0002c86c2220 36 */
bcostm 0:0002c86c2220 37
bcostm 0:0002c86c2220 38 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 0:0002c86c2220 39 #ifndef __CS43L22_H
bcostm 0:0002c86c2220 40 #define __CS43L22_H
bcostm 0:0002c86c2220 41
bcostm 0:0002c86c2220 42 /* Includes ------------------------------------------------------------------*/
bcostm 0:0002c86c2220 43 #include "../Common/audio.h"
bcostm 0:0002c86c2220 44
bcostm 0:0002c86c2220 45 /** @addtogroup BSP
bcostm 0:0002c86c2220 46 * @{
bcostm 0:0002c86c2220 47 */
bcostm 0:0002c86c2220 48
bcostm 0:0002c86c2220 49 /** @addtogroup Component
bcostm 0:0002c86c2220 50 * @{
bcostm 0:0002c86c2220 51 */
bcostm 0:0002c86c2220 52
bcostm 0:0002c86c2220 53 /** @addtogroup CS43L22
bcostm 0:0002c86c2220 54 * @{
bcostm 0:0002c86c2220 55 */
bcostm 0:0002c86c2220 56
bcostm 0:0002c86c2220 57 /** @defgroup CS43L22_Exported_Types
bcostm 0:0002c86c2220 58 * @{
bcostm 0:0002c86c2220 59 */
bcostm 0:0002c86c2220 60
bcostm 0:0002c86c2220 61 /**
bcostm 0:0002c86c2220 62 * @}
bcostm 0:0002c86c2220 63 */
bcostm 0:0002c86c2220 64
bcostm 0:0002c86c2220 65 /** @defgroup CS43L22_Exported_Constants
bcostm 0:0002c86c2220 66 * @{
bcostm 0:0002c86c2220 67 */
bcostm 0:0002c86c2220 68
bcostm 0:0002c86c2220 69 /******************************************************************************/
bcostm 0:0002c86c2220 70 /*************************** Codec User defines ******************************/
bcostm 0:0002c86c2220 71 /******************************************************************************/
bcostm 0:0002c86c2220 72 /* Codec output DEVICE */
bcostm 0:0002c86c2220 73 #define OUTPUT_DEVICE_SPEAKER 1
bcostm 0:0002c86c2220 74 #define OUTPUT_DEVICE_HEADPHONE 2
bcostm 0:0002c86c2220 75 #define OUTPUT_DEVICE_BOTH 3
bcostm 0:0002c86c2220 76 #define OUTPUT_DEVICE_AUTO 4
bcostm 0:0002c86c2220 77
bcostm 0:0002c86c2220 78 /* Volume Levels values */
bcostm 0:0002c86c2220 79 #define DEFAULT_VOLMIN 0x00
bcostm 0:0002c86c2220 80 #define DEFAULT_VOLMAX 0xFF
bcostm 0:0002c86c2220 81 #define DEFAULT_VOLSTEP 0x04
bcostm 0:0002c86c2220 82
bcostm 0:0002c86c2220 83 #define AUDIO_PAUSE 0
bcostm 0:0002c86c2220 84 #define AUDIO_RESUME 1
bcostm 0:0002c86c2220 85
bcostm 0:0002c86c2220 86 /* Codec POWER DOWN modes */
bcostm 0:0002c86c2220 87 #define CODEC_PDWN_HW 1
bcostm 0:0002c86c2220 88 #define CODEC_PDWN_SW 2
bcostm 0:0002c86c2220 89
bcostm 0:0002c86c2220 90 /* MUTE commands */
bcostm 0:0002c86c2220 91 #define AUDIO_MUTE_ON 1
bcostm 0:0002c86c2220 92 #define AUDIO_MUTE_OFF 0
bcostm 0:0002c86c2220 93
bcostm 0:0002c86c2220 94 /* AUDIO FREQUENCY */
bcostm 0:0002c86c2220 95 #define AUDIO_FREQUENCY_192K ((uint32_t)192000)
bcostm 0:0002c86c2220 96 #define AUDIO_FREQUENCY_96K ((uint32_t)96000)
bcostm 0:0002c86c2220 97 #define AUDIO_FREQUENCY_48K ((uint32_t)48000)
bcostm 0:0002c86c2220 98 #define AUDIO_FREQUENCY_44K ((uint32_t)44100)
bcostm 0:0002c86c2220 99 #define AUDIO_FREQUENCY_32K ((uint32_t)32000)
bcostm 0:0002c86c2220 100 #define AUDIO_FREQUENCY_22K ((uint32_t)22050)
bcostm 0:0002c86c2220 101 #define AUDIO_FREQUENCY_16K ((uint32_t)16000)
bcostm 0:0002c86c2220 102 #define AUDIO_FREQUENCY_11K ((uint32_t)11025)
bcostm 0:0002c86c2220 103 #define AUDIO_FREQUENCY_8K ((uint32_t)8000)
bcostm 0:0002c86c2220 104
bcostm 0:0002c86c2220 105 /** CS43l22 Registers ***/
bcostm 0:0002c86c2220 106 #define CS43L22_REG_ID 0x01
bcostm 0:0002c86c2220 107 #define CS43L22_REG_POWER_CTL1 0x02
bcostm 0:0002c86c2220 108 #define CS43L22_REG_POWER_CTL2 0x04
bcostm 0:0002c86c2220 109 #define CS43L22_REG_CLOCKING_CTL 0x05
bcostm 0:0002c86c2220 110 #define CS43L22_REG_INTERFACE_CTL1 0x06
bcostm 0:0002c86c2220 111 #define CS43L22_REG_INTERFACE_CTL2 0x07
bcostm 0:0002c86c2220 112 #define CS43L22_REG_PASSTHR_A_SELECT 0x08
bcostm 0:0002c86c2220 113 #define CS43L22_REG_PASSTHR_B_SELECT 0x09
bcostm 0:0002c86c2220 114 #define CS43L22_REG_ANALOG_ZC_SR_SETT 0x0A
bcostm 0:0002c86c2220 115 #define CS43L22_REG_PASSTHR_GANG_CTL 0x0C
bcostm 0:0002c86c2220 116 #define CS43L22_REG_PLAYBACK_CTL1 0x0D
bcostm 0:0002c86c2220 117 #define CS43L22_REG_MISC_CTL 0x0E
bcostm 0:0002c86c2220 118 #define CS43L22_REG_PLAYBACK_CTL2 0x0F
bcostm 0:0002c86c2220 119 #define CS43L22_REG_PASSTHR_A_VOL 0x14
bcostm 0:0002c86c2220 120 #define CS43L22_REG_PASSTHR_B_VOL 0x15
bcostm 0:0002c86c2220 121 #define CS43L22_REG_PCMA_VOL 0x1A
bcostm 0:0002c86c2220 122 #define CS43L22_REG_PCMB_VOL 0x1B
bcostm 0:0002c86c2220 123 #define CS43L22_REG_BEEP_FREQ_ON_TIME 0x1C
bcostm 0:0002c86c2220 124 #define CS43L22_REG_BEEP_VOL_OFF_TIME 0x1D
bcostm 0:0002c86c2220 125 #define CS43L22_REG_BEEP_TONE_CFG 0x1E
bcostm 0:0002c86c2220 126 #define CS43L22_REG_TONE_CTL 0x1F
bcostm 0:0002c86c2220 127 #define CS43L22_REG_MASTER_A_VOL 0x20
bcostm 0:0002c86c2220 128 #define CS43L22_REG_MASTER_B_VOL 0x21
bcostm 0:0002c86c2220 129 #define CS43L22_REG_HEADPHONE_A_VOL 0x22
bcostm 0:0002c86c2220 130 #define CS43L22_REG_HEADPHONE_B_VOL 0x23
bcostm 0:0002c86c2220 131 #define CS43L22_REG_SPEAKER_A_VOL 0x24
bcostm 0:0002c86c2220 132 #define CS43L22_REG_SPEAKER_B_VOL 0x25
bcostm 0:0002c86c2220 133 #define CS43L22_REG_CH_MIXER_SWAP 0x26
bcostm 0:0002c86c2220 134 #define CS43L22_REG_LIMIT_CTL1 0x27
bcostm 0:0002c86c2220 135 #define CS43L22_REG_LIMIT_CTL2 0x28
bcostm 0:0002c86c2220 136 #define CS43L22_REG_LIMIT_ATTACK_RATE 0x29
bcostm 0:0002c86c2220 137 #define CS43L22_REG_OVF_CLK_STATUS 0x2E
bcostm 0:0002c86c2220 138 #define CS43L22_REG_BATT_COMPENSATION 0x2F
bcostm 0:0002c86c2220 139 #define CS43L22_REG_VP_BATTERY_LEVEL 0x30
bcostm 0:0002c86c2220 140 #define CS43L22_REG_SPEAKER_STATUS 0x31
bcostm 0:0002c86c2220 141 #define CS43L22_REG_TEMPMONITOR_CTL 0x32
bcostm 0:0002c86c2220 142 #define CS43L22_REG_THERMAL_FOLDBACK 0x33
bcostm 0:0002c86c2220 143 #define CS43L22_REG_CHARGE_PUMP_FREQ 0x34
bcostm 0:0002c86c2220 144
bcostm 0:0002c86c2220 145 /******************************************************************************/
bcostm 0:0002c86c2220 146 /****************************** REGISTER MAPPING ******************************/
bcostm 0:0002c86c2220 147 /******************************************************************************/
bcostm 0:0002c86c2220 148 /**
bcostm 0:0002c86c2220 149 * @brief CS43L22 ID
bcostm 0:0002c86c2220 150 */
bcostm 0:0002c86c2220 151 #define CS43L22_ID 0xE0
bcostm 0:0002c86c2220 152 #define CS43L22_ID_MASK 0xF8
bcostm 0:0002c86c2220 153 /**
bcostm 0:0002c86c2220 154 * @brief Chip ID Register: Chip I.D. and Revision Register
bcostm 0:0002c86c2220 155 * Read only register
bcostm 0:0002c86c2220 156 * Default value: 0x01
bcostm 0:0002c86c2220 157 * [7:3] CHIPID[4:0]: I.D. code for the CS43L22.
bcostm 0:0002c86c2220 158 * Default value: 11100b
bcostm 0:0002c86c2220 159 * [2:0] REVID[2:0]: CS43L22 revision level.
bcostm 0:0002c86c2220 160 * Default value:
bcostm 0:0002c86c2220 161 * 000 - Rev A0
bcostm 0:0002c86c2220 162 * 001 - Rev A1
bcostm 0:0002c86c2220 163 * 010 - Rev B0
bcostm 0:0002c86c2220 164 * 011 - Rev B1
bcostm 0:0002c86c2220 165 */
bcostm 0:0002c86c2220 166 #define CS43L22_CHIPID_ADDR 0x01
bcostm 0:0002c86c2220 167
bcostm 0:0002c86c2220 168 /**
bcostm 0:0002c86c2220 169 * @}
bcostm 0:0002c86c2220 170 */
bcostm 0:0002c86c2220 171
bcostm 0:0002c86c2220 172 /** @defgroup CS43L22_Exported_Macros
bcostm 0:0002c86c2220 173 * @{
bcostm 0:0002c86c2220 174 */
bcostm 0:0002c86c2220 175
bcostm 0:0002c86c2220 176 /**
bcostm 0:0002c86c2220 177 * @}
bcostm 0:0002c86c2220 178 */
bcostm 0:0002c86c2220 179
bcostm 0:0002c86c2220 180 /** @defgroup CS43L22_Exported_Functions
bcostm 0:0002c86c2220 181 * @{
bcostm 0:0002c86c2220 182 */
bcostm 0:0002c86c2220 183
bcostm 0:0002c86c2220 184 /*------------------------------------------------------------------------------
bcostm 0:0002c86c2220 185 Audio Codec functions
bcostm 0:0002c86c2220 186 ------------------------------------------------------------------------------*/
bcostm 0:0002c86c2220 187 /* High Layer codec functions */
bcostm 0:0002c86c2220 188 uint32_t cs43l22_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq);
bcostm 0:0002c86c2220 189 void cs43l22_DeInit(void);
bcostm 0:0002c86c2220 190 uint32_t cs43l22_ReadID(uint16_t DeviceAddr);
bcostm 0:0002c86c2220 191 uint32_t cs43l22_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
bcostm 0:0002c86c2220 192 uint32_t cs43l22_Pause(uint16_t DeviceAddr);
bcostm 0:0002c86c2220 193 uint32_t cs43l22_Resume(uint16_t DeviceAddr);
bcostm 0:0002c86c2220 194 uint32_t cs43l22_Stop(uint16_t DeviceAddr, uint32_t Cmd);
bcostm 0:0002c86c2220 195 uint32_t cs43l22_SetVolume(uint16_t DeviceAddr, uint8_t Volume);
bcostm 0:0002c86c2220 196 uint32_t cs43l22_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq);
bcostm 0:0002c86c2220 197 uint32_t cs43l22_SetMute(uint16_t DeviceAddr, uint32_t Cmd);
bcostm 0:0002c86c2220 198 uint32_t cs43l22_SetOutputMode(uint16_t DeviceAddr, uint8_t Output);
bcostm 0:0002c86c2220 199 uint32_t cs43l22_Reset(uint16_t DeviceAddr);
bcostm 0:0002c86c2220 200
bcostm 0:0002c86c2220 201 /* AUDIO IO functions */
bcostm 0:0002c86c2220 202 void AUDIO_IO_Init(void);
bcostm 0:0002c86c2220 203 void AUDIO_IO_DeInit(void);
bcostm 0:0002c86c2220 204 void AUDIO_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
bcostm 0:0002c86c2220 205 uint8_t AUDIO_IO_Read(uint8_t Addr, uint8_t Reg);
bcostm 0:0002c86c2220 206
bcostm 0:0002c86c2220 207 /* Audio driver structure */
bcostm 0:0002c86c2220 208 extern AUDIO_DrvTypeDef cs43l22_drv;
bcostm 0:0002c86c2220 209
bcostm 0:0002c86c2220 210 #endif /* __CS43L22_H */
bcostm 0:0002c86c2220 211
bcostm 0:0002c86c2220 212 /**
bcostm 0:0002c86c2220 213 * @}
bcostm 0:0002c86c2220 214 */
bcostm 0:0002c86c2220 215
bcostm 0:0002c86c2220 216 /**
bcostm 0:0002c86c2220 217 * @}
bcostm 0:0002c86c2220 218 */
bcostm 0:0002c86c2220 219
bcostm 0:0002c86c2220 220 /**
bcostm 0:0002c86c2220 221 * @}
bcostm 0:0002c86c2220 222 */
bcostm 0:0002c86c2220 223
bcostm 0:0002c86c2220 224 /**
bcostm 0:0002c86c2220 225 * @}
bcostm 0:0002c86c2220 226 */
bcostm 0:0002c86c2220 227
bcostm 0:0002c86c2220 228 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/