2 ******************************************************************************
3 * @file stm32f7xx_hal_i2s.h
4 * @author MCD Application Team
5 * @brief Header file of I2S HAL module.
6 ******************************************************************************
9 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
10 * All rights reserved.</center></h2>
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
17 ******************************************************************************
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32F7xx_HAL_I2S_H
22 #define STM32F7xx_HAL_I2S_H
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_def.h"
31 /** @addtogroup STM32F7xx_HAL_Driver
39 /* Exported types ------------------------------------------------------------*/
40 /** @defgroup I2S_Exported_Types I2S Exported Types
45 * @brief I2S Init structure definition
49 uint32_t Mode
; /*!< Specifies the I2S operating mode.
50 This parameter can be a value of @ref I2S_Mode */
52 uint32_t Standard
; /*!< Specifies the standard used for the I2S communication.
53 This parameter can be a value of @ref I2S_Standard */
55 uint32_t DataFormat
; /*!< Specifies the data format for the I2S communication.
56 This parameter can be a value of @ref I2S_Data_Format */
58 uint32_t MCLKOutput
; /*!< Specifies whether the I2S MCLK output is enabled or not.
59 This parameter can be a value of @ref I2S_MCLK_Output */
61 uint32_t AudioFreq
; /*!< Specifies the frequency selected for the I2S communication.
62 This parameter can be a value of @ref I2S_Audio_Frequency */
64 uint32_t CPOL
; /*!< Specifies the idle state of the I2S clock.
65 This parameter can be a value of @ref I2S_Clock_Polarity */
67 uint32_t ClockSource
; /*!< Specifies the I2S Clock Source.
68 This parameter can be a value of @ref I2S_Clock_Source */
72 * @brief HAL State structures definition
76 HAL_I2S_STATE_RESET
= 0x00U
, /*!< I2S not yet initialized or disabled */
77 HAL_I2S_STATE_READY
= 0x01U
, /*!< I2S initialized and ready for use */
78 HAL_I2S_STATE_BUSY
= 0x02U
, /*!< I2S internal process is ongoing */
79 HAL_I2S_STATE_BUSY_TX
= 0x03U
, /*!< Data Transmission process is ongoing */
80 HAL_I2S_STATE_BUSY_RX
= 0x04U
, /*!< Data Reception process is ongoing */
81 HAL_I2S_STATE_TIMEOUT
= 0x06U
, /*!< I2S timeout state */
82 HAL_I2S_STATE_ERROR
= 0x07U
/*!< I2S error state */
83 } HAL_I2S_StateTypeDef
;
86 * @brief I2S handle Structure definition
88 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1)
89 typedef struct __I2S_HandleTypeDef
94 SPI_TypeDef
*Instance
; /*!< I2S registers base address */
96 I2S_InitTypeDef Init
; /*!< I2S communication parameters */
98 uint16_t *pTxBuffPtr
; /*!< Pointer to I2S Tx transfer buffer */
100 __IO
uint16_t TxXferSize
; /*!< I2S Tx transfer size */
102 __IO
uint16_t TxXferCount
; /*!< I2S Tx transfer Counter */
104 uint16_t *pRxBuffPtr
; /*!< Pointer to I2S Rx transfer buffer */
106 __IO
uint16_t RxXferSize
; /*!< I2S Rx transfer size */
108 __IO
uint16_t RxXferCount
; /*!< I2S Rx transfer counter
109 (This field is initialized at the
110 same value as transfer size at the
111 beginning of the transfer and
112 decremented when a sample is received
113 NbSamplesReceived = RxBufferSize-RxBufferCount) */
114 DMA_HandleTypeDef
*hdmatx
; /*!< I2S Tx DMA handle parameters */
116 DMA_HandleTypeDef
*hdmarx
; /*!< I2S Rx DMA handle parameters */
118 __IO HAL_LockTypeDef Lock
; /*!< I2S locking object */
120 __IO HAL_I2S_StateTypeDef State
; /*!< I2S communication state */
122 __IO
uint32_t ErrorCode
; /*!< I2S Error code
123 This parameter can be a value of @ref I2S_Error */
125 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
126 void (* TxCpltCallback
)(struct __I2S_HandleTypeDef
*hi2s
); /*!< I2S Tx Completed callback */
127 void (* RxCpltCallback
)(struct __I2S_HandleTypeDef
*hi2s
); /*!< I2S Rx Completed callback */
128 void (* TxHalfCpltCallback
)(struct __I2S_HandleTypeDef
*hi2s
); /*!< I2S Tx Half Completed callback */
129 void (* RxHalfCpltCallback
)(struct __I2S_HandleTypeDef
*hi2s
); /*!< I2S Rx Half Completed callback */
130 void (* ErrorCallback
)(struct __I2S_HandleTypeDef
*hi2s
); /*!< I2S Error callback */
131 void (* MspInitCallback
)(struct __I2S_HandleTypeDef
*hi2s
); /*!< I2S Msp Init callback */
132 void (* MspDeInitCallback
)(struct __I2S_HandleTypeDef
*hi2s
); /*!< I2S Msp DeInit callback */
134 #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
137 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
139 * @brief HAL I2S Callback ID enumeration definition
143 HAL_I2S_TX_COMPLETE_CB_ID
= 0x00U
, /*!< I2S Tx Completed callback ID */
144 HAL_I2S_RX_COMPLETE_CB_ID
= 0x01U
, /*!< I2S Rx Completed callback ID */
145 HAL_I2S_TX_HALF_COMPLETE_CB_ID
= 0x03U
, /*!< I2S Tx Half Completed callback ID */
146 HAL_I2S_RX_HALF_COMPLETE_CB_ID
= 0x04U
, /*!< I2S Rx Half Completed callback ID */
147 HAL_I2S_ERROR_CB_ID
= 0x06U
, /*!< I2S Error callback ID */
148 HAL_I2S_MSPINIT_CB_ID
= 0x07U
, /*!< I2S Msp Init callback ID */
149 HAL_I2S_MSPDEINIT_CB_ID
= 0x08U
/*!< I2S Msp DeInit callback ID */
151 } HAL_I2S_CallbackIDTypeDef
;
154 * @brief HAL I2S Callback pointer definition
156 typedef void (*pI2S_CallbackTypeDef
)(I2S_HandleTypeDef
*hi2s
); /*!< pointer to an I2S callback function */
158 #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
163 /* Exported constants --------------------------------------------------------*/
164 /** @defgroup I2S_Exported_Constants I2S Exported Constants
167 /** @defgroup I2S_Error I2S Error
170 #define HAL_I2S_ERROR_NONE (0x00000000U) /*!< No error */
171 #define HAL_I2S_ERROR_TIMEOUT (0x00000001U) /*!< Timeout error */
172 #define HAL_I2S_ERROR_OVR (0x00000002U) /*!< OVR error */
173 #define HAL_I2S_ERROR_UDR (0x00000004U) /*!< UDR error */
174 #define HAL_I2S_ERROR_DMA (0x00000008U) /*!< DMA transfer error */
175 #define HAL_I2S_ERROR_PRESCALER (0x00000010U) /*!< Prescaler Calculation error */
176 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
177 #define HAL_I2S_ERROR_INVALID_CALLBACK (0x00000020U) /*!< Invalid Callback error */
178 #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
183 /** @defgroup I2S_Mode I2S Mode
186 #define I2S_MODE_SLAVE_TX (0x00000000U)
187 #define I2S_MODE_SLAVE_RX (SPI_I2SCFGR_I2SCFG_0)
188 #define I2S_MODE_MASTER_TX (SPI_I2SCFGR_I2SCFG_1)
189 #define I2S_MODE_MASTER_RX ((SPI_I2SCFGR_I2SCFG_0 | SPI_I2SCFGR_I2SCFG_1))
194 /** @defgroup I2S_Standard I2S Standard
197 #define I2S_STANDARD_PHILIPS (0x00000000U)
198 #define I2S_STANDARD_MSB (SPI_I2SCFGR_I2SSTD_0)
199 #define I2S_STANDARD_LSB (SPI_I2SCFGR_I2SSTD_1)
200 #define I2S_STANDARD_PCM_SHORT ((SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1))
201 #define I2S_STANDARD_PCM_LONG ((SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1 | SPI_I2SCFGR_PCMSYNC))
206 /** @defgroup I2S_Data_Format I2S Data Format
209 #define I2S_DATAFORMAT_16B (0x00000000U)
210 #define I2S_DATAFORMAT_16B_EXTENDED (SPI_I2SCFGR_CHLEN)
211 #define I2S_DATAFORMAT_24B ((SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_0))
212 #define I2S_DATAFORMAT_32B ((SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_1))
217 /** @defgroup I2S_MCLK_Output I2S MCLK Output
220 #define I2S_MCLKOUTPUT_ENABLE (SPI_I2SPR_MCKOE)
221 #define I2S_MCLKOUTPUT_DISABLE (0x00000000U)
226 /** @defgroup I2S_Audio_Frequency I2S Audio Frequency
229 #define I2S_AUDIOFREQ_192K (192000U)
230 #define I2S_AUDIOFREQ_96K (96000U)
231 #define I2S_AUDIOFREQ_48K (48000U)
232 #define I2S_AUDIOFREQ_44K (44100U)
233 #define I2S_AUDIOFREQ_32K (32000U)
234 #define I2S_AUDIOFREQ_22K (22050U)
235 #define I2S_AUDIOFREQ_16K (16000U)
236 #define I2S_AUDIOFREQ_11K (11025U)
237 #define I2S_AUDIOFREQ_8K (8000U)
238 #define I2S_AUDIOFREQ_DEFAULT (2U)
243 /** @defgroup I2S_Clock_Polarity I2S Clock Polarity
246 #define I2S_CPOL_LOW (0x00000000U)
247 #define I2S_CPOL_HIGH (SPI_I2SCFGR_CKPOL)
252 /** @defgroup I2S_Interrupts_Definition I2S Interrupts Definition
255 #define I2S_IT_TXE SPI_CR2_TXEIE
256 #define I2S_IT_RXNE SPI_CR2_RXNEIE
257 #define I2S_IT_ERR SPI_CR2_ERRIE
262 /** @defgroup I2S_Flags_Definition I2S Flags Definition
265 #define I2S_FLAG_TXE SPI_SR_TXE
266 #define I2S_FLAG_RXNE SPI_SR_RXNE
268 #define I2S_FLAG_UDR SPI_SR_UDR
269 #define I2S_FLAG_OVR SPI_SR_OVR
270 #define I2S_FLAG_FRE SPI_SR_FRE
272 #define I2S_FLAG_CHSIDE SPI_SR_CHSIDE
273 #define I2S_FLAG_BSY SPI_SR_BSY
275 #define I2S_FLAG_MASK (SPI_SR_RXNE | SPI_SR_TXE | SPI_SR_UDR | SPI_SR_OVR | SPI_SR_FRE | SPI_SR_CHSIDE | SPI_SR_BSY)
280 /** @defgroup I2S_Clock_Source I2S Clock Source Definition
283 #define I2S_CLOCK_EXTERNAL ((uint32_t)0x00000001U)
284 #define I2S_CLOCK_PLL ((uint32_t)0x00000002U)
292 /* Exported macros -----------------------------------------------------------*/
293 /** @defgroup I2S_Exported_macros I2S Exported Macros
297 /** @brief Reset I2S handle state
298 * @param __HANDLE__ specifies the I2S Handle.
301 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
302 #define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) do{ \
303 (__HANDLE__)->State = HAL_I2S_STATE_RESET; \
304 (__HANDLE__)->MspInitCallback = NULL; \
305 (__HANDLE__)->MspDeInitCallback = NULL; \
308 #define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2S_STATE_RESET)
311 /** @brief Enable the specified SPI peripheral (in I2S mode).
312 * @param __HANDLE__ specifies the I2S Handle.
315 #define __HAL_I2S_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
317 /** @brief Disable the specified SPI peripheral (in I2S mode).
318 * @param __HANDLE__ specifies the I2S Handle.
321 #define __HAL_I2S_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
323 /** @brief Enable the specified I2S interrupts.
324 * @param __HANDLE__ specifies the I2S Handle.
325 * @param __INTERRUPT__ specifies the interrupt source to enable or disable.
326 * This parameter can be one of the following values:
327 * @arg I2S_IT_TXE: Tx buffer empty interrupt enable
328 * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
329 * @arg I2S_IT_ERR: Error interrupt enable
332 #define __HAL_I2S_ENABLE_IT(__HANDLE__, __INTERRUPT__) (SET_BIT((__HANDLE__)->Instance->CR2,(__INTERRUPT__)))
334 /** @brief Disable the specified I2S interrupts.
335 * @param __HANDLE__ specifies the I2S Handle.
336 * @param __INTERRUPT__ specifies the interrupt source to enable or disable.
337 * This parameter can be one of the following values:
338 * @arg I2S_IT_TXE: Tx buffer empty interrupt enable
339 * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
340 * @arg I2S_IT_ERR: Error interrupt enable
343 #define __HAL_I2S_DISABLE_IT(__HANDLE__, __INTERRUPT__) (CLEAR_BIT((__HANDLE__)->Instance->CR2,(__INTERRUPT__)))
345 /** @brief Checks if the specified I2S interrupt source is enabled or disabled.
346 * @param __HANDLE__ specifies the I2S Handle.
347 * This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral.
348 * @param __INTERRUPT__ specifies the I2S interrupt source to check.
349 * This parameter can be one of the following values:
350 * @arg I2S_IT_TXE: Tx buffer empty interrupt enable
351 * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
352 * @arg I2S_IT_ERR: Error interrupt enable
353 * @retval The new state of __IT__ (TRUE or FALSE).
355 #define __HAL_I2S_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
357 /** @brief Checks whether the specified I2S flag is set or not.
358 * @param __HANDLE__ specifies the I2S Handle.
359 * @param __FLAG__ specifies the flag to check.
360 * This parameter can be one of the following values:
361 * @arg I2S_FLAG_RXNE: Receive buffer not empty flag
362 * @arg I2S_FLAG_TXE: Transmit buffer empty flag
363 * @arg I2S_FLAG_UDR: Underrun flag
364 * @arg I2S_FLAG_OVR: Overrun flag
365 * @arg I2S_FLAG_FRE: Frame error flag
366 * @arg I2S_FLAG_CHSIDE: Channel Side flag
367 * @arg I2S_FLAG_BSY: Busy flag
368 * @retval The new state of __FLAG__ (TRUE or FALSE).
370 #define __HAL_I2S_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
372 /** @brief Clears the I2S OVR pending flag.
373 * @param __HANDLE__ specifies the I2S Handle.
376 #define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__) do{ \
377 __IO uint32_t tmpreg_ovr = 0x00U; \
378 tmpreg_ovr = (__HANDLE__)->Instance->DR; \
379 tmpreg_ovr = (__HANDLE__)->Instance->SR; \
380 UNUSED(tmpreg_ovr); \
382 /** @brief Clears the I2S UDR pending flag.
383 * @param __HANDLE__ specifies the I2S Handle.
386 #define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__) do{\
387 __IO uint32_t tmpreg_udr = 0x00U;\
388 tmpreg_udr = ((__HANDLE__)->Instance->SR);\
389 UNUSED(tmpreg_udr); \
395 /* Exported functions --------------------------------------------------------*/
396 /** @addtogroup I2S_Exported_Functions
400 /** @addtogroup I2S_Exported_Functions_Group1
403 /* Initialization/de-initialization functions ********************************/
404 HAL_StatusTypeDef
HAL_I2S_Init(I2S_HandleTypeDef
*hi2s
);
405 HAL_StatusTypeDef
HAL_I2S_DeInit(I2S_HandleTypeDef
*hi2s
);
406 void HAL_I2S_MspInit(I2S_HandleTypeDef
*hi2s
);
407 void HAL_I2S_MspDeInit(I2S_HandleTypeDef
*hi2s
);
409 /* Callbacks Register/UnRegister functions ***********************************/
410 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
411 HAL_StatusTypeDef
HAL_I2S_RegisterCallback(I2S_HandleTypeDef
*hi2s
, HAL_I2S_CallbackIDTypeDef CallbackID
, pI2S_CallbackTypeDef pCallback
);
412 HAL_StatusTypeDef
HAL_I2S_UnRegisterCallback(I2S_HandleTypeDef
*hi2s
, HAL_I2S_CallbackIDTypeDef CallbackID
);
413 #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
418 /** @addtogroup I2S_Exported_Functions_Group2
421 /* I/O operation functions ***************************************************/
422 /* Blocking mode: Polling */
423 HAL_StatusTypeDef
HAL_I2S_Transmit(I2S_HandleTypeDef
*hi2s
, uint16_t *pData
, uint16_t Size
, uint32_t Timeout
);
424 HAL_StatusTypeDef
HAL_I2S_Receive(I2S_HandleTypeDef
*hi2s
, uint16_t *pData
, uint16_t Size
, uint32_t Timeout
);
426 /* Non-Blocking mode: Interrupt */
427 HAL_StatusTypeDef
HAL_I2S_Transmit_IT(I2S_HandleTypeDef
*hi2s
, uint16_t *pData
, uint16_t Size
);
428 HAL_StatusTypeDef
HAL_I2S_Receive_IT(I2S_HandleTypeDef
*hi2s
, uint16_t *pData
, uint16_t Size
);
429 void HAL_I2S_IRQHandler(I2S_HandleTypeDef
*hi2s
);
431 /* Non-Blocking mode: DMA */
432 HAL_StatusTypeDef
HAL_I2S_Transmit_DMA(I2S_HandleTypeDef
*hi2s
, uint16_t *pData
, uint16_t Size
);
433 HAL_StatusTypeDef
HAL_I2S_Receive_DMA(I2S_HandleTypeDef
*hi2s
, uint16_t *pData
, uint16_t Size
);
435 HAL_StatusTypeDef
HAL_I2S_DMAPause(I2S_HandleTypeDef
*hi2s
);
436 HAL_StatusTypeDef
HAL_I2S_DMAResume(I2S_HandleTypeDef
*hi2s
);
437 HAL_StatusTypeDef
HAL_I2S_DMAStop(I2S_HandleTypeDef
*hi2s
);
439 /* Callbacks used in non blocking modes (Interrupt and DMA) *******************/
440 void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef
*hi2s
);
441 void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef
*hi2s
);
442 void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef
*hi2s
);
443 void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef
*hi2s
);
444 void HAL_I2S_ErrorCallback(I2S_HandleTypeDef
*hi2s
);
449 /** @addtogroup I2S_Exported_Functions_Group3
452 /* Peripheral Control and State functions ************************************/
453 HAL_I2S_StateTypeDef
HAL_I2S_GetState(I2S_HandleTypeDef
*hi2s
);
454 uint32_t HAL_I2S_GetError(I2S_HandleTypeDef
*hi2s
);
463 /* Private types -------------------------------------------------------------*/
464 /* Private variables ---------------------------------------------------------*/
465 /* Private constants ---------------------------------------------------------*/
466 /** @defgroup I2S_Private_Constants I2S Private Constants
474 /* Private macros ------------------------------------------------------------*/
475 /** @defgroup I2S_Private_Macros I2S Private Macros
479 /** @brief Check whether the specified SPI flag is set or not.
480 * @param __SR__ copy of I2S SR regsiter.
481 * @param __FLAG__ specifies the flag to check.
482 * This parameter can be one of the following values:
483 * @arg I2S_FLAG_RXNE: Receive buffer not empty flag
484 * @arg I2S_FLAG_TXE: Transmit buffer empty flag
485 * @arg I2S_FLAG_UDR: Underrun error flag
486 * @arg I2S_FLAG_OVR: Overrun flag
487 * @arg I2S_FLAG_CHSIDE: Channel side flag
488 * @arg I2S_FLAG_BSY: Busy flag
489 * @retval SET or RESET.
491 #define I2S_CHECK_FLAG(__SR__, __FLAG__) ((((__SR__) & ((__FLAG__) & I2S_FLAG_MASK)) == ((__FLAG__) & I2S_FLAG_MASK)) ? SET : RESET)
493 /** @brief Check whether the specified SPI Interrupt is set or not.
494 * @param __CR2__ copy of I2S CR2 regsiter.
495 * @param __INTERRUPT__ specifies the SPI interrupt source to check.
496 * This parameter can be one of the following values:
497 * @arg I2S_IT_TXE: Tx buffer empty interrupt enable
498 * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
499 * @arg I2S_IT_ERR: Error interrupt enable
500 * @retval SET or RESET.
502 #define I2S_CHECK_IT_SOURCE(__CR2__, __INTERRUPT__) ((((__CR2__) & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
504 /** @brief Checks if I2S Mode parameter is in allowed range.
505 * @param __MODE__ specifies the I2S Mode.
506 * This parameter can be a value of @ref I2S_Mode
509 #define IS_I2S_MODE(__MODE__) (((__MODE__) == I2S_MODE_SLAVE_TX) || \
510 ((__MODE__) == I2S_MODE_SLAVE_RX) || \
511 ((__MODE__) == I2S_MODE_MASTER_TX) || \
512 ((__MODE__) == I2S_MODE_MASTER_RX))
514 #define IS_I2S_STANDARD(__STANDARD__) (((__STANDARD__) == I2S_STANDARD_PHILIPS) || \
515 ((__STANDARD__) == I2S_STANDARD_MSB) || \
516 ((__STANDARD__) == I2S_STANDARD_LSB) || \
517 ((__STANDARD__) == I2S_STANDARD_PCM_SHORT) || \
518 ((__STANDARD__) == I2S_STANDARD_PCM_LONG))
520 #define IS_I2S_DATA_FORMAT(__FORMAT__) (((__FORMAT__) == I2S_DATAFORMAT_16B) || \
521 ((__FORMAT__) == I2S_DATAFORMAT_16B_EXTENDED) || \
522 ((__FORMAT__) == I2S_DATAFORMAT_24B) || \
523 ((__FORMAT__) == I2S_DATAFORMAT_32B))
525 #define IS_I2S_MCLK_OUTPUT(__OUTPUT__) (((__OUTPUT__) == I2S_MCLKOUTPUT_ENABLE) || \
526 ((__OUTPUT__) == I2S_MCLKOUTPUT_DISABLE))
528 #define IS_I2S_AUDIO_FREQ(__FREQ__) ((((__FREQ__) >= I2S_AUDIOFREQ_8K) && \
529 ((__FREQ__) <= I2S_AUDIOFREQ_192K)) || \
530 ((__FREQ__) == I2S_AUDIOFREQ_DEFAULT))
532 /** @brief Checks if I2S Serial clock steady state parameter is in allowed range.
533 * @param __CPOL__ specifies the I2S serial clock steady state.
534 * This parameter can be a value of @ref I2S_Clock_Polarity
537 #define IS_I2S_CPOL(__CPOL__) (((__CPOL__) == I2S_CPOL_LOW) || \
538 ((__CPOL__) == I2S_CPOL_HIGH))
540 #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) || \
541 ((CLOCK) == I2S_CLOCK_PLL))
558 #endif /* STM32F7xx_HAL_I2S_H */
560 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/