2 ******************************************************************************
3 * @file stm32f4xx_hal_spdifrx.h
4 * @author MCD Application Team
7 * @brief Header file of SPDIFRX HAL module.
8 ******************************************************************************
11 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
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.
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.
35 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F4xx_HAL_SPDIFRX_H
40 #define __STM32F4xx_HAL_SPDIFRX_H
46 #if defined(STM32F446xx)
48 /* Includes ------------------------------------------------------------------*/
49 #include "stm32f4xx_hal_def.h"
51 /** @addtogroup STM32F4xx_HAL_Driver
55 /** @addtogroup SPDIFRX
59 /* Exported types ------------------------------------------------------------*/
60 /** @defgroup SPDIFRX_Exported_Types SPDIFRX Exported Types
65 * @brief SPDIFRX Init structure definition
69 uint32_t InputSelection
; /*!< Specifies the SPDIF input selection.
70 This parameter can be a value of @ref SPDIFRX_Input_Selection */
72 uint32_t Retries
; /*!< Specifies the Maximum allowed re-tries during synchronization phase.
73 This parameter can be a value of @ref SPDIFRX_Max_Retries */
75 uint32_t WaitForActivity
; /*!< Specifies the wait for activity on SPDIF selected input.
76 This parameter can be a value of @ref SPDIFRX_Wait_For_Activity. */
78 uint32_t ChannelSelection
; /*!< Specifies whether the control flow will take the channel status from channel A or B.
79 This parameter can be a value of @ref SPDIFRX_Channel_Selection */
81 uint32_t DataFormat
; /*!< Specifies the Data samples format (LSB, MSB, ...).
82 This parameter can be a value of @ref SPDIFRX_Data_Format */
84 uint32_t StereoMode
; /*!< Specifies whether the peripheral is in stereo or mono mode.
85 This parameter can be a value of @ref SPDIFRX_Stereo_Mode */
87 uint32_t PreambleTypeMask
; /*!< Specifies whether The preamble type bits are copied or not into the received frame.
88 This parameter can be a value of @ref SPDIFRX_PT_Mask */
90 uint32_t ChannelStatusMask
; /*!< Specifies whether the channel status and user bits are copied or not into the received frame.
91 This parameter can be a value of @ref SPDIFRX_ChannelStatus_Mask */
93 uint32_t ValidityBitMask
; /*!< Specifies whether the validity bit is copied or not into the received frame.
94 This parameter can be a value of @ref SPDIFRX_V_Mask */
96 uint32_t ParityErrorMask
; /*!< Specifies whether the parity error bit is copied or not into the received frame.
97 This parameter can be a value of @ref SPDIFRX_PE_Mask */
101 * @brief SPDIFRX SetDataFormat structure definition
105 uint32_t DataFormat
; /*!< Specifies the Data samples format (LSB, MSB, ...).
106 This parameter can be a value of @ref SPDIFRX_Data_Format */
108 uint32_t StereoMode
; /*!< Specifies whether the peripheral is in stereo or mono mode.
109 This parameter can be a value of @ref SPDIFRX_Stereo_Mode */
111 uint32_t PreambleTypeMask
; /*!< Specifies whether The preamble type bits are copied or not into the received frame.
112 This parameter can be a value of @ref SPDIFRX_PT_Mask */
114 uint32_t ChannelStatusMask
; /*!< Specifies whether the channel status and user bits are copied or not into the received frame.
115 This parameter can be a value of @ref SPDIFRX_ChannelStatus_Mask */
117 uint32_t ValidityBitMask
; /*!< Specifies whether the validity bit is copied or not into the received frame.
118 This parameter can be a value of @ref SPDIFRX_V_Mask */
120 uint32_t ParityErrorMask
; /*!< Specifies whether the parity error bit is copied or not into the received frame.
121 This parameter can be a value of @ref SPDIFRX_PE_Mask */
122 }SPDIFRX_SetDataFormatTypeDef
;
125 * @brief HAL State structures definition
129 HAL_SPDIFRX_STATE_RESET
= 0x00U
, /*!< SPDIFRX not yet initialized or disabled */
130 HAL_SPDIFRX_STATE_READY
= 0x01U
, /*!< SPDIFRX initialized and ready for use */
131 HAL_SPDIFRX_STATE_BUSY
= 0x02U
, /*!< SPDIFRX internal process is ongoing */
132 HAL_SPDIFRX_STATE_BUSY_RX
= 0x03U
, /*!< SPDIFRX internal Data Flow RX process is ongoing */
133 HAL_SPDIFRX_STATE_BUSY_CX
= 0x04U
, /*!< SPDIFRX internal Control Flow RX process is ongoing */
134 HAL_SPDIFRX_STATE_ERROR
= 0x07U
/*!< SPDIFRX error state */
135 }HAL_SPDIFRX_StateTypeDef
;
138 * @brief SPDIFRX handle Structure definition
142 SPDIFRX_TypeDef
*Instance
; /* SPDIFRX registers base address */
144 SPDIFRX_InitTypeDef Init
; /* SPDIFRX communication parameters */
146 uint32_t *pRxBuffPtr
; /* Pointer to SPDIFRX Rx transfer buffer */
148 uint32_t *pCsBuffPtr
; /* Pointer to SPDIFRX Cx transfer buffer */
150 __IO
uint16_t RxXferSize
; /* SPDIFRX Rx transfer size */
152 __IO
uint16_t RxXferCount
; /* SPDIFRX Rx transfer counter
153 (This field is initialized at the
154 same value as transfer size at the
155 beginning of the transfer and
156 decremented when a sample is received.
157 NbSamplesReceived = RxBufferSize-RxBufferCount) */
159 __IO
uint16_t CsXferSize
; /* SPDIFRX Rx transfer size */
161 __IO
uint16_t CsXferCount
; /* SPDIFRX Rx transfer counter
162 (This field is initialized at the
163 same value as transfer size at the
164 beginning of the transfer and
165 decremented when a sample is received.
166 NbSamplesReceived = RxBufferSize-RxBufferCount) */
168 DMA_HandleTypeDef
*hdmaCsRx
; /* SPDIFRX EC60958_channel_status and user_information DMA handle parameters */
170 DMA_HandleTypeDef
*hdmaDrRx
; /* SPDIFRX Rx DMA handle parameters */
172 __IO HAL_LockTypeDef Lock
; /* SPDIFRX locking object */
174 __IO HAL_SPDIFRX_StateTypeDef State
; /* SPDIFRX communication state */
176 __IO
uint32_t ErrorCode
; /* SPDIFRX Error code */
177 }SPDIFRX_HandleTypeDef
;
182 /* Exported constants --------------------------------------------------------*/
183 /** @defgroup SPDIFRX_Exported_Constants SPDIFRX Exported Constants
186 /** @defgroup SPDIFRX_ErrorCode SPDIFRX Error Code
189 #define HAL_SPDIFRX_ERROR_NONE 0x00000000U /*!< No error */
190 #define HAL_SPDIFRX_ERROR_TIMEOUT 0x00000001U /*!< Timeout error */
191 #define HAL_SPDIFRX_ERROR_OVR 0x00000002U /*!< OVR error */
192 #define HAL_SPDIFRX_ERROR_PE 0x00000004U /*!< Parity error */
193 #define HAL_SPDIFRX_ERROR_DMA 0x00000008U /*!< DMA transfer error */
194 #define HAL_SPDIFRX_ERROR_UNKNOWN 0x00000010U /*!< Unknown Error error */
199 /** @defgroup SPDIFRX_Input_Selection SPDIFRX Input Selection
202 #define SPDIFRX_INPUT_IN0 0x00000000U
203 #define SPDIFRX_INPUT_IN1 0x00010000U
204 #define SPDIFRX_INPUT_IN2 0x00020000U
205 #define SPDIFRX_INPUT_IN3 0x00030000U
210 /** @defgroup SPDIFRX_Max_Retries SPDIFRX Maximum Retries
213 #define SPDIFRX_MAXRETRIES_NONE 0x00000000U
214 #define SPDIFRX_MAXRETRIES_3 0x00001000U
215 #define SPDIFRX_MAXRETRIES_15 0x00002000U
216 #define SPDIFRX_MAXRETRIES_63 0x00003000U
221 /** @defgroup SPDIFRX_Wait_For_Activity SPDIFRX Wait For Activity
224 #define SPDIFRX_WAITFORACTIVITY_OFF 0x00000000U
225 #define SPDIFRX_WAITFORACTIVITY_ON ((uint32_t)SPDIFRX_CR_WFA)
230 /** @defgroup SPDIFRX_PT_Mask SPDIFRX Preamble Type Mask
233 #define SPDIFRX_PREAMBLETYPEMASK_OFF 0x00000000U
234 #define SPDIFRX_PREAMBLETYPEMASK_ON ((uint32_t)SPDIFRX_CR_PTMSK)
239 /** @defgroup SPDIFRX_ChannelStatus_Mask SPDIFRX Channel Status Mask
242 #define SPDIFRX_CHANNELSTATUS_OFF 0x00000000U /* The channel status and user bits are copied into the SPDIF_DR */
243 #define SPDIFRX_CHANNELSTATUS_ON ((uint32_t)SPDIFRX_CR_CUMSK) /* The channel status and user bits are not copied into the SPDIF_DR, zeros are written instead*/
248 /** @defgroup SPDIFRX_V_Mask SPDIFRX Validity Mask
251 #define SPDIFRX_VALIDITYMASK_OFF 0x00000000U
252 #define SPDIFRX_VALIDITYMASK_ON ((uint32_t)SPDIFRX_CR_VMSK)
257 /** @defgroup SPDIFRX_PE_Mask SPDIFRX Parity Error Mask
260 #define SPDIFRX_PARITYERRORMASK_OFF 0x00000000U
261 #define SPDIFRX_PARITYERRORMASK_ON ((uint32_t)SPDIFRX_CR_PMSK)
266 /** @defgroup SPDIFRX_Channel_Selection SPDIFRX Channel Selection
269 #define SPDIFRX_CHANNEL_A 0x00000000U
270 #define SPDIFRX_CHANNEL_B ((uint32_t)SPDIFRX_CR_CHSEL)
275 /** @defgroup SPDIFRX_Data_Format SPDIFRX Data Format
278 #define SPDIFRX_DATAFORMAT_LSB 0x00000000U
279 #define SPDIFRX_DATAFORMAT_MSB 0x00000010U
280 #define SPDIFRX_DATAFORMAT_32BITS 0x00000020U
285 /** @defgroup SPDIFRX_Stereo_Mode SPDIFRX Stereo Mode
288 #define SPDIFRX_STEREOMODE_DISABLE 0x00000000U
289 #define SPDIFRX_STEREOMODE_ENABLE ((uint32_t)SPDIFRX_CR_RXSTEO)
294 /** @defgroup SPDIFRX_State SPDIFRX State
298 #define SPDIFRX_STATE_IDLE 0xFFFFFFFCU
299 #define SPDIFRX_STATE_SYNC 0x00000001U
300 #define SPDIFRX_STATE_RCV ((uint32_t)SPDIFRX_CR_SPDIFEN)
305 /** @defgroup SPDIFRX_Interrupts_Definition SPDIFRX Interrupts Definition
308 #define SPDIFRX_IT_RXNE ((uint32_t)SPDIFRX_IMR_RXNEIE)
309 #define SPDIFRX_IT_CSRNE ((uint32_t)SPDIFRX_IMR_CSRNEIE)
310 #define SPDIFRX_IT_PERRIE ((uint32_t)SPDIFRX_IMR_PERRIE)
311 #define SPDIFRX_IT_OVRIE ((uint32_t)SPDIFRX_IMR_OVRIE)
312 #define SPDIFRX_IT_SBLKIE ((uint32_t)SPDIFRX_IMR_SBLKIE)
313 #define SPDIFRX_IT_SYNCDIE ((uint32_t)SPDIFRX_IMR_SYNCDIE)
314 #define SPDIFRX_IT_IFEIE ((uint32_t)SPDIFRX_IMR_IFEIE )
319 /** @defgroup SPDIFRX_Flags_Definition SPDIFRX Flags Definition
322 #define SPDIFRX_FLAG_RXNE ((uint32_t)SPDIFRX_SR_RXNE)
323 #define SPDIFRX_FLAG_CSRNE ((uint32_t)SPDIFRX_SR_CSRNE)
324 #define SPDIFRX_FLAG_PERR ((uint32_t)SPDIFRX_SR_PERR)
325 #define SPDIFRX_FLAG_OVR ((uint32_t)SPDIFRX_SR_OVR)
326 #define SPDIFRX_FLAG_SBD ((uint32_t)SPDIFRX_SR_SBD)
327 #define SPDIFRX_FLAG_SYNCD ((uint32_t)SPDIFRX_SR_SYNCD)
328 #define SPDIFRX_FLAG_FERR ((uint32_t)SPDIFRX_SR_FERR)
329 #define SPDIFRX_FLAG_SERR ((uint32_t)SPDIFRX_SR_SERR)
330 #define SPDIFRX_FLAG_TERR ((uint32_t)SPDIFRX_SR_TERR)
339 /* Exported macros -----------------------------------------------------------*/
340 /** @defgroup SPDIFRX_Exported_macros SPDIFRX Exported Macros
344 /** @brief Reset SPDIFRX handle state
345 * @param __HANDLE__: SPDIFRX handle.
348 #define __HAL_SPDIFRX_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = (uint16_t)SPDIFRX_CR_SPDIFEN)
350 /** @brief Disable the specified SPDIFRX peripheral (IDLE State).
351 * @param __HANDLE__: specifies the SPDIFRX Handle.
354 #define __HAL_SPDIFRX_IDLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= SPDIFRX_STATE_IDLE)
356 /** @brief Enable the specified SPDIFRX peripheral (SYNC State).
357 * @param __HANDLE__: specifies the SPDIFRX Handle.
360 #define __HAL_SPDIFRX_SYNC(__HANDLE__) ((__HANDLE__)->Instance->CR |= SPDIFRX_STATE_SYNC)
363 /** @brief Enable the specified SPDIFRX peripheral (RCV State).
364 * @param __HANDLE__: specifies the SPDIFRX Handle.
367 #define __HAL_SPDIFRX_RCV(__HANDLE__) ((__HANDLE__)->Instance->CR |= SPDIFRX_STATE_RCV)
369 /** @brief Enable or disable the specified SPDIFRX interrupts.
370 * @param __HANDLE__: specifies the SPDIFRX Handle.
371 * @param __INTERRUPT__: specifies the interrupt source to enable or disable.
372 * This parameter can be one of the following values:
373 * @arg SPDIFRX_IT_RXNE
374 * @arg SPDIFRX_IT_CSRNE
375 * @arg SPDIFRX_IT_PERRIE
376 * @arg SPDIFRX_IT_OVRIE
377 * @arg SPDIFRX_IT_SBLKIE
378 * @arg SPDIFRX_IT_SYNCDIE
379 * @arg SPDIFRX_IT_IFEIE
382 #define __HAL_SPDIFRX_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__))
383 #define __HAL_SPDIFRX_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (uint16_t)(~(__INTERRUPT__)))
385 /** @brief Checks if the specified SPDIFRX interrupt source is enabled or disabled.
386 * @param __HANDLE__: specifies the SPDIFRX Handle.
387 * @param __INTERRUPT__: specifies the SPDIFRX interrupt source to check.
388 * This parameter can be one of the following values:
389 * @arg SPDIFRX_IT_RXNE
390 * @arg SPDIFRX_IT_CSRNE
391 * @arg SPDIFRX_IT_PERRIE
392 * @arg SPDIFRX_IT_OVRIE
393 * @arg SPDIFRX_IT_SBLKIE
394 * @arg SPDIFRX_IT_SYNCDIE
395 * @arg SPDIFRX_IT_IFEIE
396 * @retval The new state of __IT__ (TRUE or FALSE).
398 #define __HAL_SPDIFRX_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IMR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
400 /** @brief Checks whether the specified SPDIFRX flag is set or not.
401 * @param __HANDLE__: specifies the SPDIFRX Handle.
402 * @param __FLAG__: specifies the flag to check.
403 * This parameter can be one of the following values:
404 * @arg SPDIFRX_FLAG_RXNE
405 * @arg SPDIFRX_FLAG_CSRNE
406 * @arg SPDIFRX_FLAG_PERR
407 * @arg SPDIFRX_FLAG_OVR
408 * @arg SPDIFRX_FLAG_SBD
409 * @arg SPDIFRX_FLAG_SYNCD
410 * @arg SPDIFRX_FLAG_FERR
411 * @arg SPDIFRX_FLAG_SERR
412 * @arg SPDIFRX_FLAG_TERR
413 * @retval The new state of __FLAG__ (TRUE or FALSE).
415 #define __HAL_SPDIFRX_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
417 /** @brief Clears the specified SPDIFRX SR flag, in setting the proper IFCR register bit.
418 * @param __HANDLE__: specifies the USART Handle.
419 * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
420 * to clear the corresponding interrupt
421 * This parameter can be one of the following values:
422 * @arg SPDIFRX_FLAG_PERR
423 * @arg SPDIFRX_FLAG_OVR
424 * @arg SPDIFRX_SR_SBD
425 * @arg SPDIFRX_SR_SYNCD
428 #define __HAL_SPDIFRX_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->IFCR = (uint32_t)(__IT_CLEAR__))
434 /* Exported functions --------------------------------------------------------*/
435 /** @addtogroup SPDIFRX_Exported_Functions
439 /** @addtogroup SPDIFRX_Exported_Functions_Group1
442 /* Initialization/de-initialization functions **********************************/
443 HAL_StatusTypeDef
HAL_SPDIFRX_Init(SPDIFRX_HandleTypeDef
*hspdif
);
444 HAL_StatusTypeDef
HAL_SPDIFRX_DeInit (SPDIFRX_HandleTypeDef
*hspdif
);
445 void HAL_SPDIFRX_MspInit(SPDIFRX_HandleTypeDef
*hspdif
);
446 void HAL_SPDIFRX_MspDeInit(SPDIFRX_HandleTypeDef
*hspdif
);
447 HAL_StatusTypeDef
HAL_SPDIFRX_SetDataFormat(SPDIFRX_HandleTypeDef
*hspdif
, SPDIFRX_SetDataFormatTypeDef sDataFormat
);
452 /** @addtogroup SPDIFRX_Exported_Functions_Group2
455 /* I/O operation functions ***************************************************/
456 /* Blocking mode: Polling */
457 HAL_StatusTypeDef
HAL_SPDIFRX_ReceiveDataFlow(SPDIFRX_HandleTypeDef
*hspdif
, uint32_t *pData
, uint16_t Size
, uint32_t Timeout
);
458 HAL_StatusTypeDef
HAL_SPDIFRX_ReceiveControlFlow(SPDIFRX_HandleTypeDef
*hspdif
, uint32_t *pData
, uint16_t Size
, uint32_t Timeout
);
460 /* Non-Blocking mode: Interrupt */
461 HAL_StatusTypeDef
HAL_SPDIFRX_ReceiveControlFlow_IT(SPDIFRX_HandleTypeDef
*hspdif
, uint32_t *pData
, uint16_t Size
);
462 HAL_StatusTypeDef
HAL_SPDIFRX_ReceiveDataFlow_IT(SPDIFRX_HandleTypeDef
*hspdif
, uint32_t *pData
, uint16_t Size
);
463 void HAL_SPDIFRX_IRQHandler(SPDIFRX_HandleTypeDef
*hspdif
);
465 /* Non-Blocking mode: DMA */
466 HAL_StatusTypeDef
HAL_SPDIFRX_ReceiveControlFlow_DMA(SPDIFRX_HandleTypeDef
*hspdif
, uint32_t *pData
, uint16_t Size
);
467 HAL_StatusTypeDef
HAL_SPDIFRX_ReceiveDataFlow_DMA(SPDIFRX_HandleTypeDef
*hspdif
, uint32_t *pData
, uint16_t Size
);
469 HAL_StatusTypeDef
HAL_SPDIFRX_DMAStop(SPDIFRX_HandleTypeDef
*hspdif
);
471 /* Callbacks used in non blocking modes (Interrupt and DMA) *******************/
472 void HAL_SPDIFRX_RxHalfCpltCallback(SPDIFRX_HandleTypeDef
*hspdif
);
473 void HAL_SPDIFRX_RxCpltCallback(SPDIFRX_HandleTypeDef
*hspdif
);
474 void HAL_SPDIFRX_ErrorCallback(SPDIFRX_HandleTypeDef
*hspdif
);
475 void HAL_SPDIFRX_CxHalfCpltCallback(SPDIFRX_HandleTypeDef
*hspdif
);
476 void HAL_SPDIFRX_CxCpltCallback(SPDIFRX_HandleTypeDef
*hspdif
);
481 /** @addtogroup SPDIFRX_Exported_Functions_Group3
484 /* Peripheral Control and State functions ************************************/
485 HAL_SPDIFRX_StateTypeDef
HAL_SPDIFRX_GetState(SPDIFRX_HandleTypeDef
*hspdif
);
486 uint32_t HAL_SPDIFRX_GetError(SPDIFRX_HandleTypeDef
*hspdif
);
494 /* Private types -------------------------------------------------------------*/
495 /* Private variables ---------------------------------------------------------*/
496 /* Private constants ---------------------------------------------------------*/
497 /* Private macros ------------------------------------------------------------*/
498 /** @defgroup SPDIFRX_Private_Macros SPDIFRX Private Macros
501 #define IS_SPDIFRX_INPUT_SELECT(INPUT) (((INPUT) == SPDIFRX_INPUT_IN1) || \
502 ((INPUT) == SPDIFRX_INPUT_IN2) || \
503 ((INPUT) == SPDIFRX_INPUT_IN3) || \
504 ((INPUT) == SPDIFRX_INPUT_IN0))
505 #define IS_SPDIFRX_MAX_RETRIES(RET) (((RET) == SPDIFRX_MAXRETRIES_NONE) || \
506 ((RET) == SPDIFRX_MAXRETRIES_3) || \
507 ((RET) == SPDIFRX_MAXRETRIES_15) || \
508 ((RET) == SPDIFRX_MAXRETRIES_63))
509 #define IS_SPDIFRX_WAIT_FOR_ACTIVITY(VAL) (((VAL) == SPDIFRX_WAITFORACTIVITY_ON) || \
510 ((VAL) == SPDIFRX_WAITFORACTIVITY_OFF))
511 #define IS_PREAMBLE_TYPE_MASK(VAL) (((VAL) == SPDIFRX_PREAMBLETYPEMASK_ON) || \
512 ((VAL) == SPDIFRX_PREAMBLETYPEMASK_OFF))
513 #define IS_VALIDITY_MASK(VAL) (((VAL) == SPDIFRX_VALIDITYMASK_OFF) || \
514 ((VAL) == SPDIFRX_VALIDITYMASK_ON))
515 #define IS_PARITY_ERROR_MASK(VAL) (((VAL) == SPDIFRX_PARITYERRORMASK_OFF) || \
516 ((VAL) == SPDIFRX_PARITYERRORMASK_ON))
517 #define IS_SPDIFRX_CHANNEL(CHANNEL) (((CHANNEL) == SPDIFRX_CHANNEL_A) || \
518 ((CHANNEL) == SPDIFRX_CHANNEL_B))
519 #define IS_SPDIFRX_DATA_FORMAT(FORMAT) (((FORMAT) == SPDIFRX_DATAFORMAT_LSB) || \
520 ((FORMAT) == SPDIFRX_DATAFORMAT_MSB) || \
521 ((FORMAT) == SPDIFRX_DATAFORMAT_32BITS))
522 #define IS_STEREO_MODE(MODE) (((MODE) == SPDIFRX_STEREOMODE_DISABLE) || \
523 ((MODE) == SPDIFRX_STEREOMODE_ENABLE))
525 #define IS_CHANNEL_STATUS_MASK(VAL) (((VAL) == SPDIFRX_CHANNELSTATUS_ON) || \
526 ((VAL) == SPDIFRX_CHANNELSTATUS_OFF))
531 /* Private functions ---------------------------------------------------------*/
532 /** @defgroup SPDIFRX_Private_Functions SPDIFRX Private Functions
546 #endif /* STM32F446xx */
553 #endif /* __STM32F4xx_HAL_SPDIFRX_H */
555 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/