Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_spdifrx.h@0:bb348c97df44, 2020-09-16 (annotated)
- Committer:
- lypinator
- Date:
- Wed Sep 16 01:11:49 2020 +0000
- Revision:
- 0:bb348c97df44
Added PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lypinator | 0:bb348c97df44 | 1 | /** |
lypinator | 0:bb348c97df44 | 2 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 3 | * @file stm32f4xx_hal_spdifrx.h |
lypinator | 0:bb348c97df44 | 4 | * @author MCD Application Team |
lypinator | 0:bb348c97df44 | 5 | * @brief Header file of SPDIFRX HAL module. |
lypinator | 0:bb348c97df44 | 6 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 7 | * @attention |
lypinator | 0:bb348c97df44 | 8 | * |
lypinator | 0:bb348c97df44 | 9 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
lypinator | 0:bb348c97df44 | 10 | * |
lypinator | 0:bb348c97df44 | 11 | * Redistribution and use in source and binary forms, with or without modification, |
lypinator | 0:bb348c97df44 | 12 | * are permitted provided that the following conditions are met: |
lypinator | 0:bb348c97df44 | 13 | * 1. Redistributions of source code must retain the above copyright notice, |
lypinator | 0:bb348c97df44 | 14 | * this list of conditions and the following disclaimer. |
lypinator | 0:bb348c97df44 | 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
lypinator | 0:bb348c97df44 | 16 | * this list of conditions and the following disclaimer in the documentation |
lypinator | 0:bb348c97df44 | 17 | * and/or other materials provided with the distribution. |
lypinator | 0:bb348c97df44 | 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
lypinator | 0:bb348c97df44 | 19 | * may be used to endorse or promote products derived from this software |
lypinator | 0:bb348c97df44 | 20 | * without specific prior written permission. |
lypinator | 0:bb348c97df44 | 21 | * |
lypinator | 0:bb348c97df44 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
lypinator | 0:bb348c97df44 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
lypinator | 0:bb348c97df44 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
lypinator | 0:bb348c97df44 | 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
lypinator | 0:bb348c97df44 | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
lypinator | 0:bb348c97df44 | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
lypinator | 0:bb348c97df44 | 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
lypinator | 0:bb348c97df44 | 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
lypinator | 0:bb348c97df44 | 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
lypinator | 0:bb348c97df44 | 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
lypinator | 0:bb348c97df44 | 32 | * |
lypinator | 0:bb348c97df44 | 33 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 34 | */ |
lypinator | 0:bb348c97df44 | 35 | |
lypinator | 0:bb348c97df44 | 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
lypinator | 0:bb348c97df44 | 37 | #ifndef __STM32F4xx_HAL_SPDIFRX_H |
lypinator | 0:bb348c97df44 | 38 | #define __STM32F4xx_HAL_SPDIFRX_H |
lypinator | 0:bb348c97df44 | 39 | |
lypinator | 0:bb348c97df44 | 40 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 41 | extern "C" { |
lypinator | 0:bb348c97df44 | 42 | #endif |
lypinator | 0:bb348c97df44 | 43 | |
lypinator | 0:bb348c97df44 | 44 | #if defined(STM32F446xx) |
lypinator | 0:bb348c97df44 | 45 | |
lypinator | 0:bb348c97df44 | 46 | /* Includes ------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 47 | #include "stm32f4xx_hal_def.h" |
lypinator | 0:bb348c97df44 | 48 | |
lypinator | 0:bb348c97df44 | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
lypinator | 0:bb348c97df44 | 50 | * @{ |
lypinator | 0:bb348c97df44 | 51 | */ |
lypinator | 0:bb348c97df44 | 52 | |
lypinator | 0:bb348c97df44 | 53 | /** @addtogroup SPDIFRX |
lypinator | 0:bb348c97df44 | 54 | * @{ |
lypinator | 0:bb348c97df44 | 55 | */ |
lypinator | 0:bb348c97df44 | 56 | |
lypinator | 0:bb348c97df44 | 57 | /* Exported types ------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 58 | /** @defgroup SPDIFRX_Exported_Types SPDIFRX Exported Types |
lypinator | 0:bb348c97df44 | 59 | * @{ |
lypinator | 0:bb348c97df44 | 60 | */ |
lypinator | 0:bb348c97df44 | 61 | |
lypinator | 0:bb348c97df44 | 62 | /** |
lypinator | 0:bb348c97df44 | 63 | * @brief SPDIFRX Init structure definition |
lypinator | 0:bb348c97df44 | 64 | */ |
lypinator | 0:bb348c97df44 | 65 | typedef struct |
lypinator | 0:bb348c97df44 | 66 | { |
lypinator | 0:bb348c97df44 | 67 | uint32_t InputSelection; /*!< Specifies the SPDIF input selection. |
lypinator | 0:bb348c97df44 | 68 | This parameter can be a value of @ref SPDIFRX_Input_Selection */ |
lypinator | 0:bb348c97df44 | 69 | |
lypinator | 0:bb348c97df44 | 70 | uint32_t Retries; /*!< Specifies the Maximum allowed re-tries during synchronization phase. |
lypinator | 0:bb348c97df44 | 71 | This parameter can be a value of @ref SPDIFRX_Max_Retries */ |
lypinator | 0:bb348c97df44 | 72 | |
lypinator | 0:bb348c97df44 | 73 | uint32_t WaitForActivity; /*!< Specifies the wait for activity on SPDIF selected input. |
lypinator | 0:bb348c97df44 | 74 | This parameter can be a value of @ref SPDIFRX_Wait_For_Activity. */ |
lypinator | 0:bb348c97df44 | 75 | |
lypinator | 0:bb348c97df44 | 76 | uint32_t ChannelSelection; /*!< Specifies whether the control flow will take the channel status from channel A or B. |
lypinator | 0:bb348c97df44 | 77 | This parameter can be a value of @ref SPDIFRX_Channel_Selection */ |
lypinator | 0:bb348c97df44 | 78 | |
lypinator | 0:bb348c97df44 | 79 | uint32_t DataFormat; /*!< Specifies the Data samples format (LSB, MSB, ...). |
lypinator | 0:bb348c97df44 | 80 | This parameter can be a value of @ref SPDIFRX_Data_Format */ |
lypinator | 0:bb348c97df44 | 81 | |
lypinator | 0:bb348c97df44 | 82 | uint32_t StereoMode; /*!< Specifies whether the peripheral is in stereo or mono mode. |
lypinator | 0:bb348c97df44 | 83 | This parameter can be a value of @ref SPDIFRX_Stereo_Mode */ |
lypinator | 0:bb348c97df44 | 84 | |
lypinator | 0:bb348c97df44 | 85 | uint32_t PreambleTypeMask; /*!< Specifies whether The preamble type bits are copied or not into the received frame. |
lypinator | 0:bb348c97df44 | 86 | This parameter can be a value of @ref SPDIFRX_PT_Mask */ |
lypinator | 0:bb348c97df44 | 87 | |
lypinator | 0:bb348c97df44 | 88 | uint32_t ChannelStatusMask; /*!< Specifies whether the channel status and user bits are copied or not into the received frame. |
lypinator | 0:bb348c97df44 | 89 | This parameter can be a value of @ref SPDIFRX_ChannelStatus_Mask */ |
lypinator | 0:bb348c97df44 | 90 | |
lypinator | 0:bb348c97df44 | 91 | uint32_t ValidityBitMask; /*!< Specifies whether the validity bit is copied or not into the received frame. |
lypinator | 0:bb348c97df44 | 92 | This parameter can be a value of @ref SPDIFRX_V_Mask */ |
lypinator | 0:bb348c97df44 | 93 | |
lypinator | 0:bb348c97df44 | 94 | uint32_t ParityErrorMask; /*!< Specifies whether the parity error bit is copied or not into the received frame. |
lypinator | 0:bb348c97df44 | 95 | This parameter can be a value of @ref SPDIFRX_PE_Mask */ |
lypinator | 0:bb348c97df44 | 96 | }SPDIFRX_InitTypeDef; |
lypinator | 0:bb348c97df44 | 97 | |
lypinator | 0:bb348c97df44 | 98 | /** |
lypinator | 0:bb348c97df44 | 99 | * @brief SPDIFRX SetDataFormat structure definition |
lypinator | 0:bb348c97df44 | 100 | */ |
lypinator | 0:bb348c97df44 | 101 | typedef struct |
lypinator | 0:bb348c97df44 | 102 | { |
lypinator | 0:bb348c97df44 | 103 | uint32_t DataFormat; /*!< Specifies the Data samples format (LSB, MSB, ...). |
lypinator | 0:bb348c97df44 | 104 | This parameter can be a value of @ref SPDIFRX_Data_Format */ |
lypinator | 0:bb348c97df44 | 105 | |
lypinator | 0:bb348c97df44 | 106 | uint32_t StereoMode; /*!< Specifies whether the peripheral is in stereo or mono mode. |
lypinator | 0:bb348c97df44 | 107 | This parameter can be a value of @ref SPDIFRX_Stereo_Mode */ |
lypinator | 0:bb348c97df44 | 108 | |
lypinator | 0:bb348c97df44 | 109 | uint32_t PreambleTypeMask; /*!< Specifies whether The preamble type bits are copied or not into the received frame. |
lypinator | 0:bb348c97df44 | 110 | This parameter can be a value of @ref SPDIFRX_PT_Mask */ |
lypinator | 0:bb348c97df44 | 111 | |
lypinator | 0:bb348c97df44 | 112 | uint32_t ChannelStatusMask; /*!< Specifies whether the channel status and user bits are copied or not into the received frame. |
lypinator | 0:bb348c97df44 | 113 | This parameter can be a value of @ref SPDIFRX_ChannelStatus_Mask */ |
lypinator | 0:bb348c97df44 | 114 | |
lypinator | 0:bb348c97df44 | 115 | uint32_t ValidityBitMask; /*!< Specifies whether the validity bit is copied or not into the received frame. |
lypinator | 0:bb348c97df44 | 116 | This parameter can be a value of @ref SPDIFRX_V_Mask */ |
lypinator | 0:bb348c97df44 | 117 | |
lypinator | 0:bb348c97df44 | 118 | uint32_t ParityErrorMask; /*!< Specifies whether the parity error bit is copied or not into the received frame. |
lypinator | 0:bb348c97df44 | 119 | This parameter can be a value of @ref SPDIFRX_PE_Mask */ |
lypinator | 0:bb348c97df44 | 120 | }SPDIFRX_SetDataFormatTypeDef; |
lypinator | 0:bb348c97df44 | 121 | |
lypinator | 0:bb348c97df44 | 122 | /** |
lypinator | 0:bb348c97df44 | 123 | * @brief HAL State structures definition |
lypinator | 0:bb348c97df44 | 124 | */ |
lypinator | 0:bb348c97df44 | 125 | typedef enum |
lypinator | 0:bb348c97df44 | 126 | { |
lypinator | 0:bb348c97df44 | 127 | HAL_SPDIFRX_STATE_RESET = 0x00U, /*!< SPDIFRX not yet initialized or disabled */ |
lypinator | 0:bb348c97df44 | 128 | HAL_SPDIFRX_STATE_READY = 0x01U, /*!< SPDIFRX initialized and ready for use */ |
lypinator | 0:bb348c97df44 | 129 | HAL_SPDIFRX_STATE_BUSY = 0x02U, /*!< SPDIFRX internal process is ongoing */ |
lypinator | 0:bb348c97df44 | 130 | HAL_SPDIFRX_STATE_BUSY_RX = 0x03U, /*!< SPDIFRX internal Data Flow RX process is ongoing */ |
lypinator | 0:bb348c97df44 | 131 | HAL_SPDIFRX_STATE_BUSY_CX = 0x04U, /*!< SPDIFRX internal Control Flow RX process is ongoing */ |
lypinator | 0:bb348c97df44 | 132 | HAL_SPDIFRX_STATE_ERROR = 0x07U /*!< SPDIFRX error state */ |
lypinator | 0:bb348c97df44 | 133 | }HAL_SPDIFRX_StateTypeDef; |
lypinator | 0:bb348c97df44 | 134 | |
lypinator | 0:bb348c97df44 | 135 | /** |
lypinator | 0:bb348c97df44 | 136 | * @brief SPDIFRX handle Structure definition |
lypinator | 0:bb348c97df44 | 137 | */ |
lypinator | 0:bb348c97df44 | 138 | typedef struct |
lypinator | 0:bb348c97df44 | 139 | { |
lypinator | 0:bb348c97df44 | 140 | SPDIFRX_TypeDef *Instance; /* SPDIFRX registers base address */ |
lypinator | 0:bb348c97df44 | 141 | |
lypinator | 0:bb348c97df44 | 142 | SPDIFRX_InitTypeDef Init; /* SPDIFRX communication parameters */ |
lypinator | 0:bb348c97df44 | 143 | |
lypinator | 0:bb348c97df44 | 144 | uint32_t *pRxBuffPtr; /* Pointer to SPDIFRX Rx transfer buffer */ |
lypinator | 0:bb348c97df44 | 145 | |
lypinator | 0:bb348c97df44 | 146 | uint32_t *pCsBuffPtr; /* Pointer to SPDIFRX Cx transfer buffer */ |
lypinator | 0:bb348c97df44 | 147 | |
lypinator | 0:bb348c97df44 | 148 | __IO uint16_t RxXferSize; /* SPDIFRX Rx transfer size */ |
lypinator | 0:bb348c97df44 | 149 | |
lypinator | 0:bb348c97df44 | 150 | __IO uint16_t RxXferCount; /* SPDIFRX Rx transfer counter |
lypinator | 0:bb348c97df44 | 151 | (This field is initialized at the |
lypinator | 0:bb348c97df44 | 152 | same value as transfer size at the |
lypinator | 0:bb348c97df44 | 153 | beginning of the transfer and |
lypinator | 0:bb348c97df44 | 154 | decremented when a sample is received. |
lypinator | 0:bb348c97df44 | 155 | NbSamplesReceived = RxBufferSize-RxBufferCount) */ |
lypinator | 0:bb348c97df44 | 156 | |
lypinator | 0:bb348c97df44 | 157 | __IO uint16_t CsXferSize; /* SPDIFRX Rx transfer size */ |
lypinator | 0:bb348c97df44 | 158 | |
lypinator | 0:bb348c97df44 | 159 | __IO uint16_t CsXferCount; /* SPDIFRX Rx transfer counter |
lypinator | 0:bb348c97df44 | 160 | (This field is initialized at the |
lypinator | 0:bb348c97df44 | 161 | same value as transfer size at the |
lypinator | 0:bb348c97df44 | 162 | beginning of the transfer and |
lypinator | 0:bb348c97df44 | 163 | decremented when a sample is received. |
lypinator | 0:bb348c97df44 | 164 | NbSamplesReceived = RxBufferSize-RxBufferCount) */ |
lypinator | 0:bb348c97df44 | 165 | |
lypinator | 0:bb348c97df44 | 166 | DMA_HandleTypeDef *hdmaCsRx; /* SPDIFRX EC60958_channel_status and user_information DMA handle parameters */ |
lypinator | 0:bb348c97df44 | 167 | |
lypinator | 0:bb348c97df44 | 168 | DMA_HandleTypeDef *hdmaDrRx; /* SPDIFRX Rx DMA handle parameters */ |
lypinator | 0:bb348c97df44 | 169 | |
lypinator | 0:bb348c97df44 | 170 | __IO HAL_LockTypeDef Lock; /* SPDIFRX locking object */ |
lypinator | 0:bb348c97df44 | 171 | |
lypinator | 0:bb348c97df44 | 172 | __IO HAL_SPDIFRX_StateTypeDef State; /* SPDIFRX communication state */ |
lypinator | 0:bb348c97df44 | 173 | |
lypinator | 0:bb348c97df44 | 174 | __IO uint32_t ErrorCode; /* SPDIFRX Error code */ |
lypinator | 0:bb348c97df44 | 175 | }SPDIFRX_HandleTypeDef; |
lypinator | 0:bb348c97df44 | 176 | /** |
lypinator | 0:bb348c97df44 | 177 | * @} |
lypinator | 0:bb348c97df44 | 178 | */ |
lypinator | 0:bb348c97df44 | 179 | |
lypinator | 0:bb348c97df44 | 180 | /* Exported constants --------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 181 | /** @defgroup SPDIFRX_Exported_Constants SPDIFRX Exported Constants |
lypinator | 0:bb348c97df44 | 182 | * @{ |
lypinator | 0:bb348c97df44 | 183 | */ |
lypinator | 0:bb348c97df44 | 184 | /** @defgroup SPDIFRX_ErrorCode SPDIFRX Error Code |
lypinator | 0:bb348c97df44 | 185 | * @{ |
lypinator | 0:bb348c97df44 | 186 | */ |
lypinator | 0:bb348c97df44 | 187 | #define HAL_SPDIFRX_ERROR_NONE 0x00000000U /*!< No error */ |
lypinator | 0:bb348c97df44 | 188 | #define HAL_SPDIFRX_ERROR_TIMEOUT 0x00000001U /*!< Timeout error */ |
lypinator | 0:bb348c97df44 | 189 | #define HAL_SPDIFRX_ERROR_OVR 0x00000002U /*!< OVR error */ |
lypinator | 0:bb348c97df44 | 190 | #define HAL_SPDIFRX_ERROR_PE 0x00000004U /*!< Parity error */ |
lypinator | 0:bb348c97df44 | 191 | #define HAL_SPDIFRX_ERROR_DMA 0x00000008U /*!< DMA transfer error */ |
lypinator | 0:bb348c97df44 | 192 | #define HAL_SPDIFRX_ERROR_UNKNOWN 0x00000010U /*!< Unknown Error error */ |
lypinator | 0:bb348c97df44 | 193 | /** |
lypinator | 0:bb348c97df44 | 194 | * @} |
lypinator | 0:bb348c97df44 | 195 | */ |
lypinator | 0:bb348c97df44 | 196 | |
lypinator | 0:bb348c97df44 | 197 | /** @defgroup SPDIFRX_Input_Selection SPDIFRX Input Selection |
lypinator | 0:bb348c97df44 | 198 | * @{ |
lypinator | 0:bb348c97df44 | 199 | */ |
lypinator | 0:bb348c97df44 | 200 | #define SPDIFRX_INPUT_IN0 0x00000000U |
lypinator | 0:bb348c97df44 | 201 | #define SPDIFRX_INPUT_IN1 0x00010000U |
lypinator | 0:bb348c97df44 | 202 | #define SPDIFRX_INPUT_IN2 0x00020000U |
lypinator | 0:bb348c97df44 | 203 | #define SPDIFRX_INPUT_IN3 0x00030000U |
lypinator | 0:bb348c97df44 | 204 | /** |
lypinator | 0:bb348c97df44 | 205 | * @} |
lypinator | 0:bb348c97df44 | 206 | */ |
lypinator | 0:bb348c97df44 | 207 | |
lypinator | 0:bb348c97df44 | 208 | /** @defgroup SPDIFRX_Max_Retries SPDIFRX Maximum Retries |
lypinator | 0:bb348c97df44 | 209 | * @{ |
lypinator | 0:bb348c97df44 | 210 | */ |
lypinator | 0:bb348c97df44 | 211 | #define SPDIFRX_MAXRETRIES_NONE 0x00000000U |
lypinator | 0:bb348c97df44 | 212 | #define SPDIFRX_MAXRETRIES_3 0x00001000U |
lypinator | 0:bb348c97df44 | 213 | #define SPDIFRX_MAXRETRIES_15 0x00002000U |
lypinator | 0:bb348c97df44 | 214 | #define SPDIFRX_MAXRETRIES_63 0x00003000U |
lypinator | 0:bb348c97df44 | 215 | /** |
lypinator | 0:bb348c97df44 | 216 | * @} |
lypinator | 0:bb348c97df44 | 217 | */ |
lypinator | 0:bb348c97df44 | 218 | |
lypinator | 0:bb348c97df44 | 219 | /** @defgroup SPDIFRX_Wait_For_Activity SPDIFRX Wait For Activity |
lypinator | 0:bb348c97df44 | 220 | * @{ |
lypinator | 0:bb348c97df44 | 221 | */ |
lypinator | 0:bb348c97df44 | 222 | #define SPDIFRX_WAITFORACTIVITY_OFF 0x00000000U |
lypinator | 0:bb348c97df44 | 223 | #define SPDIFRX_WAITFORACTIVITY_ON ((uint32_t)SPDIFRX_CR_WFA) |
lypinator | 0:bb348c97df44 | 224 | /** |
lypinator | 0:bb348c97df44 | 225 | * @} |
lypinator | 0:bb348c97df44 | 226 | */ |
lypinator | 0:bb348c97df44 | 227 | |
lypinator | 0:bb348c97df44 | 228 | /** @defgroup SPDIFRX_PT_Mask SPDIFRX Preamble Type Mask |
lypinator | 0:bb348c97df44 | 229 | * @{ |
lypinator | 0:bb348c97df44 | 230 | */ |
lypinator | 0:bb348c97df44 | 231 | #define SPDIFRX_PREAMBLETYPEMASK_OFF 0x00000000U |
lypinator | 0:bb348c97df44 | 232 | #define SPDIFRX_PREAMBLETYPEMASK_ON ((uint32_t)SPDIFRX_CR_PTMSK) |
lypinator | 0:bb348c97df44 | 233 | /** |
lypinator | 0:bb348c97df44 | 234 | * @} |
lypinator | 0:bb348c97df44 | 235 | */ |
lypinator | 0:bb348c97df44 | 236 | |
lypinator | 0:bb348c97df44 | 237 | /** @defgroup SPDIFRX_ChannelStatus_Mask SPDIFRX Channel Status Mask |
lypinator | 0:bb348c97df44 | 238 | * @{ |
lypinator | 0:bb348c97df44 | 239 | */ |
lypinator | 0:bb348c97df44 | 240 | #define SPDIFRX_CHANNELSTATUS_OFF 0x00000000U /* The channel status and user bits are copied into the SPDIF_DR */ |
lypinator | 0:bb348c97df44 | 241 | #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*/ |
lypinator | 0:bb348c97df44 | 242 | /** |
lypinator | 0:bb348c97df44 | 243 | * @} |
lypinator | 0:bb348c97df44 | 244 | */ |
lypinator | 0:bb348c97df44 | 245 | |
lypinator | 0:bb348c97df44 | 246 | /** @defgroup SPDIFRX_V_Mask SPDIFRX Validity Mask |
lypinator | 0:bb348c97df44 | 247 | * @{ |
lypinator | 0:bb348c97df44 | 248 | */ |
lypinator | 0:bb348c97df44 | 249 | #define SPDIFRX_VALIDITYMASK_OFF 0x00000000U |
lypinator | 0:bb348c97df44 | 250 | #define SPDIFRX_VALIDITYMASK_ON ((uint32_t)SPDIFRX_CR_VMSK) |
lypinator | 0:bb348c97df44 | 251 | /** |
lypinator | 0:bb348c97df44 | 252 | * @} |
lypinator | 0:bb348c97df44 | 253 | */ |
lypinator | 0:bb348c97df44 | 254 | |
lypinator | 0:bb348c97df44 | 255 | /** @defgroup SPDIFRX_PE_Mask SPDIFRX Parity Error Mask |
lypinator | 0:bb348c97df44 | 256 | * @{ |
lypinator | 0:bb348c97df44 | 257 | */ |
lypinator | 0:bb348c97df44 | 258 | #define SPDIFRX_PARITYERRORMASK_OFF 0x00000000U |
lypinator | 0:bb348c97df44 | 259 | #define SPDIFRX_PARITYERRORMASK_ON ((uint32_t)SPDIFRX_CR_PMSK) |
lypinator | 0:bb348c97df44 | 260 | /** |
lypinator | 0:bb348c97df44 | 261 | * @} |
lypinator | 0:bb348c97df44 | 262 | */ |
lypinator | 0:bb348c97df44 | 263 | |
lypinator | 0:bb348c97df44 | 264 | /** @defgroup SPDIFRX_Channel_Selection SPDIFRX Channel Selection |
lypinator | 0:bb348c97df44 | 265 | * @{ |
lypinator | 0:bb348c97df44 | 266 | */ |
lypinator | 0:bb348c97df44 | 267 | #define SPDIFRX_CHANNEL_A 0x00000000U |
lypinator | 0:bb348c97df44 | 268 | #define SPDIFRX_CHANNEL_B ((uint32_t)SPDIFRX_CR_CHSEL) |
lypinator | 0:bb348c97df44 | 269 | /** |
lypinator | 0:bb348c97df44 | 270 | * @} |
lypinator | 0:bb348c97df44 | 271 | */ |
lypinator | 0:bb348c97df44 | 272 | |
lypinator | 0:bb348c97df44 | 273 | /** @defgroup SPDIFRX_Data_Format SPDIFRX Data Format |
lypinator | 0:bb348c97df44 | 274 | * @{ |
lypinator | 0:bb348c97df44 | 275 | */ |
lypinator | 0:bb348c97df44 | 276 | #define SPDIFRX_DATAFORMAT_LSB 0x00000000U |
lypinator | 0:bb348c97df44 | 277 | #define SPDIFRX_DATAFORMAT_MSB 0x00000010U |
lypinator | 0:bb348c97df44 | 278 | #define SPDIFRX_DATAFORMAT_32BITS 0x00000020U |
lypinator | 0:bb348c97df44 | 279 | /** |
lypinator | 0:bb348c97df44 | 280 | * @} |
lypinator | 0:bb348c97df44 | 281 | */ |
lypinator | 0:bb348c97df44 | 282 | |
lypinator | 0:bb348c97df44 | 283 | /** @defgroup SPDIFRX_Stereo_Mode SPDIFRX Stereo Mode |
lypinator | 0:bb348c97df44 | 284 | * @{ |
lypinator | 0:bb348c97df44 | 285 | */ |
lypinator | 0:bb348c97df44 | 286 | #define SPDIFRX_STEREOMODE_DISABLE 0x00000000U |
lypinator | 0:bb348c97df44 | 287 | #define SPDIFRX_STEREOMODE_ENABLE ((uint32_t)SPDIFRX_CR_RXSTEO) |
lypinator | 0:bb348c97df44 | 288 | /** |
lypinator | 0:bb348c97df44 | 289 | * @} |
lypinator | 0:bb348c97df44 | 290 | */ |
lypinator | 0:bb348c97df44 | 291 | |
lypinator | 0:bb348c97df44 | 292 | /** @defgroup SPDIFRX_State SPDIFRX State |
lypinator | 0:bb348c97df44 | 293 | * @{ |
lypinator | 0:bb348c97df44 | 294 | */ |
lypinator | 0:bb348c97df44 | 295 | |
lypinator | 0:bb348c97df44 | 296 | #define SPDIFRX_STATE_IDLE 0xFFFFFFFCU |
lypinator | 0:bb348c97df44 | 297 | #define SPDIFRX_STATE_SYNC 0x00000001U |
lypinator | 0:bb348c97df44 | 298 | #define SPDIFRX_STATE_RCV ((uint32_t)SPDIFRX_CR_SPDIFEN) |
lypinator | 0:bb348c97df44 | 299 | /** |
lypinator | 0:bb348c97df44 | 300 | * @} |
lypinator | 0:bb348c97df44 | 301 | */ |
lypinator | 0:bb348c97df44 | 302 | |
lypinator | 0:bb348c97df44 | 303 | /** @defgroup SPDIFRX_Interrupts_Definition SPDIFRX Interrupts Definition |
lypinator | 0:bb348c97df44 | 304 | * @{ |
lypinator | 0:bb348c97df44 | 305 | */ |
lypinator | 0:bb348c97df44 | 306 | #define SPDIFRX_IT_RXNE ((uint32_t)SPDIFRX_IMR_RXNEIE) |
lypinator | 0:bb348c97df44 | 307 | #define SPDIFRX_IT_CSRNE ((uint32_t)SPDIFRX_IMR_CSRNEIE) |
lypinator | 0:bb348c97df44 | 308 | #define SPDIFRX_IT_PERRIE ((uint32_t)SPDIFRX_IMR_PERRIE) |
lypinator | 0:bb348c97df44 | 309 | #define SPDIFRX_IT_OVRIE ((uint32_t)SPDIFRX_IMR_OVRIE) |
lypinator | 0:bb348c97df44 | 310 | #define SPDIFRX_IT_SBLKIE ((uint32_t)SPDIFRX_IMR_SBLKIE) |
lypinator | 0:bb348c97df44 | 311 | #define SPDIFRX_IT_SYNCDIE ((uint32_t)SPDIFRX_IMR_SYNCDIE) |
lypinator | 0:bb348c97df44 | 312 | #define SPDIFRX_IT_IFEIE ((uint32_t)SPDIFRX_IMR_IFEIE ) |
lypinator | 0:bb348c97df44 | 313 | /** |
lypinator | 0:bb348c97df44 | 314 | * @} |
lypinator | 0:bb348c97df44 | 315 | */ |
lypinator | 0:bb348c97df44 | 316 | |
lypinator | 0:bb348c97df44 | 317 | /** @defgroup SPDIFRX_Flags_Definition SPDIFRX Flags Definition |
lypinator | 0:bb348c97df44 | 318 | * @{ |
lypinator | 0:bb348c97df44 | 319 | */ |
lypinator | 0:bb348c97df44 | 320 | #define SPDIFRX_FLAG_RXNE ((uint32_t)SPDIFRX_SR_RXNE) |
lypinator | 0:bb348c97df44 | 321 | #define SPDIFRX_FLAG_CSRNE ((uint32_t)SPDIFRX_SR_CSRNE) |
lypinator | 0:bb348c97df44 | 322 | #define SPDIFRX_FLAG_PERR ((uint32_t)SPDIFRX_SR_PERR) |
lypinator | 0:bb348c97df44 | 323 | #define SPDIFRX_FLAG_OVR ((uint32_t)SPDIFRX_SR_OVR) |
lypinator | 0:bb348c97df44 | 324 | #define SPDIFRX_FLAG_SBD ((uint32_t)SPDIFRX_SR_SBD) |
lypinator | 0:bb348c97df44 | 325 | #define SPDIFRX_FLAG_SYNCD ((uint32_t)SPDIFRX_SR_SYNCD) |
lypinator | 0:bb348c97df44 | 326 | #define SPDIFRX_FLAG_FERR ((uint32_t)SPDIFRX_SR_FERR) |
lypinator | 0:bb348c97df44 | 327 | #define SPDIFRX_FLAG_SERR ((uint32_t)SPDIFRX_SR_SERR) |
lypinator | 0:bb348c97df44 | 328 | #define SPDIFRX_FLAG_TERR ((uint32_t)SPDIFRX_SR_TERR) |
lypinator | 0:bb348c97df44 | 329 | /** |
lypinator | 0:bb348c97df44 | 330 | * @} |
lypinator | 0:bb348c97df44 | 331 | */ |
lypinator | 0:bb348c97df44 | 332 | |
lypinator | 0:bb348c97df44 | 333 | /** |
lypinator | 0:bb348c97df44 | 334 | * @} |
lypinator | 0:bb348c97df44 | 335 | */ |
lypinator | 0:bb348c97df44 | 336 | |
lypinator | 0:bb348c97df44 | 337 | /* Exported macros -----------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 338 | /** @defgroup SPDIFRX_Exported_macros SPDIFRX Exported Macros |
lypinator | 0:bb348c97df44 | 339 | * @{ |
lypinator | 0:bb348c97df44 | 340 | */ |
lypinator | 0:bb348c97df44 | 341 | |
lypinator | 0:bb348c97df44 | 342 | /** @brief Reset SPDIFRX handle state |
lypinator | 0:bb348c97df44 | 343 | * @param __HANDLE__ SPDIFRX handle. |
lypinator | 0:bb348c97df44 | 344 | * @retval None |
lypinator | 0:bb348c97df44 | 345 | */ |
lypinator | 0:bb348c97df44 | 346 | #define __HAL_SPDIFRX_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = (uint16_t)SPDIFRX_CR_SPDIFEN) |
lypinator | 0:bb348c97df44 | 347 | |
lypinator | 0:bb348c97df44 | 348 | /** @brief Disable the specified SPDIFRX peripheral (IDLE State). |
lypinator | 0:bb348c97df44 | 349 | * @param __HANDLE__ specifies the SPDIFRX Handle. |
lypinator | 0:bb348c97df44 | 350 | * @retval None |
lypinator | 0:bb348c97df44 | 351 | */ |
lypinator | 0:bb348c97df44 | 352 | #define __HAL_SPDIFRX_IDLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= SPDIFRX_STATE_IDLE) |
lypinator | 0:bb348c97df44 | 353 | |
lypinator | 0:bb348c97df44 | 354 | /** @brief Enable the specified SPDIFRX peripheral (SYNC State). |
lypinator | 0:bb348c97df44 | 355 | * @param __HANDLE__ specifies the SPDIFRX Handle. |
lypinator | 0:bb348c97df44 | 356 | * @retval None |
lypinator | 0:bb348c97df44 | 357 | */ |
lypinator | 0:bb348c97df44 | 358 | #define __HAL_SPDIFRX_SYNC(__HANDLE__) ((__HANDLE__)->Instance->CR |= SPDIFRX_STATE_SYNC) |
lypinator | 0:bb348c97df44 | 359 | |
lypinator | 0:bb348c97df44 | 360 | |
lypinator | 0:bb348c97df44 | 361 | /** @brief Enable the specified SPDIFRX peripheral (RCV State). |
lypinator | 0:bb348c97df44 | 362 | * @param __HANDLE__ specifies the SPDIFRX Handle. |
lypinator | 0:bb348c97df44 | 363 | * @retval None |
lypinator | 0:bb348c97df44 | 364 | */ |
lypinator | 0:bb348c97df44 | 365 | #define __HAL_SPDIFRX_RCV(__HANDLE__) ((__HANDLE__)->Instance->CR |= SPDIFRX_STATE_RCV) |
lypinator | 0:bb348c97df44 | 366 | |
lypinator | 0:bb348c97df44 | 367 | /** @brief Enable or disable the specified SPDIFRX interrupts. |
lypinator | 0:bb348c97df44 | 368 | * @param __HANDLE__ specifies the SPDIFRX Handle. |
lypinator | 0:bb348c97df44 | 369 | * @param __INTERRUPT__ specifies the interrupt source to enable or disable. |
lypinator | 0:bb348c97df44 | 370 | * This parameter can be one of the following values: |
lypinator | 0:bb348c97df44 | 371 | * @arg SPDIFRX_IT_RXNE |
lypinator | 0:bb348c97df44 | 372 | * @arg SPDIFRX_IT_CSRNE |
lypinator | 0:bb348c97df44 | 373 | * @arg SPDIFRX_IT_PERRIE |
lypinator | 0:bb348c97df44 | 374 | * @arg SPDIFRX_IT_OVRIE |
lypinator | 0:bb348c97df44 | 375 | * @arg SPDIFRX_IT_SBLKIE |
lypinator | 0:bb348c97df44 | 376 | * @arg SPDIFRX_IT_SYNCDIE |
lypinator | 0:bb348c97df44 | 377 | * @arg SPDIFRX_IT_IFEIE |
lypinator | 0:bb348c97df44 | 378 | * @retval None |
lypinator | 0:bb348c97df44 | 379 | */ |
lypinator | 0:bb348c97df44 | 380 | #define __HAL_SPDIFRX_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__)) |
lypinator | 0:bb348c97df44 | 381 | #define __HAL_SPDIFRX_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (uint16_t)(~(__INTERRUPT__))) |
lypinator | 0:bb348c97df44 | 382 | |
lypinator | 0:bb348c97df44 | 383 | /** @brief Checks if the specified SPDIFRX interrupt source is enabled or disabled. |
lypinator | 0:bb348c97df44 | 384 | * @param __HANDLE__ specifies the SPDIFRX Handle. |
lypinator | 0:bb348c97df44 | 385 | * @param __INTERRUPT__ specifies the SPDIFRX interrupt source to check. |
lypinator | 0:bb348c97df44 | 386 | * This parameter can be one of the following values: |
lypinator | 0:bb348c97df44 | 387 | * @arg SPDIFRX_IT_RXNE |
lypinator | 0:bb348c97df44 | 388 | * @arg SPDIFRX_IT_CSRNE |
lypinator | 0:bb348c97df44 | 389 | * @arg SPDIFRX_IT_PERRIE |
lypinator | 0:bb348c97df44 | 390 | * @arg SPDIFRX_IT_OVRIE |
lypinator | 0:bb348c97df44 | 391 | * @arg SPDIFRX_IT_SBLKIE |
lypinator | 0:bb348c97df44 | 392 | * @arg SPDIFRX_IT_SYNCDIE |
lypinator | 0:bb348c97df44 | 393 | * @arg SPDIFRX_IT_IFEIE |
lypinator | 0:bb348c97df44 | 394 | * @retval The new state of __IT__ (TRUE or FALSE). |
lypinator | 0:bb348c97df44 | 395 | */ |
lypinator | 0:bb348c97df44 | 396 | #define __HAL_SPDIFRX_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IMR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
lypinator | 0:bb348c97df44 | 397 | |
lypinator | 0:bb348c97df44 | 398 | /** @brief Checks whether the specified SPDIFRX flag is set or not. |
lypinator | 0:bb348c97df44 | 399 | * @param __HANDLE__ specifies the SPDIFRX Handle. |
lypinator | 0:bb348c97df44 | 400 | * @param __FLAG__ specifies the flag to check. |
lypinator | 0:bb348c97df44 | 401 | * This parameter can be one of the following values: |
lypinator | 0:bb348c97df44 | 402 | * @arg SPDIFRX_FLAG_RXNE |
lypinator | 0:bb348c97df44 | 403 | * @arg SPDIFRX_FLAG_CSRNE |
lypinator | 0:bb348c97df44 | 404 | * @arg SPDIFRX_FLAG_PERR |
lypinator | 0:bb348c97df44 | 405 | * @arg SPDIFRX_FLAG_OVR |
lypinator | 0:bb348c97df44 | 406 | * @arg SPDIFRX_FLAG_SBD |
lypinator | 0:bb348c97df44 | 407 | * @arg SPDIFRX_FLAG_SYNCD |
lypinator | 0:bb348c97df44 | 408 | * @arg SPDIFRX_FLAG_FERR |
lypinator | 0:bb348c97df44 | 409 | * @arg SPDIFRX_FLAG_SERR |
lypinator | 0:bb348c97df44 | 410 | * @arg SPDIFRX_FLAG_TERR |
lypinator | 0:bb348c97df44 | 411 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
lypinator | 0:bb348c97df44 | 412 | */ |
lypinator | 0:bb348c97df44 | 413 | #define __HAL_SPDIFRX_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) |
lypinator | 0:bb348c97df44 | 414 | |
lypinator | 0:bb348c97df44 | 415 | /** @brief Clears the specified SPDIFRX SR flag, in setting the proper IFCR register bit. |
lypinator | 0:bb348c97df44 | 416 | * @param __HANDLE__ specifies the USART Handle. |
lypinator | 0:bb348c97df44 | 417 | * @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set |
lypinator | 0:bb348c97df44 | 418 | * to clear the corresponding interrupt |
lypinator | 0:bb348c97df44 | 419 | * This parameter can be one of the following values: |
lypinator | 0:bb348c97df44 | 420 | * @arg SPDIFRX_FLAG_PERR |
lypinator | 0:bb348c97df44 | 421 | * @arg SPDIFRX_FLAG_OVR |
lypinator | 0:bb348c97df44 | 422 | * @arg SPDIFRX_SR_SBD |
lypinator | 0:bb348c97df44 | 423 | * @arg SPDIFRX_SR_SYNCD |
lypinator | 0:bb348c97df44 | 424 | * @retval None |
lypinator | 0:bb348c97df44 | 425 | */ |
lypinator | 0:bb348c97df44 | 426 | #define __HAL_SPDIFRX_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->IFCR = (uint32_t)(__IT_CLEAR__)) |
lypinator | 0:bb348c97df44 | 427 | |
lypinator | 0:bb348c97df44 | 428 | /** |
lypinator | 0:bb348c97df44 | 429 | * @} |
lypinator | 0:bb348c97df44 | 430 | */ |
lypinator | 0:bb348c97df44 | 431 | |
lypinator | 0:bb348c97df44 | 432 | /* Exported functions --------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 433 | /** @addtogroup SPDIFRX_Exported_Functions |
lypinator | 0:bb348c97df44 | 434 | * @{ |
lypinator | 0:bb348c97df44 | 435 | */ |
lypinator | 0:bb348c97df44 | 436 | |
lypinator | 0:bb348c97df44 | 437 | /** @addtogroup SPDIFRX_Exported_Functions_Group1 |
lypinator | 0:bb348c97df44 | 438 | * @{ |
lypinator | 0:bb348c97df44 | 439 | */ |
lypinator | 0:bb348c97df44 | 440 | /* Initialization/de-initialization functions **********************************/ |
lypinator | 0:bb348c97df44 | 441 | HAL_StatusTypeDef HAL_SPDIFRX_Init(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 442 | HAL_StatusTypeDef HAL_SPDIFRX_DeInit (SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 443 | void HAL_SPDIFRX_MspInit(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 444 | void HAL_SPDIFRX_MspDeInit(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 445 | HAL_StatusTypeDef HAL_SPDIFRX_SetDataFormat(SPDIFRX_HandleTypeDef *hspdif, SPDIFRX_SetDataFormatTypeDef sDataFormat); |
lypinator | 0:bb348c97df44 | 446 | /** |
lypinator | 0:bb348c97df44 | 447 | * @} |
lypinator | 0:bb348c97df44 | 448 | */ |
lypinator | 0:bb348c97df44 | 449 | |
lypinator | 0:bb348c97df44 | 450 | /** @addtogroup SPDIFRX_Exported_Functions_Group2 |
lypinator | 0:bb348c97df44 | 451 | * @{ |
lypinator | 0:bb348c97df44 | 452 | */ |
lypinator | 0:bb348c97df44 | 453 | /* I/O operation functions ***************************************************/ |
lypinator | 0:bb348c97df44 | 454 | /* Blocking mode: Polling */ |
lypinator | 0:bb348c97df44 | 455 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size, uint32_t Timeout); |
lypinator | 0:bb348c97df44 | 456 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size, uint32_t Timeout); |
lypinator | 0:bb348c97df44 | 457 | |
lypinator | 0:bb348c97df44 | 458 | /* Non-Blocking mode: Interrupt */ |
lypinator | 0:bb348c97df44 | 459 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow_IT(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size); |
lypinator | 0:bb348c97df44 | 460 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_IT(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size); |
lypinator | 0:bb348c97df44 | 461 | void HAL_SPDIFRX_IRQHandler(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 462 | |
lypinator | 0:bb348c97df44 | 463 | /* Non-Blocking mode: DMA */ |
lypinator | 0:bb348c97df44 | 464 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow_DMA(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size); |
lypinator | 0:bb348c97df44 | 465 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_DMA(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size); |
lypinator | 0:bb348c97df44 | 466 | |
lypinator | 0:bb348c97df44 | 467 | HAL_StatusTypeDef HAL_SPDIFRX_DMAStop(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 468 | |
lypinator | 0:bb348c97df44 | 469 | /* Callbacks used in non blocking modes (Interrupt and DMA) *******************/ |
lypinator | 0:bb348c97df44 | 470 | void HAL_SPDIFRX_RxHalfCpltCallback(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 471 | void HAL_SPDIFRX_RxCpltCallback(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 472 | void HAL_SPDIFRX_ErrorCallback(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 473 | void HAL_SPDIFRX_CxHalfCpltCallback(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 474 | void HAL_SPDIFRX_CxCpltCallback(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 475 | /** |
lypinator | 0:bb348c97df44 | 476 | * @} |
lypinator | 0:bb348c97df44 | 477 | */ |
lypinator | 0:bb348c97df44 | 478 | |
lypinator | 0:bb348c97df44 | 479 | /** @addtogroup SPDIFRX_Exported_Functions_Group3 |
lypinator | 0:bb348c97df44 | 480 | * @{ |
lypinator | 0:bb348c97df44 | 481 | */ |
lypinator | 0:bb348c97df44 | 482 | /* Peripheral Control and State functions ************************************/ |
lypinator | 0:bb348c97df44 | 483 | HAL_SPDIFRX_StateTypeDef HAL_SPDIFRX_GetState(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 484 | uint32_t HAL_SPDIFRX_GetError(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 485 | /** |
lypinator | 0:bb348c97df44 | 486 | * @} |
lypinator | 0:bb348c97df44 | 487 | */ |
lypinator | 0:bb348c97df44 | 488 | |
lypinator | 0:bb348c97df44 | 489 | /** |
lypinator | 0:bb348c97df44 | 490 | * @} |
lypinator | 0:bb348c97df44 | 491 | */ |
lypinator | 0:bb348c97df44 | 492 | /* Private types -------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 493 | /* Private variables ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 494 | /* Private constants ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 495 | /* Private macros ------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 496 | /** @defgroup SPDIFRX_Private_Macros SPDIFRX Private Macros |
lypinator | 0:bb348c97df44 | 497 | * @{ |
lypinator | 0:bb348c97df44 | 498 | */ |
lypinator | 0:bb348c97df44 | 499 | #define IS_SPDIFRX_INPUT_SELECT(INPUT) (((INPUT) == SPDIFRX_INPUT_IN1) || \ |
lypinator | 0:bb348c97df44 | 500 | ((INPUT) == SPDIFRX_INPUT_IN2) || \ |
lypinator | 0:bb348c97df44 | 501 | ((INPUT) == SPDIFRX_INPUT_IN3) || \ |
lypinator | 0:bb348c97df44 | 502 | ((INPUT) == SPDIFRX_INPUT_IN0)) |
lypinator | 0:bb348c97df44 | 503 | #define IS_SPDIFRX_MAX_RETRIES(RET) (((RET) == SPDIFRX_MAXRETRIES_NONE) || \ |
lypinator | 0:bb348c97df44 | 504 | ((RET) == SPDIFRX_MAXRETRIES_3) || \ |
lypinator | 0:bb348c97df44 | 505 | ((RET) == SPDIFRX_MAXRETRIES_15) || \ |
lypinator | 0:bb348c97df44 | 506 | ((RET) == SPDIFRX_MAXRETRIES_63)) |
lypinator | 0:bb348c97df44 | 507 | #define IS_SPDIFRX_WAIT_FOR_ACTIVITY(VAL) (((VAL) == SPDIFRX_WAITFORACTIVITY_ON) || \ |
lypinator | 0:bb348c97df44 | 508 | ((VAL) == SPDIFRX_WAITFORACTIVITY_OFF)) |
lypinator | 0:bb348c97df44 | 509 | #define IS_PREAMBLE_TYPE_MASK(VAL) (((VAL) == SPDIFRX_PREAMBLETYPEMASK_ON) || \ |
lypinator | 0:bb348c97df44 | 510 | ((VAL) == SPDIFRX_PREAMBLETYPEMASK_OFF)) |
lypinator | 0:bb348c97df44 | 511 | #define IS_VALIDITY_MASK(VAL) (((VAL) == SPDIFRX_VALIDITYMASK_OFF) || \ |
lypinator | 0:bb348c97df44 | 512 | ((VAL) == SPDIFRX_VALIDITYMASK_ON)) |
lypinator | 0:bb348c97df44 | 513 | #define IS_PARITY_ERROR_MASK(VAL) (((VAL) == SPDIFRX_PARITYERRORMASK_OFF) || \ |
lypinator | 0:bb348c97df44 | 514 | ((VAL) == SPDIFRX_PARITYERRORMASK_ON)) |
lypinator | 0:bb348c97df44 | 515 | #define IS_SPDIFRX_CHANNEL(CHANNEL) (((CHANNEL) == SPDIFRX_CHANNEL_A) || \ |
lypinator | 0:bb348c97df44 | 516 | ((CHANNEL) == SPDIFRX_CHANNEL_B)) |
lypinator | 0:bb348c97df44 | 517 | #define IS_SPDIFRX_DATA_FORMAT(FORMAT) (((FORMAT) == SPDIFRX_DATAFORMAT_LSB) || \ |
lypinator | 0:bb348c97df44 | 518 | ((FORMAT) == SPDIFRX_DATAFORMAT_MSB) || \ |
lypinator | 0:bb348c97df44 | 519 | ((FORMAT) == SPDIFRX_DATAFORMAT_32BITS)) |
lypinator | 0:bb348c97df44 | 520 | #define IS_STEREO_MODE(MODE) (((MODE) == SPDIFRX_STEREOMODE_DISABLE) || \ |
lypinator | 0:bb348c97df44 | 521 | ((MODE) == SPDIFRX_STEREOMODE_ENABLE)) |
lypinator | 0:bb348c97df44 | 522 | |
lypinator | 0:bb348c97df44 | 523 | #define IS_CHANNEL_STATUS_MASK(VAL) (((VAL) == SPDIFRX_CHANNELSTATUS_ON) || \ |
lypinator | 0:bb348c97df44 | 524 | ((VAL) == SPDIFRX_CHANNELSTATUS_OFF)) |
lypinator | 0:bb348c97df44 | 525 | /** |
lypinator | 0:bb348c97df44 | 526 | * @} |
lypinator | 0:bb348c97df44 | 527 | */ |
lypinator | 0:bb348c97df44 | 528 | |
lypinator | 0:bb348c97df44 | 529 | /* Private functions ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 530 | /** @defgroup SPDIFRX_Private_Functions SPDIFRX Private Functions |
lypinator | 0:bb348c97df44 | 531 | * @{ |
lypinator | 0:bb348c97df44 | 532 | */ |
lypinator | 0:bb348c97df44 | 533 | /** |
lypinator | 0:bb348c97df44 | 534 | * @} |
lypinator | 0:bb348c97df44 | 535 | */ |
lypinator | 0:bb348c97df44 | 536 | |
lypinator | 0:bb348c97df44 | 537 | /** |
lypinator | 0:bb348c97df44 | 538 | * @} |
lypinator | 0:bb348c97df44 | 539 | */ |
lypinator | 0:bb348c97df44 | 540 | |
lypinator | 0:bb348c97df44 | 541 | /** |
lypinator | 0:bb348c97df44 | 542 | * @} |
lypinator | 0:bb348c97df44 | 543 | */ |
lypinator | 0:bb348c97df44 | 544 | #endif /* STM32F446xx */ |
lypinator | 0:bb348c97df44 | 545 | |
lypinator | 0:bb348c97df44 | 546 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 547 | } |
lypinator | 0:bb348c97df44 | 548 | #endif |
lypinator | 0:bb348c97df44 | 549 | |
lypinator | 0:bb348c97df44 | 550 | |
lypinator | 0:bb348c97df44 | 551 | #endif /* __STM32F4xx_HAL_SPDIFRX_H */ |
lypinator | 0:bb348c97df44 | 552 | |
lypinator | 0:bb348c97df44 | 553 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |