patch for F746 demo

Dependents:   F7DISCO_Demo

Fork of BSP_DISCO_F746NG by ST

Committer:
NirT
Date:
Mon Nov 02 23:35:17 2015 +0000
Revision:
1:e8fac4061a5b
Error: Incomplete type is not allowed in "patch/LwIP/src/include/lwip/dhcp.h", Line: 83, Col: 4; ; and more like this.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
NirT 1:e8fac4061a5b 1 /**
NirT 1:e8fac4061a5b 2 ******************************************************************************
NirT 1:e8fac4061a5b 3 * @file wm8994.h
NirT 1:e8fac4061a5b 4 * @author MCD Application Team
NirT 1:e8fac4061a5b 5 * @version V2.0.0
NirT 1:e8fac4061a5b 6 * @date 24-June-2015
NirT 1:e8fac4061a5b 7 * @brief This file contains all the functions prototypes for the
NirT 1:e8fac4061a5b 8 * wm8994.c driver.
NirT 1:e8fac4061a5b 9 ******************************************************************************
NirT 1:e8fac4061a5b 10 * @attention
NirT 1:e8fac4061a5b 11 *
NirT 1:e8fac4061a5b 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
NirT 1:e8fac4061a5b 13 *
NirT 1:e8fac4061a5b 14 * Redistribution and use in source and binary forms, with or without modification,
NirT 1:e8fac4061a5b 15 * are permitted provided that the following conditions are met:
NirT 1:e8fac4061a5b 16 * 1. Redistributions of source code must retain the above copyright notice,
NirT 1:e8fac4061a5b 17 * this list of conditions and the following disclaimer.
NirT 1:e8fac4061a5b 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
NirT 1:e8fac4061a5b 19 * this list of conditions and the following disclaimer in the documentation
NirT 1:e8fac4061a5b 20 * and/or other materials provided with the distribution.
NirT 1:e8fac4061a5b 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
NirT 1:e8fac4061a5b 22 * may be used to endorse or promote products derived from this software
NirT 1:e8fac4061a5b 23 * without specific prior written permission.
NirT 1:e8fac4061a5b 24 *
NirT 1:e8fac4061a5b 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
NirT 1:e8fac4061a5b 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
NirT 1:e8fac4061a5b 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
NirT 1:e8fac4061a5b 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
NirT 1:e8fac4061a5b 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
NirT 1:e8fac4061a5b 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
NirT 1:e8fac4061a5b 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
NirT 1:e8fac4061a5b 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
NirT 1:e8fac4061a5b 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
NirT 1:e8fac4061a5b 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NirT 1:e8fac4061a5b 35 *
NirT 1:e8fac4061a5b 36 ******************************************************************************
NirT 1:e8fac4061a5b 37 */
NirT 1:e8fac4061a5b 38
NirT 1:e8fac4061a5b 39 /* Define to prevent recursive inclusion -------------------------------------*/
NirT 1:e8fac4061a5b 40 #ifndef __WM8994_H
NirT 1:e8fac4061a5b 41 #define __WM8994_H
NirT 1:e8fac4061a5b 42
NirT 1:e8fac4061a5b 43 /* Includes ------------------------------------------------------------------*/
NirT 1:e8fac4061a5b 44 #include "../Common/audio.h"
NirT 1:e8fac4061a5b 45
NirT 1:e8fac4061a5b 46 /** @addtogroup BSP
NirT 1:e8fac4061a5b 47 * @{
NirT 1:e8fac4061a5b 48 */
NirT 1:e8fac4061a5b 49
NirT 1:e8fac4061a5b 50 /** @addtogroup Component
NirT 1:e8fac4061a5b 51 * @{
NirT 1:e8fac4061a5b 52 */
NirT 1:e8fac4061a5b 53
NirT 1:e8fac4061a5b 54 /** @addtogroup WM8994
NirT 1:e8fac4061a5b 55 * @{
NirT 1:e8fac4061a5b 56 */
NirT 1:e8fac4061a5b 57
NirT 1:e8fac4061a5b 58 /** @defgroup WM8994_Exported_Types
NirT 1:e8fac4061a5b 59 * @{
NirT 1:e8fac4061a5b 60 */
NirT 1:e8fac4061a5b 61
NirT 1:e8fac4061a5b 62 /**
NirT 1:e8fac4061a5b 63 * @}
NirT 1:e8fac4061a5b 64 */
NirT 1:e8fac4061a5b 65
NirT 1:e8fac4061a5b 66 /** @defgroup WM8994_Exported_Constants
NirT 1:e8fac4061a5b 67 * @{
NirT 1:e8fac4061a5b 68 */
NirT 1:e8fac4061a5b 69
NirT 1:e8fac4061a5b 70 /******************************************************************************/
NirT 1:e8fac4061a5b 71 /*************************** Codec User defines ******************************/
NirT 1:e8fac4061a5b 72 /******************************************************************************/
NirT 1:e8fac4061a5b 73 /* Codec output DEVICE */
NirT 1:e8fac4061a5b 74 #define OUTPUT_DEVICE_SPEAKER ((uint16_t)0x0001)
NirT 1:e8fac4061a5b 75 #define OUTPUT_DEVICE_HEADPHONE ((uint16_t)0x0002)
NirT 1:e8fac4061a5b 76 #define OUTPUT_DEVICE_BOTH ((uint16_t)0x0003)
NirT 1:e8fac4061a5b 77 #define OUTPUT_DEVICE_AUTO ((uint16_t)0x0004)
NirT 1:e8fac4061a5b 78 #define INPUT_DEVICE_DIGITAL_MICROPHONE_1 ((uint16_t)0x0100)
NirT 1:e8fac4061a5b 79 #define INPUT_DEVICE_DIGITAL_MICROPHONE_2 ((uint16_t)0x0200)
NirT 1:e8fac4061a5b 80 #define INPUT_DEVICE_INPUT_LINE_1 ((uint16_t)0x0300)
NirT 1:e8fac4061a5b 81 #define INPUT_DEVICE_INPUT_LINE_2 ((uint16_t)0x0400)
NirT 1:e8fac4061a5b 82
NirT 1:e8fac4061a5b 83 /* Volume Levels values */
NirT 1:e8fac4061a5b 84 #define DEFAULT_VOLMIN 0x00
NirT 1:e8fac4061a5b 85 #define DEFAULT_VOLMAX 0xFF
NirT 1:e8fac4061a5b 86 #define DEFAULT_VOLSTEP 0x04
NirT 1:e8fac4061a5b 87
NirT 1:e8fac4061a5b 88 #define AUDIO_PAUSE 0
NirT 1:e8fac4061a5b 89 #define AUDIO_RESUME 1
NirT 1:e8fac4061a5b 90
NirT 1:e8fac4061a5b 91 /* Codec POWER DOWN modes */
NirT 1:e8fac4061a5b 92 #define CODEC_PDWN_HW 1
NirT 1:e8fac4061a5b 93 #define CODEC_PDWN_SW 2
NirT 1:e8fac4061a5b 94
NirT 1:e8fac4061a5b 95 /* MUTE commands */
NirT 1:e8fac4061a5b 96 #define AUDIO_MUTE_ON 1
NirT 1:e8fac4061a5b 97 #define AUDIO_MUTE_OFF 0
NirT 1:e8fac4061a5b 98
NirT 1:e8fac4061a5b 99 /* AUDIO FREQUENCY */
NirT 1:e8fac4061a5b 100 #define AUDIO_FREQUENCY_192K ((uint32_t)192000)
NirT 1:e8fac4061a5b 101 #define AUDIO_FREQUENCY_96K ((uint32_t)96000)
NirT 1:e8fac4061a5b 102 #define AUDIO_FREQUENCY_48K ((uint32_t)48000)
NirT 1:e8fac4061a5b 103 #define AUDIO_FREQUENCY_44K ((uint32_t)44100)
NirT 1:e8fac4061a5b 104 #define AUDIO_FREQUENCY_32K ((uint32_t)32000)
NirT 1:e8fac4061a5b 105 #define AUDIO_FREQUENCY_22K ((uint32_t)22050)
NirT 1:e8fac4061a5b 106 #define AUDIO_FREQUENCY_16K ((uint32_t)16000)
NirT 1:e8fac4061a5b 107 #define AUDIO_FREQUENCY_11K ((uint32_t)11025)
NirT 1:e8fac4061a5b 108 #define AUDIO_FREQUENCY_8K ((uint32_t)8000)
NirT 1:e8fac4061a5b 109
NirT 1:e8fac4061a5b 110 #define VOLUME_CONVERT(Volume) (((Volume) > 100)? 100:((uint8_t)(((Volume) * 63) / 100)))
NirT 1:e8fac4061a5b 111 #define VOLUME_IN_CONVERT(Volume) (((Volume) >= 100)? 239:((uint8_t)(((Volume) * 240) / 100)))
NirT 1:e8fac4061a5b 112
NirT 1:e8fac4061a5b 113 /******************************************************************************/
NirT 1:e8fac4061a5b 114 /****************************** REGISTER MAPPING ******************************/
NirT 1:e8fac4061a5b 115 /******************************************************************************/
NirT 1:e8fac4061a5b 116 /**
NirT 1:e8fac4061a5b 117 * @brief WM8994 ID
NirT 1:e8fac4061a5b 118 */
NirT 1:e8fac4061a5b 119 #define WM8994_ID 0x8994
NirT 1:e8fac4061a5b 120
NirT 1:e8fac4061a5b 121 /**
NirT 1:e8fac4061a5b 122 * @brief Device ID Register: Reading from this register will indicate device
NirT 1:e8fac4061a5b 123 * family ID 8994h
NirT 1:e8fac4061a5b 124 */
NirT 1:e8fac4061a5b 125 #define WM8994_CHIPID_ADDR 0x00
NirT 1:e8fac4061a5b 126
NirT 1:e8fac4061a5b 127 /**
NirT 1:e8fac4061a5b 128 * @}
NirT 1:e8fac4061a5b 129 */
NirT 1:e8fac4061a5b 130
NirT 1:e8fac4061a5b 131 /** @defgroup WM8994_Exported_Macros
NirT 1:e8fac4061a5b 132 * @{
NirT 1:e8fac4061a5b 133 */
NirT 1:e8fac4061a5b 134 /**
NirT 1:e8fac4061a5b 135 * @}
NirT 1:e8fac4061a5b 136 */
NirT 1:e8fac4061a5b 137
NirT 1:e8fac4061a5b 138 /** @defgroup WM8994_Exported_Functions
NirT 1:e8fac4061a5b 139 * @{
NirT 1:e8fac4061a5b 140 */
NirT 1:e8fac4061a5b 141
NirT 1:e8fac4061a5b 142 /*------------------------------------------------------------------------------
NirT 1:e8fac4061a5b 143 Audio Codec functions
NirT 1:e8fac4061a5b 144 ------------------------------------------------------------------------------*/
NirT 1:e8fac4061a5b 145 /* High Layer codec functions */
NirT 1:e8fac4061a5b 146 uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq);
NirT 1:e8fac4061a5b 147 void wm8994_DeInit(void);
NirT 1:e8fac4061a5b 148 uint32_t wm8994_ReadID(uint16_t DeviceAddr);
NirT 1:e8fac4061a5b 149 uint32_t wm8994_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
NirT 1:e8fac4061a5b 150 uint32_t wm8994_Pause(uint16_t DeviceAddr);
NirT 1:e8fac4061a5b 151 uint32_t wm8994_Resume(uint16_t DeviceAddr);
NirT 1:e8fac4061a5b 152 uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t Cmd);
NirT 1:e8fac4061a5b 153 uint32_t wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume);
NirT 1:e8fac4061a5b 154 uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd);
NirT 1:e8fac4061a5b 155 uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output);
NirT 1:e8fac4061a5b 156 uint32_t wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq);
NirT 1:e8fac4061a5b 157 uint32_t wm8994_Reset(uint16_t DeviceAddr);
NirT 1:e8fac4061a5b 158
NirT 1:e8fac4061a5b 159 /* AUDIO IO functions */
NirT 1:e8fac4061a5b 160 void AUDIO_IO_Init(void);
NirT 1:e8fac4061a5b 161 void AUDIO_IO_DeInit(void);
NirT 1:e8fac4061a5b 162 void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
NirT 1:e8fac4061a5b 163 uint8_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg);
NirT 1:e8fac4061a5b 164 void AUDIO_IO_Delay(uint32_t Delay);
NirT 1:e8fac4061a5b 165
NirT 1:e8fac4061a5b 166 /* Audio driver structure */
NirT 1:e8fac4061a5b 167 extern AUDIO_DrvTypeDef wm8994_drv;
NirT 1:e8fac4061a5b 168
NirT 1:e8fac4061a5b 169 #endif /* __WM8994_H */
NirT 1:e8fac4061a5b 170
NirT 1:e8fac4061a5b 171 /**
NirT 1:e8fac4061a5b 172 * @}
NirT 1:e8fac4061a5b 173 */
NirT 1:e8fac4061a5b 174
NirT 1:e8fac4061a5b 175 /**
NirT 1:e8fac4061a5b 176 * @}
NirT 1:e8fac4061a5b 177 */
NirT 1:e8fac4061a5b 178
NirT 1:e8fac4061a5b 179 /**
NirT 1:e8fac4061a5b 180 * @}
NirT 1:e8fac4061a5b 181 */
NirT 1:e8fac4061a5b 182
NirT 1:e8fac4061a5b 183 /**
NirT 1:e8fac4061a5b 184 * @}
NirT 1:e8fac4061a5b 185 */
NirT 1:e8fac4061a5b 186
NirT 1:e8fac4061a5b 187 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/