[303] | 1 | /**
|
---|
| 2 | ******************************************************************************
|
---|
| 3 | * @file stm32f4xx_hal_i2s_ex.h
|
---|
| 4 | * @author MCD Application Team
|
---|
| 5 | * @version V1.4.1
|
---|
| 6 | * @date 09-October-2015
|
---|
| 7 | * @brief Header file of I2S HAL module.
|
---|
| 8 | ******************************************************************************
|
---|
| 9 | * @attention
|
---|
| 10 | *
|
---|
| 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
|
---|
| 12 | *
|
---|
| 13 | * Redistribution and use in source and binary forms, with or without modification,
|
---|
| 14 | * are permitted provided that the following conditions are met:
|
---|
| 15 | * 1. Redistributions of source code must retain the above copyright notice,
|
---|
| 16 | * this list of conditions and the following disclaimer.
|
---|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
| 18 | * this list of conditions and the following disclaimer in the documentation
|
---|
| 19 | * and/or other materials provided with the distribution.
|
---|
| 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
---|
| 21 | * may be used to endorse or promote products derived from this software
|
---|
| 22 | * without specific prior written permission.
|
---|
| 23 | *
|
---|
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
---|
| 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
---|
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
---|
| 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
| 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
| 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 34 | *
|
---|
| 35 | ******************************************************************************
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | /* Define to prevent recursive inclusion -------------------------------------*/
|
---|
| 39 | #ifndef __STM32F4xx_HAL_I2S_EX_H
|
---|
| 40 | #define __STM32F4xx_HAL_I2S_EX_H
|
---|
| 41 |
|
---|
| 42 | #ifdef __cplusplus
|
---|
| 43 | extern "C" {
|
---|
| 44 | #endif
|
---|
| 45 |
|
---|
| 46 | /* Includes ------------------------------------------------------------------*/
|
---|
| 47 | #include "stm32f4xx_hal_def.h"
|
---|
| 48 |
|
---|
| 49 | /** @addtogroup STM32F4xx_HAL_Driver
|
---|
| 50 | * @{
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | /** @addtogroup I2SEx
|
---|
| 54 | * @{
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /* Exported types ------------------------------------------------------------*/
|
---|
| 58 | /** @defgroup I2SEx_Exported_Types I2S Exported Types
|
---|
| 59 | * @{
|
---|
| 60 | */
|
---|
| 61 | /**
|
---|
| 62 | * @}
|
---|
| 63 | */
|
---|
| 64 |
|
---|
| 65 | /* Exported constants --------------------------------------------------------*/
|
---|
| 66 | /** @defgroup I2SEx_Exported_Constants I2S Exported Constants
|
---|
| 67 | * @{
|
---|
| 68 | */
|
---|
| 69 |
|
---|
| 70 | /** @defgroup I2S_Clock_Source I2S Clock Source
|
---|
| 71 | * @{
|
---|
| 72 | */
|
---|
| 73 |
|
---|
| 74 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
|
---|
| 75 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
|
---|
| 76 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || \
|
---|
| 77 | defined(STM32F479xx)
|
---|
| 78 | #define I2S_CLOCK_PLL ((uint32_t)0x00000000)
|
---|
| 79 | #define I2S_CLOCK_EXTERNAL ((uint32_t)0x00000001)
|
---|
| 80 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
|
---|
| 81 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */
|
---|
| 82 |
|
---|
| 83 | #if defined(STM32F446xx)
|
---|
| 84 | #define I2S_CLOCK_PLL ((uint32_t)0x00000000)
|
---|
| 85 | #define I2S_CLOCK_EXTERNAL ((uint32_t)0x00000001)
|
---|
| 86 | #define I2S_CLOCK_PLLR ((uint32_t)0x00000002)
|
---|
| 87 | #define I2S_CLOCK_PLLSRC ((uint32_t)0x00000003)
|
---|
| 88 | #endif /* STM32F446xx */
|
---|
| 89 |
|
---|
| 90 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
|
---|
| 91 | #define I2S_CLOCK_PLLSRC ((uint32_t)0x00000000)
|
---|
| 92 | #define I2S_CLOCK_EXTERNAL ((uint32_t)0x00000001)
|
---|
| 93 | #define I2S_CLOCK_PLLR ((uint32_t)0x00000002)
|
---|
| 94 | #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
|
---|
| 95 | /**
|
---|
| 96 | * @}
|
---|
| 97 | */
|
---|
| 98 |
|
---|
| 99 | /**
|
---|
| 100 | * @}
|
---|
| 101 | */
|
---|
| 102 |
|
---|
| 103 | /* Exported macro ------------------------------------------------------------*/
|
---|
| 104 | /** @defgroup I2SEx_Exported_Macros I2S Exported Macros
|
---|
| 105 | * @{
|
---|
| 106 | */
|
---|
| 107 |
|
---|
| 108 | /**
|
---|
| 109 | * @}
|
---|
| 110 | */
|
---|
| 111 |
|
---|
| 112 | /* Exported functions --------------------------------------------------------*/
|
---|
| 113 | /** @addtogroup I2SEx_Exported_Functions
|
---|
| 114 | * @{
|
---|
| 115 | */
|
---|
| 116 |
|
---|
| 117 | /** @addtogroup I2SEx_Exported_Functions_Group1
|
---|
| 118 | * @{
|
---|
| 119 | */
|
---|
| 120 |
|
---|
| 121 | /* Extended features functions **************************************************/
|
---|
| 122 | /* Blocking mode: Polling */
|
---|
| 123 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size, uint32_t Timeout);
|
---|
| 124 | /* Non-Blocking mode: Interrupt */
|
---|
| 125 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size);
|
---|
| 126 | /* Non-Blocking mode: DMA */
|
---|
| 127 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size);
|
---|
| 128 | /**
|
---|
| 129 | * @}
|
---|
| 130 | */
|
---|
| 131 |
|
---|
| 132 | /**
|
---|
| 133 | * @}
|
---|
| 134 | */
|
---|
| 135 | /* Private types -------------------------------------------------------------*/
|
---|
| 136 | /* Private variables ---------------------------------------------------------*/
|
---|
| 137 | /* Private constants ---------------------------------------------------------*/
|
---|
| 138 | /** @defgroup I2SEx_Private_Constants I2S Private Constants
|
---|
| 139 | * @{
|
---|
| 140 | */
|
---|
| 141 | /**
|
---|
| 142 | * @}
|
---|
| 143 | */
|
---|
| 144 |
|
---|
| 145 | /* Private macros ------------------------------------------------------------*/
|
---|
| 146 | /** @defgroup I2SEx_Private_Macros I2S Private Macros
|
---|
| 147 | * @{
|
---|
| 148 | */
|
---|
| 149 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
|
---|
| 150 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
|
---|
| 151 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || \
|
---|
| 152 | defined(STM32F479xx)
|
---|
| 153 | #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\
|
---|
| 154 | ((CLOCK) == I2S_CLOCK_PLL))
|
---|
| 155 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
|
---|
| 156 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */
|
---|
| 157 |
|
---|
| 158 | #if defined(STM32F446xx)
|
---|
| 159 | #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\
|
---|
| 160 | ((CLOCK) == I2S_CLOCK_PLL) ||\
|
---|
| 161 | ((CLOCK) == I2S_CLOCK_PLLSRC) ||\
|
---|
| 162 | ((CLOCK) == I2S_CLOCK_PLLR))
|
---|
| 163 | #endif /* STM32F446xx */
|
---|
| 164 |
|
---|
| 165 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
|
---|
| 166 | #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\
|
---|
| 167 | ((CLOCK) == I2S_CLOCK_PLLSRC) ||\
|
---|
| 168 | ((CLOCK) == I2S_CLOCK_PLLR))
|
---|
| 169 | #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
|
---|
| 170 |
|
---|
| 171 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
|
---|
| 172 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
|
---|
| 173 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Cx) || defined(STM32F410Rx) || \
|
---|
| 174 | defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
|
---|
| 175 | #define I2SxEXT(__INSTANCE__) ((__INSTANCE__) == (SPI2)? (SPI_TypeDef *)(I2S2ext_BASE): (SPI_TypeDef *)(I2S3ext_BASE))
|
---|
| 176 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
|
---|
| 177 | STM32F401xC || STM32F401xE || STM32F410Cx || STM32F410Rx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */
|
---|
| 178 |
|
---|
| 179 | /**
|
---|
| 180 | * @}
|
---|
| 181 | */
|
---|
| 182 |
|
---|
| 183 | /* Private functions ---------------------------------------------------------*/
|
---|
| 184 | /** @defgroup I2SEx_Private_Functions I2S Private Functions
|
---|
| 185 | * @{
|
---|
| 186 | */
|
---|
| 187 | HAL_StatusTypeDef I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s);
|
---|
| 188 | uint32_t I2S_GetInputClock(I2S_HandleTypeDef *hi2s);
|
---|
| 189 | /**
|
---|
| 190 | * @}
|
---|
| 191 | */
|
---|
| 192 |
|
---|
| 193 | /**
|
---|
| 194 | * @}
|
---|
| 195 | */
|
---|
| 196 |
|
---|
| 197 | /**
|
---|
| 198 | * @}
|
---|
| 199 | */
|
---|
| 200 |
|
---|
| 201 | #ifdef __cplusplus
|
---|
| 202 | }
|
---|
| 203 | #endif
|
---|
| 204 |
|
---|
| 205 |
|
---|
| 206 | #endif /* __STM32F4xx_HAL_I2S_EX_H */
|
---|
| 207 |
|
---|
| 208 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
---|