Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /**
lypinator 0:bb348c97df44 2 ******************************************************************************
lypinator 0:bb348c97df44 3 * @file stm32f4xx_hal_sai.h
lypinator 0:bb348c97df44 4 * @author MCD Application Team
lypinator 0:bb348c97df44 5 * @brief Header file of SAI HAL module.
lypinator 0:bb348c97df44 6 ******************************************************************************
lypinator 0:bb348c97df44 7 * @attention
lypinator 0:bb348c97df44 8 *
lypinator 0:bb348c97df44 9 * <h2><center>&copy; 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_SAI_H
lypinator 0:bb348c97df44 38 #define __STM32F4xx_HAL_SAI_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 /* Includes ------------------------------------------------------------------*/
lypinator 0:bb348c97df44 45 #include "stm32f4xx_hal_def.h"
lypinator 0:bb348c97df44 46
lypinator 0:bb348c97df44 47 /** @addtogroup STM32F4xx_HAL_Driver
lypinator 0:bb348c97df44 48 * @{
lypinator 0:bb348c97df44 49 */
lypinator 0:bb348c97df44 50 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
lypinator 0:bb348c97df44 51 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || \
lypinator 0:bb348c97df44 52 defined(STM32F423xx)
lypinator 0:bb348c97df44 53
lypinator 0:bb348c97df44 54 /** @addtogroup SAI
lypinator 0:bb348c97df44 55 * @{
lypinator 0:bb348c97df44 56 */
lypinator 0:bb348c97df44 57
lypinator 0:bb348c97df44 58 /* Exported types ------------------------------------------------------------*/
lypinator 0:bb348c97df44 59 /** @defgroup SAI_Exported_Types SAI Exported Types
lypinator 0:bb348c97df44 60 * @{
lypinator 0:bb348c97df44 61 */
lypinator 0:bb348c97df44 62
lypinator 0:bb348c97df44 63 /**
lypinator 0:bb348c97df44 64 * @brief HAL State structures definition
lypinator 0:bb348c97df44 65 */
lypinator 0:bb348c97df44 66 typedef enum
lypinator 0:bb348c97df44 67 {
lypinator 0:bb348c97df44 68 HAL_SAI_STATE_RESET = 0x00U, /*!< SAI not yet initialized or disabled */
lypinator 0:bb348c97df44 69 HAL_SAI_STATE_READY = 0x01U, /*!< SAI initialized and ready for use */
lypinator 0:bb348c97df44 70 HAL_SAI_STATE_BUSY = 0x02U, /*!< SAI internal process is ongoing */
lypinator 0:bb348c97df44 71 HAL_SAI_STATE_BUSY_TX = 0x12U, /*!< Data transmission process is ongoing */
lypinator 0:bb348c97df44 72 HAL_SAI_STATE_BUSY_RX = 0x22U, /*!< Data reception process is ongoing */
lypinator 0:bb348c97df44 73 HAL_SAI_STATE_TIMEOUT = 0x03U, /*!< SAI timeout state */
lypinator 0:bb348c97df44 74 HAL_SAI_STATE_ERROR = 0x04U /*!< SAI error state */
lypinator 0:bb348c97df44 75 }HAL_SAI_StateTypeDef;
lypinator 0:bb348c97df44 76
lypinator 0:bb348c97df44 77 /**
lypinator 0:bb348c97df44 78 * @brief SAI Callback prototype
lypinator 0:bb348c97df44 79 */
lypinator 0:bb348c97df44 80 typedef void (*SAIcallback)(void);
lypinator 0:bb348c97df44 81
lypinator 0:bb348c97df44 82 /** @defgroup SAI_Init_Structure_definition SAI Init Structure definition
lypinator 0:bb348c97df44 83 * @brief SAI Init Structure definition
lypinator 0:bb348c97df44 84 * @{
lypinator 0:bb348c97df44 85 */
lypinator 0:bb348c97df44 86 typedef struct
lypinator 0:bb348c97df44 87 {
lypinator 0:bb348c97df44 88 uint32_t AudioMode; /*!< Specifies the SAI Block audio Mode.
lypinator 0:bb348c97df44 89 This parameter can be a value of @ref SAI_Block_Mode */
lypinator 0:bb348c97df44 90
lypinator 0:bb348c97df44 91 uint32_t Synchro; /*!< Specifies SAI Block synchronization
lypinator 0:bb348c97df44 92 This parameter can be a value of @ref SAI_Block_Synchronization */
lypinator 0:bb348c97df44 93
lypinator 0:bb348c97df44 94 uint32_t SynchroExt; /*!< Specifies SAI external output synchronization, this setup is common
lypinator 0:bb348c97df44 95 for BlockA and BlockB
lypinator 0:bb348c97df44 96 This parameter can be a value of @ref SAI_Block_SyncExt
lypinator 0:bb348c97df44 97 @note: If both audio blocks of same SAI are used, this parameter has
lypinator 0:bb348c97df44 98 to be set to the same value for each audio block */
lypinator 0:bb348c97df44 99
lypinator 0:bb348c97df44 100 uint32_t OutputDrive; /*!< Specifies when SAI Block outputs are driven.
lypinator 0:bb348c97df44 101 This parameter can be a value of @ref SAI_Block_Output_Drive
lypinator 0:bb348c97df44 102 @note this value has to be set before enabling the audio block
lypinator 0:bb348c97df44 103 but after the audio block configuration. */
lypinator 0:bb348c97df44 104
lypinator 0:bb348c97df44 105 uint32_t NoDivider; /*!< Specifies whether master clock will be divided or not.
lypinator 0:bb348c97df44 106 This parameter can be a value of @ref SAI_Block_NoDivider
lypinator 0:bb348c97df44 107 @note If bit NODIV in the SAI_xCR1 register is cleared, the frame length
lypinator 0:bb348c97df44 108 should be aligned to a number equal to a power of 2, from 8 to 256.
lypinator 0:bb348c97df44 109 If bit NODIV in the SAI_xCR1 register is set, the frame length can
lypinator 0:bb348c97df44 110 take any of the values without constraint since the input clock of
lypinator 0:bb348c97df44 111 the audio block should be equal to the bit clock.
lypinator 0:bb348c97df44 112 There is no MCLK_x clock which can be output. */
lypinator 0:bb348c97df44 113
lypinator 0:bb348c97df44 114 uint32_t FIFOThreshold; /*!< Specifies SAI Block FIFO threshold.
lypinator 0:bb348c97df44 115 This parameter can be a value of @ref SAI_Block_Fifo_Threshold */
lypinator 0:bb348c97df44 116
lypinator 0:bb348c97df44 117 uint32_t ClockSource; /*!< Specifies the SAI Block x Clock source.
lypinator 0:bb348c97df44 118 This parameter is not used for STM32F446xx devices. */
lypinator 0:bb348c97df44 119
lypinator 0:bb348c97df44 120 uint32_t AudioFrequency; /*!< Specifies the audio frequency sampling.
lypinator 0:bb348c97df44 121 This parameter can be a value of @ref SAI_Audio_Frequency */
lypinator 0:bb348c97df44 122
lypinator 0:bb348c97df44 123 uint32_t Mckdiv; /*!< Specifies the master clock divider, the parameter will be used if for
lypinator 0:bb348c97df44 124 AudioFrequency the user choice
lypinator 0:bb348c97df44 125 This parameter must be a number between Min_Data = 0 and Max_Data = 15 */
lypinator 0:bb348c97df44 126
lypinator 0:bb348c97df44 127 uint32_t MonoStereoMode; /*!< Specifies if the mono or stereo mode is selected.
lypinator 0:bb348c97df44 128 This parameter can be a value of @ref SAI_Mono_Stereo_Mode */
lypinator 0:bb348c97df44 129
lypinator 0:bb348c97df44 130 uint32_t CompandingMode; /*!< Specifies the companding mode type.
lypinator 0:bb348c97df44 131 This parameter can be a value of @ref SAI_Block_Companding_Mode */
lypinator 0:bb348c97df44 132
lypinator 0:bb348c97df44 133 uint32_t TriState; /*!< Specifies the companding mode type.
lypinator 0:bb348c97df44 134 This parameter can be a value of @ref SAI_TRIState_Management */
lypinator 0:bb348c97df44 135
lypinator 0:bb348c97df44 136 /* This part of the structure is automatically filled if your are using the high level intialisation
lypinator 0:bb348c97df44 137 function HAL_SAI_InitProtocol */
lypinator 0:bb348c97df44 138
lypinator 0:bb348c97df44 139 uint32_t Protocol; /*!< Specifies the SAI Block protocol.
lypinator 0:bb348c97df44 140 This parameter can be a value of @ref SAI_Block_Protocol */
lypinator 0:bb348c97df44 141
lypinator 0:bb348c97df44 142 uint32_t DataSize; /*!< Specifies the SAI Block data size.
lypinator 0:bb348c97df44 143 This parameter can be a value of @ref SAI_Block_Data_Size */
lypinator 0:bb348c97df44 144
lypinator 0:bb348c97df44 145 uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
lypinator 0:bb348c97df44 146 This parameter can be a value of @ref SAI_Block_MSB_LSB_transmission */
lypinator 0:bb348c97df44 147
lypinator 0:bb348c97df44 148 uint32_t ClockStrobing; /*!< Specifies the SAI Block clock strobing edge sensitivity.
lypinator 0:bb348c97df44 149 This parameter can be a value of @ref SAI_Block_Clock_Strobing */
lypinator 0:bb348c97df44 150 }SAI_InitTypeDef;
lypinator 0:bb348c97df44 151 /**
lypinator 0:bb348c97df44 152 * @}
lypinator 0:bb348c97df44 153 */
lypinator 0:bb348c97df44 154
lypinator 0:bb348c97df44 155 /** @defgroup SAI_Frame_Structure_definition SAI Frame Structure definition
lypinator 0:bb348c97df44 156 * @brief SAI Frame Init structure definition
lypinator 0:bb348c97df44 157 * @{
lypinator 0:bb348c97df44 158 */
lypinator 0:bb348c97df44 159 typedef struct
lypinator 0:bb348c97df44 160 {
lypinator 0:bb348c97df44 161 uint32_t FrameLength; /*!< Specifies the Frame length, the number of SCK clocks for each audio frame.
lypinator 0:bb348c97df44 162 This parameter must be a number between Min_Data = 8 and Max_Data = 256.
lypinator 0:bb348c97df44 163 @note If master clock MCLK_x pin is declared as an output, the frame length
lypinator 0:bb348c97df44 164 should be aligned to a number equal to power of 2 in order to keep
lypinator 0:bb348c97df44 165 in an audio frame, an integer number of MCLK pulses by bit Clock. */
lypinator 0:bb348c97df44 166
lypinator 0:bb348c97df44 167 uint32_t ActiveFrameLength; /*!< Specifies the Frame synchronization active level length.
lypinator 0:bb348c97df44 168 This Parameter specifies the length in number of bit clock (SCK + 1)
lypinator 0:bb348c97df44 169 of the active level of FS signal in audio frame.
lypinator 0:bb348c97df44 170 This parameter must be a number between Min_Data = 1 and Max_Data = 128 */
lypinator 0:bb348c97df44 171
lypinator 0:bb348c97df44 172 uint32_t FSDefinition; /*!< Specifies the Frame synchronization definition.
lypinator 0:bb348c97df44 173 This parameter can be a value of @ref SAI_Block_FS_Definition */
lypinator 0:bb348c97df44 174
lypinator 0:bb348c97df44 175 uint32_t FSPolarity; /*!< Specifies the Frame synchronization Polarity.
lypinator 0:bb348c97df44 176 This parameter can be a value of @ref SAI_Block_FS_Polarity */
lypinator 0:bb348c97df44 177
lypinator 0:bb348c97df44 178 uint32_t FSOffset; /*!< Specifies the Frame synchronization Offset.
lypinator 0:bb348c97df44 179 This parameter can be a value of @ref SAI_Block_FS_Offset */
lypinator 0:bb348c97df44 180 }SAI_FrameInitTypeDef;
lypinator 0:bb348c97df44 181 /**
lypinator 0:bb348c97df44 182 * @}
lypinator 0:bb348c97df44 183 */
lypinator 0:bb348c97df44 184
lypinator 0:bb348c97df44 185 /** @defgroup SAI_Slot_Structure_definition SAI Slot Structure definition
lypinator 0:bb348c97df44 186 * @brief SAI Block Slot Init Structure definition
lypinator 0:bb348c97df44 187 * @{
lypinator 0:bb348c97df44 188 */
lypinator 0:bb348c97df44 189 typedef struct
lypinator 0:bb348c97df44 190 {
lypinator 0:bb348c97df44 191 uint32_t FirstBitOffset; /*!< Specifies the position of first data transfer bit in the slot.
lypinator 0:bb348c97df44 192 This parameter must be a number between Min_Data = 0 and Max_Data = 24 */
lypinator 0:bb348c97df44 193
lypinator 0:bb348c97df44 194 uint32_t SlotSize; /*!< Specifies the Slot Size.
lypinator 0:bb348c97df44 195 This parameter can be a value of @ref SAI_Block_Slot_Size */
lypinator 0:bb348c97df44 196
lypinator 0:bb348c97df44 197 uint32_t SlotNumber; /*!< Specifies the number of slot in the audio frame.
lypinator 0:bb348c97df44 198 This parameter must be a number between Min_Data = 1 and Max_Data = 16 */
lypinator 0:bb348c97df44 199
lypinator 0:bb348c97df44 200 uint32_t SlotActive; /*!< Specifies the slots in audio frame that will be activated.
lypinator 0:bb348c97df44 201 This parameter can be a value of @ref SAI_Block_Slot_Active */
lypinator 0:bb348c97df44 202 }SAI_SlotInitTypeDef;
lypinator 0:bb348c97df44 203
lypinator 0:bb348c97df44 204 /**
lypinator 0:bb348c97df44 205 * @}
lypinator 0:bb348c97df44 206 */
lypinator 0:bb348c97df44 207
lypinator 0:bb348c97df44 208 /** @defgroup SAI_Handle_Structure_definition SAI Handle Structure definition
lypinator 0:bb348c97df44 209 * @brief SAI handle Structure definition
lypinator 0:bb348c97df44 210 * @{
lypinator 0:bb348c97df44 211 */
lypinator 0:bb348c97df44 212 typedef struct __SAI_HandleTypeDef
lypinator 0:bb348c97df44 213 {
lypinator 0:bb348c97df44 214 SAI_Block_TypeDef *Instance; /*!< SAI Blockx registers base address */
lypinator 0:bb348c97df44 215
lypinator 0:bb348c97df44 216 SAI_InitTypeDef Init; /*!< SAI communication parameters */
lypinator 0:bb348c97df44 217
lypinator 0:bb348c97df44 218 SAI_FrameInitTypeDef FrameInit; /*!< SAI Frame configuration parameters */
lypinator 0:bb348c97df44 219
lypinator 0:bb348c97df44 220 SAI_SlotInitTypeDef SlotInit; /*!< SAI Slot configuration parameters */
lypinator 0:bb348c97df44 221
lypinator 0:bb348c97df44 222 uint8_t *pBuffPtr; /*!< Pointer to SAI transfer Buffer */
lypinator 0:bb348c97df44 223
lypinator 0:bb348c97df44 224 uint16_t XferSize; /*!< SAI transfer size */
lypinator 0:bb348c97df44 225
lypinator 0:bb348c97df44 226 uint16_t XferCount; /*!< SAI transfer counter */
lypinator 0:bb348c97df44 227
lypinator 0:bb348c97df44 228 DMA_HandleTypeDef *hdmatx; /*!< SAI Tx DMA handle parameters */
lypinator 0:bb348c97df44 229
lypinator 0:bb348c97df44 230 DMA_HandleTypeDef *hdmarx; /*!< SAI Rx DMA handle parameters */
lypinator 0:bb348c97df44 231
lypinator 0:bb348c97df44 232 SAIcallback mutecallback;/*!< SAI mute callback */
lypinator 0:bb348c97df44 233
lypinator 0:bb348c97df44 234 void (*InterruptServiceRoutine)(struct __SAI_HandleTypeDef *hsai); /* function pointer for IRQ handler */
lypinator 0:bb348c97df44 235
lypinator 0:bb348c97df44 236 HAL_LockTypeDef Lock; /*!< SAI locking object */
lypinator 0:bb348c97df44 237
lypinator 0:bb348c97df44 238 __IO HAL_SAI_StateTypeDef State; /*!< SAI communication state */
lypinator 0:bb348c97df44 239
lypinator 0:bb348c97df44 240 __IO uint32_t ErrorCode; /*!< SAI Error code */
lypinator 0:bb348c97df44 241 }SAI_HandleTypeDef;
lypinator 0:bb348c97df44 242 /**
lypinator 0:bb348c97df44 243 * @}
lypinator 0:bb348c97df44 244 */
lypinator 0:bb348c97df44 245
lypinator 0:bb348c97df44 246 /**
lypinator 0:bb348c97df44 247 * @}
lypinator 0:bb348c97df44 248 */
lypinator 0:bb348c97df44 249
lypinator 0:bb348c97df44 250 /* Exported constants --------------------------------------------------------*/
lypinator 0:bb348c97df44 251
lypinator 0:bb348c97df44 252 /** @defgroup SAI_Exported_Constants SAI Exported Constants
lypinator 0:bb348c97df44 253 * @{
lypinator 0:bb348c97df44 254 */
lypinator 0:bb348c97df44 255
lypinator 0:bb348c97df44 256 /** @defgroup SAI_Error_Code SAI Error Code
lypinator 0:bb348c97df44 257 * @{
lypinator 0:bb348c97df44 258 */
lypinator 0:bb348c97df44 259 #define HAL_SAI_ERROR_NONE 0x00000000U /*!< No error */
lypinator 0:bb348c97df44 260 #define HAL_SAI_ERROR_OVR 0x00000001U /*!< Overrun Error */
lypinator 0:bb348c97df44 261 #define HAL_SAI_ERROR_UDR 0x00000002U /*!< Underrun error */
lypinator 0:bb348c97df44 262 #define HAL_SAI_ERROR_AFSDET 0x00000004U /*!< Anticipated Frame synchronisation detection */
lypinator 0:bb348c97df44 263 #define HAL_SAI_ERROR_LFSDET 0x00000008U /*!< Late Frame synchronisation detection */
lypinator 0:bb348c97df44 264 #define HAL_SAI_ERROR_CNREADY 0x00000010U /*!< codec not ready */
lypinator 0:bb348c97df44 265 #define HAL_SAI_ERROR_WCKCFG 0x00000020U /*!< Wrong clock configuration */
lypinator 0:bb348c97df44 266 #define HAL_SAI_ERROR_TIMEOUT 0x00000040U /*!< Timeout error */
lypinator 0:bb348c97df44 267 #define HAL_SAI_ERROR_DMA 0x00000080U /*!< DMA error */
lypinator 0:bb348c97df44 268 /**
lypinator 0:bb348c97df44 269 * @}
lypinator 0:bb348c97df44 270 */
lypinator 0:bb348c97df44 271
lypinator 0:bb348c97df44 272 /** @defgroup SAI_Block_SyncExt SAI External synchronisation
lypinator 0:bb348c97df44 273 * @{
lypinator 0:bb348c97df44 274 */
lypinator 0:bb348c97df44 275 #define SAI_SYNCEXT_DISABLE 0U
lypinator 0:bb348c97df44 276 #define SAI_SYNCEXT_OUTBLOCKA_ENABLE 1U
lypinator 0:bb348c97df44 277 #define SAI_SYNCEXT_OUTBLOCKB_ENABLE 2U
lypinator 0:bb348c97df44 278 /**
lypinator 0:bb348c97df44 279 * @}
lypinator 0:bb348c97df44 280 */
lypinator 0:bb348c97df44 281
lypinator 0:bb348c97df44 282 /** @defgroup SAI_Protocol SAI Supported protocol
lypinator 0:bb348c97df44 283 * @{
lypinator 0:bb348c97df44 284 */
lypinator 0:bb348c97df44 285 #define SAI_I2S_STANDARD 0U
lypinator 0:bb348c97df44 286 #define SAI_I2S_MSBJUSTIFIED 1U
lypinator 0:bb348c97df44 287 #define SAI_I2S_LSBJUSTIFIED 2U
lypinator 0:bb348c97df44 288 #define SAI_PCM_LONG 3U
lypinator 0:bb348c97df44 289 #define SAI_PCM_SHORT 4U
lypinator 0:bb348c97df44 290 /**
lypinator 0:bb348c97df44 291 * @}
lypinator 0:bb348c97df44 292 */
lypinator 0:bb348c97df44 293
lypinator 0:bb348c97df44 294 /** @defgroup SAI_Protocol_DataSize SAI protocol data size
lypinator 0:bb348c97df44 295 * @{
lypinator 0:bb348c97df44 296 */
lypinator 0:bb348c97df44 297 #define SAI_PROTOCOL_DATASIZE_16BIT 0U
lypinator 0:bb348c97df44 298 #define SAI_PROTOCOL_DATASIZE_16BITEXTENDED 1U
lypinator 0:bb348c97df44 299 #define SAI_PROTOCOL_DATASIZE_24BIT 2U
lypinator 0:bb348c97df44 300 #define SAI_PROTOCOL_DATASIZE_32BIT 3U
lypinator 0:bb348c97df44 301 /**
lypinator 0:bb348c97df44 302 * @}
lypinator 0:bb348c97df44 303 */
lypinator 0:bb348c97df44 304
lypinator 0:bb348c97df44 305 /** @defgroup SAI_Audio_Frequency SAI Audio Frequency
lypinator 0:bb348c97df44 306 * @{
lypinator 0:bb348c97df44 307 */
lypinator 0:bb348c97df44 308 #define SAI_AUDIO_FREQUENCY_192K 192000U
lypinator 0:bb348c97df44 309 #define SAI_AUDIO_FREQUENCY_96K 96000U
lypinator 0:bb348c97df44 310 #define SAI_AUDIO_FREQUENCY_48K 48000U
lypinator 0:bb348c97df44 311 #define SAI_AUDIO_FREQUENCY_44K 44100U
lypinator 0:bb348c97df44 312 #define SAI_AUDIO_FREQUENCY_32K 32000U
lypinator 0:bb348c97df44 313 #define SAI_AUDIO_FREQUENCY_22K 22050U
lypinator 0:bb348c97df44 314 #define SAI_AUDIO_FREQUENCY_16K 16000U
lypinator 0:bb348c97df44 315 #define SAI_AUDIO_FREQUENCY_11K 11025U
lypinator 0:bb348c97df44 316 #define SAI_AUDIO_FREQUENCY_8K 8000U
lypinator 0:bb348c97df44 317 #define SAI_AUDIO_FREQUENCY_MCKDIV 0U
lypinator 0:bb348c97df44 318 /**
lypinator 0:bb348c97df44 319 * @}
lypinator 0:bb348c97df44 320 */
lypinator 0:bb348c97df44 321
lypinator 0:bb348c97df44 322 /** @defgroup SAI_Block_Mode SAI Block Mode
lypinator 0:bb348c97df44 323 * @{
lypinator 0:bb348c97df44 324 */
lypinator 0:bb348c97df44 325 #define SAI_MODEMASTER_TX 0x00000000U
lypinator 0:bb348c97df44 326 #define SAI_MODEMASTER_RX ((uint32_t)SAI_xCR1_MODE_0)
lypinator 0:bb348c97df44 327 #define SAI_MODESLAVE_TX ((uint32_t)SAI_xCR1_MODE_1)
lypinator 0:bb348c97df44 328 #define SAI_MODESLAVE_RX ((uint32_t)(SAI_xCR1_MODE_1 | SAI_xCR1_MODE_0))
lypinator 0:bb348c97df44 329 /**
lypinator 0:bb348c97df44 330 * @}
lypinator 0:bb348c97df44 331 */
lypinator 0:bb348c97df44 332
lypinator 0:bb348c97df44 333 /** @defgroup SAI_Block_Protocol SAI Block Protocol
lypinator 0:bb348c97df44 334 * @{
lypinator 0:bb348c97df44 335 */
lypinator 0:bb348c97df44 336 #define SAI_FREE_PROTOCOL 0x00000000U
lypinator 0:bb348c97df44 337 #define SAI_SPDIF_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_0)
lypinator 0:bb348c97df44 338 #define SAI_AC97_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_1)
lypinator 0:bb348c97df44 339 /**
lypinator 0:bb348c97df44 340 * @}
lypinator 0:bb348c97df44 341 */
lypinator 0:bb348c97df44 342
lypinator 0:bb348c97df44 343 /** @defgroup SAI_Block_Data_Size SAI Block Data Size
lypinator 0:bb348c97df44 344 * @{
lypinator 0:bb348c97df44 345 */
lypinator 0:bb348c97df44 346 #define SAI_DATASIZE_8 ((uint32_t)SAI_xCR1_DS_1)
lypinator 0:bb348c97df44 347 #define SAI_DATASIZE_10 ((uint32_t)(SAI_xCR1_DS_1 | SAI_xCR1_DS_0))
lypinator 0:bb348c97df44 348 #define SAI_DATASIZE_16 ((uint32_t)SAI_xCR1_DS_2)
lypinator 0:bb348c97df44 349 #define SAI_DATASIZE_20 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_0))
lypinator 0:bb348c97df44 350 #define SAI_DATASIZE_24 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1))
lypinator 0:bb348c97df44 351 #define SAI_DATASIZE_32 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1 | SAI_xCR1_DS_0))
lypinator 0:bb348c97df44 352 /**
lypinator 0:bb348c97df44 353 * @}
lypinator 0:bb348c97df44 354 */
lypinator 0:bb348c97df44 355
lypinator 0:bb348c97df44 356 /** @defgroup SAI_Block_MSB_LSB_transmission SAI Block MSB LSB transmission
lypinator 0:bb348c97df44 357 * @{
lypinator 0:bb348c97df44 358 */
lypinator 0:bb348c97df44 359 #define SAI_FIRSTBIT_MSB 0x00000000U
lypinator 0:bb348c97df44 360 #define SAI_FIRSTBIT_LSB ((uint32_t)SAI_xCR1_LSBFIRST)
lypinator 0:bb348c97df44 361 /**
lypinator 0:bb348c97df44 362 * @}
lypinator 0:bb348c97df44 363 */
lypinator 0:bb348c97df44 364
lypinator 0:bb348c97df44 365 /** @defgroup SAI_Block_Clock_Strobing SAI Block Clock Strobing
lypinator 0:bb348c97df44 366 * @{
lypinator 0:bb348c97df44 367 */
lypinator 0:bb348c97df44 368 #define SAI_CLOCKSTROBING_FALLINGEDGE 0U
lypinator 0:bb348c97df44 369 #define SAI_CLOCKSTROBING_RISINGEDGE 1U
lypinator 0:bb348c97df44 370 /**
lypinator 0:bb348c97df44 371 * @}
lypinator 0:bb348c97df44 372 */
lypinator 0:bb348c97df44 373
lypinator 0:bb348c97df44 374 /** @defgroup SAI_Block_Synchronization SAI Block Synchronization
lypinator 0:bb348c97df44 375 * @{
lypinator 0:bb348c97df44 376 */
lypinator 0:bb348c97df44 377 #define SAI_ASYNCHRONOUS 0U /*!< Asynchronous */
lypinator 0:bb348c97df44 378 #define SAI_SYNCHRONOUS 1U /*!< Synchronous with other block of same SAI */
lypinator 0:bb348c97df44 379 #define SAI_SYNCHRONOUS_EXT_SAI1 2U /*!< Synchronous with other SAI, SAI1 */
lypinator 0:bb348c97df44 380 #define SAI_SYNCHRONOUS_EXT_SAI2 3U /*!< Synchronous with other SAI, SAI2 */
lypinator 0:bb348c97df44 381 /**
lypinator 0:bb348c97df44 382 * @}
lypinator 0:bb348c97df44 383 */
lypinator 0:bb348c97df44 384
lypinator 0:bb348c97df44 385 /** @defgroup SAI_Block_Output_Drive SAI Block Output Drive
lypinator 0:bb348c97df44 386 * @{
lypinator 0:bb348c97df44 387 */
lypinator 0:bb348c97df44 388 #define SAI_OUTPUTDRIVE_DISABLE 0x00000000U
lypinator 0:bb348c97df44 389 #define SAI_OUTPUTDRIVE_ENABLE ((uint32_t)SAI_xCR1_OUTDRIV)
lypinator 0:bb348c97df44 390 /**
lypinator 0:bb348c97df44 391 * @}
lypinator 0:bb348c97df44 392 */
lypinator 0:bb348c97df44 393
lypinator 0:bb348c97df44 394 /** @defgroup SAI_Block_NoDivider SAI Block NoDivider
lypinator 0:bb348c97df44 395 * @{
lypinator 0:bb348c97df44 396 */
lypinator 0:bb348c97df44 397 #define SAI_MASTERDIVIDER_ENABLE 0x00000000U
lypinator 0:bb348c97df44 398 #define SAI_MASTERDIVIDER_DISABLE ((uint32_t)SAI_xCR1_NODIV)
lypinator 0:bb348c97df44 399 /**
lypinator 0:bb348c97df44 400 * @}
lypinator 0:bb348c97df44 401 */
lypinator 0:bb348c97df44 402
lypinator 0:bb348c97df44 403 /** @defgroup SAI_Block_FS_Definition SAI Block FS Definition
lypinator 0:bb348c97df44 404 * @{
lypinator 0:bb348c97df44 405 */
lypinator 0:bb348c97df44 406 #define SAI_FS_STARTFRAME 0x00000000U
lypinator 0:bb348c97df44 407 #define SAI_FS_CHANNEL_IDENTIFICATION ((uint32_t)SAI_xFRCR_FSDEF)
lypinator 0:bb348c97df44 408 /**
lypinator 0:bb348c97df44 409 * @}
lypinator 0:bb348c97df44 410 */
lypinator 0:bb348c97df44 411
lypinator 0:bb348c97df44 412 /** @defgroup SAI_Block_FS_Polarity SAI Block FS Polarity
lypinator 0:bb348c97df44 413 * @{
lypinator 0:bb348c97df44 414 */
lypinator 0:bb348c97df44 415 #define SAI_FS_ACTIVE_LOW 0x00000000U
lypinator 0:bb348c97df44 416 #define SAI_FS_ACTIVE_HIGH ((uint32_t)SAI_xFRCR_FSPOL)
lypinator 0:bb348c97df44 417 /**
lypinator 0:bb348c97df44 418 * @}
lypinator 0:bb348c97df44 419 */
lypinator 0:bb348c97df44 420
lypinator 0:bb348c97df44 421 /** @defgroup SAI_Block_FS_Offset SAI Block FS Offset
lypinator 0:bb348c97df44 422 * @{
lypinator 0:bb348c97df44 423 */
lypinator 0:bb348c97df44 424 #define SAI_FS_FIRSTBIT 0x00000000U
lypinator 0:bb348c97df44 425 #define SAI_FS_BEFOREFIRSTBIT ((uint32_t)SAI_xFRCR_FSOFF)
lypinator 0:bb348c97df44 426 /**
lypinator 0:bb348c97df44 427 * @}
lypinator 0:bb348c97df44 428 */
lypinator 0:bb348c97df44 429
lypinator 0:bb348c97df44 430 /** @defgroup SAI_Block_Slot_Size SAI Block Slot Size
lypinator 0:bb348c97df44 431 * @{
lypinator 0:bb348c97df44 432 */
lypinator 0:bb348c97df44 433 #define SAI_SLOTSIZE_DATASIZE 0x00000000U
lypinator 0:bb348c97df44 434 #define SAI_SLOTSIZE_16B ((uint32_t)SAI_xSLOTR_SLOTSZ_0)
lypinator 0:bb348c97df44 435 #define SAI_SLOTSIZE_32B ((uint32_t)SAI_xSLOTR_SLOTSZ_1)
lypinator 0:bb348c97df44 436 /**
lypinator 0:bb348c97df44 437 * @}
lypinator 0:bb348c97df44 438 */
lypinator 0:bb348c97df44 439
lypinator 0:bb348c97df44 440 /** @defgroup SAI_Block_Slot_Active SAI Block Slot Active
lypinator 0:bb348c97df44 441 * @{
lypinator 0:bb348c97df44 442 */
lypinator 0:bb348c97df44 443 #define SAI_SLOT_NOTACTIVE 0x00000000U
lypinator 0:bb348c97df44 444 #define SAI_SLOTACTIVE_0 0x00000001U
lypinator 0:bb348c97df44 445 #define SAI_SLOTACTIVE_1 0x00000002U
lypinator 0:bb348c97df44 446 #define SAI_SLOTACTIVE_2 0x00000004U
lypinator 0:bb348c97df44 447 #define SAI_SLOTACTIVE_3 0x00000008U
lypinator 0:bb348c97df44 448 #define SAI_SLOTACTIVE_4 0x00000010U
lypinator 0:bb348c97df44 449 #define SAI_SLOTACTIVE_5 0x00000020U
lypinator 0:bb348c97df44 450 #define SAI_SLOTACTIVE_6 0x00000040U
lypinator 0:bb348c97df44 451 #define SAI_SLOTACTIVE_7 0x00000080U
lypinator 0:bb348c97df44 452 #define SAI_SLOTACTIVE_8 0x00000100U
lypinator 0:bb348c97df44 453 #define SAI_SLOTACTIVE_9 0x00000200U
lypinator 0:bb348c97df44 454 #define SAI_SLOTACTIVE_10 0x00000400U
lypinator 0:bb348c97df44 455 #define SAI_SLOTACTIVE_11 0x00000800U
lypinator 0:bb348c97df44 456 #define SAI_SLOTACTIVE_12 0x00001000U
lypinator 0:bb348c97df44 457 #define SAI_SLOTACTIVE_13 0x00002000U
lypinator 0:bb348c97df44 458 #define SAI_SLOTACTIVE_14 0x00004000U
lypinator 0:bb348c97df44 459 #define SAI_SLOTACTIVE_15 0x00008000U
lypinator 0:bb348c97df44 460 #define SAI_SLOTACTIVE_ALL 0x0000FFFFU
lypinator 0:bb348c97df44 461 /**
lypinator 0:bb348c97df44 462 * @}
lypinator 0:bb348c97df44 463 */
lypinator 0:bb348c97df44 464
lypinator 0:bb348c97df44 465 /** @defgroup SAI_Mono_Stereo_Mode SAI Mono Stereo Mode
lypinator 0:bb348c97df44 466 * @{
lypinator 0:bb348c97df44 467 */
lypinator 0:bb348c97df44 468 #define SAI_STEREOMODE 0x00000000U
lypinator 0:bb348c97df44 469 #define SAI_MONOMODE ((uint32_t)SAI_xCR1_MONO)
lypinator 0:bb348c97df44 470 /**
lypinator 0:bb348c97df44 471 * @}
lypinator 0:bb348c97df44 472 */
lypinator 0:bb348c97df44 473
lypinator 0:bb348c97df44 474 /** @defgroup SAI_TRIState_Management SAI TRIState Management
lypinator 0:bb348c97df44 475 * @{
lypinator 0:bb348c97df44 476 */
lypinator 0:bb348c97df44 477 #define SAI_OUTPUT_NOTRELEASED 0x00000000U
lypinator 0:bb348c97df44 478 #define SAI_OUTPUT_RELEASED ((uint32_t)SAI_xCR2_TRIS)
lypinator 0:bb348c97df44 479 /**
lypinator 0:bb348c97df44 480 * @}
lypinator 0:bb348c97df44 481 */
lypinator 0:bb348c97df44 482
lypinator 0:bb348c97df44 483 /** @defgroup SAI_Block_Fifo_Threshold SAI Block Fifo Threshold
lypinator 0:bb348c97df44 484 * @{
lypinator 0:bb348c97df44 485 */
lypinator 0:bb348c97df44 486 #define SAI_FIFOTHRESHOLD_EMPTY 0x00000000U
lypinator 0:bb348c97df44 487 #define SAI_FIFOTHRESHOLD_1QF ((uint32_t)(SAI_xCR2_FTH_0))
lypinator 0:bb348c97df44 488 #define SAI_FIFOTHRESHOLD_HF ((uint32_t)(SAI_xCR2_FTH_1))
lypinator 0:bb348c97df44 489 #define SAI_FIFOTHRESHOLD_3QF ((uint32_t)(SAI_xCR2_FTH_1 | SAI_xCR2_FTH_0))
lypinator 0:bb348c97df44 490 #define SAI_FIFOTHRESHOLD_FULL ((uint32_t)(SAI_xCR2_FTH_2))
lypinator 0:bb348c97df44 491 /**
lypinator 0:bb348c97df44 492 * @}
lypinator 0:bb348c97df44 493 */
lypinator 0:bb348c97df44 494
lypinator 0:bb348c97df44 495 /** @defgroup SAI_Block_Companding_Mode SAI Block Companding Mode
lypinator 0:bb348c97df44 496 * @{
lypinator 0:bb348c97df44 497 */
lypinator 0:bb348c97df44 498 #define SAI_NOCOMPANDING 0x00000000U
lypinator 0:bb348c97df44 499 #define SAI_ULAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1))
lypinator 0:bb348c97df44 500 #define SAI_ALAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0))
lypinator 0:bb348c97df44 501 #define SAI_ULAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_CPL))
lypinator 0:bb348c97df44 502 #define SAI_ALAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0 | SAI_xCR2_CPL))
lypinator 0:bb348c97df44 503 /**
lypinator 0:bb348c97df44 504 * @}
lypinator 0:bb348c97df44 505 */
lypinator 0:bb348c97df44 506
lypinator 0:bb348c97df44 507 /** @defgroup SAI_Block_Mute_Value SAI Block Mute Value
lypinator 0:bb348c97df44 508 * @{
lypinator 0:bb348c97df44 509 */
lypinator 0:bb348c97df44 510 #define SAI_ZERO_VALUE 0x00000000U
lypinator 0:bb348c97df44 511 #define SAI_LAST_SENT_VALUE ((uint32_t)SAI_xCR2_MUTEVAL)
lypinator 0:bb348c97df44 512 /**
lypinator 0:bb348c97df44 513 * @}
lypinator 0:bb348c97df44 514 */
lypinator 0:bb348c97df44 515
lypinator 0:bb348c97df44 516 /** @defgroup SAI_Block_Interrupts_Definition SAI Block Interrupts Definition
lypinator 0:bb348c97df44 517 * @{
lypinator 0:bb348c97df44 518 */
lypinator 0:bb348c97df44 519 #define SAI_IT_OVRUDR ((uint32_t)SAI_xIMR_OVRUDRIE)
lypinator 0:bb348c97df44 520 #define SAI_IT_MUTEDET ((uint32_t)SAI_xIMR_MUTEDETIE)
lypinator 0:bb348c97df44 521 #define SAI_IT_WCKCFG ((uint32_t)SAI_xIMR_WCKCFGIE)
lypinator 0:bb348c97df44 522 #define SAI_IT_FREQ ((uint32_t)SAI_xIMR_FREQIE)
lypinator 0:bb348c97df44 523 #define SAI_IT_CNRDY ((uint32_t)SAI_xIMR_CNRDYIE)
lypinator 0:bb348c97df44 524 #define SAI_IT_AFSDET ((uint32_t)SAI_xIMR_AFSDETIE)
lypinator 0:bb348c97df44 525 #define SAI_IT_LFSDET ((uint32_t)SAI_xIMR_LFSDETIE)
lypinator 0:bb348c97df44 526 /**
lypinator 0:bb348c97df44 527 * @}
lypinator 0:bb348c97df44 528 */
lypinator 0:bb348c97df44 529
lypinator 0:bb348c97df44 530 /** @defgroup SAI_Block_Flags_Definition SAI Block Flags Definition
lypinator 0:bb348c97df44 531 * @{
lypinator 0:bb348c97df44 532 */
lypinator 0:bb348c97df44 533 #define SAI_FLAG_OVRUDR ((uint32_t)SAI_xSR_OVRUDR)
lypinator 0:bb348c97df44 534 #define SAI_FLAG_MUTEDET ((uint32_t)SAI_xSR_MUTEDET)
lypinator 0:bb348c97df44 535 #define SAI_FLAG_WCKCFG ((uint32_t)SAI_xSR_WCKCFG)
lypinator 0:bb348c97df44 536 #define SAI_FLAG_FREQ ((uint32_t)SAI_xSR_FREQ)
lypinator 0:bb348c97df44 537 #define SAI_FLAG_CNRDY ((uint32_t)SAI_xSR_CNRDY)
lypinator 0:bb348c97df44 538 #define SAI_FLAG_AFSDET ((uint32_t)SAI_xSR_AFSDET)
lypinator 0:bb348c97df44 539 #define SAI_FLAG_LFSDET ((uint32_t)SAI_xSR_LFSDET)
lypinator 0:bb348c97df44 540 /**
lypinator 0:bb348c97df44 541 * @}
lypinator 0:bb348c97df44 542 */
lypinator 0:bb348c97df44 543
lypinator 0:bb348c97df44 544 /** @defgroup SAI_Block_Fifo_Status_Level SAI Block Fifo Status Level
lypinator 0:bb348c97df44 545 * @{
lypinator 0:bb348c97df44 546 */
lypinator 0:bb348c97df44 547 #define SAI_FIFOSTATUS_EMPTY 0x00000000U
lypinator 0:bb348c97df44 548 #define SAI_FIFOSTATUS_LESS1QUARTERFULL 0x00010000U
lypinator 0:bb348c97df44 549 #define SAI_FIFOSTATUS_1QUARTERFULL 0x00020000U
lypinator 0:bb348c97df44 550 #define SAI_FIFOSTATUS_HALFFULL 0x00030000U
lypinator 0:bb348c97df44 551 #define SAI_FIFOSTATUS_3QUARTERFULL 0x00040000U
lypinator 0:bb348c97df44 552 #define SAI_FIFOSTATUS_FULL 0x00050000U
lypinator 0:bb348c97df44 553 /**
lypinator 0:bb348c97df44 554 * @}
lypinator 0:bb348c97df44 555 */
lypinator 0:bb348c97df44 556
lypinator 0:bb348c97df44 557 /**
lypinator 0:bb348c97df44 558 * @}
lypinator 0:bb348c97df44 559 */
lypinator 0:bb348c97df44 560
lypinator 0:bb348c97df44 561 /* Exported macro ------------------------------------------------------------*/
lypinator 0:bb348c97df44 562
lypinator 0:bb348c97df44 563 /** @defgroup SAI_Exported_Macros SAI Exported Macros
lypinator 0:bb348c97df44 564 * @brief macros to handle interrupts and specific configurations
lypinator 0:bb348c97df44 565 * @{
lypinator 0:bb348c97df44 566 */
lypinator 0:bb348c97df44 567
lypinator 0:bb348c97df44 568 /** @brief Reset SAI handle state
lypinator 0:bb348c97df44 569 * @param __HANDLE__ specifies the SAI Handle.
lypinator 0:bb348c97df44 570 * @retval NoneS
lypinator 0:bb348c97df44 571 */
lypinator 0:bb348c97df44 572 #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SAI_STATE_RESET)
lypinator 0:bb348c97df44 573
lypinator 0:bb348c97df44 574 /** @brief Enable or disable the specified SAI interrupts.
lypinator 0:bb348c97df44 575 * @param __HANDLE__ specifies the SAI Handle.
lypinator 0:bb348c97df44 576 * @param __INTERRUPT__ specifies the interrupt source to enable or disable.
lypinator 0:bb348c97df44 577 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 578 * @arg SAI_IT_OVRUDR: Overrun underrun interrupt enable
lypinator 0:bb348c97df44 579 * @arg SAI_IT_MUTEDET: Mute detection interrupt enable
lypinator 0:bb348c97df44 580 * @arg SAI_IT_WCKCFG: Wrong Clock Configuration interrupt enable
lypinator 0:bb348c97df44 581 * @arg SAI_IT_FREQ: FIFO request interrupt enable
lypinator 0:bb348c97df44 582 * @arg SAI_IT_CNRDY: Codec not ready interrupt enable
lypinator 0:bb348c97df44 583 * @arg SAI_IT_AFSDET: Anticipated frame synchronization detection interrupt enable
lypinator 0:bb348c97df44 584 * @arg SAI_IT_LFSDET: Late frame synchronization detection interrupt enable
lypinator 0:bb348c97df44 585 * @retval None
lypinator 0:bb348c97df44 586 */
lypinator 0:bb348c97df44 587 #define __HAL_SAI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__))
lypinator 0:bb348c97df44 588 #define __HAL_SAI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (~(__INTERRUPT__)))
lypinator 0:bb348c97df44 589
lypinator 0:bb348c97df44 590 /** @brief Check if the specified SAI interrupt source is enabled or disabled.
lypinator 0:bb348c97df44 591 * @param __HANDLE__ specifies the SAI Handle.
lypinator 0:bb348c97df44 592 * This parameter can be SAI where x: 1, 2, or 3 to select the SAI peripheral.
lypinator 0:bb348c97df44 593 * @param __INTERRUPT__ specifies the SAI interrupt source to check.
lypinator 0:bb348c97df44 594 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 595 * @arg SAI_IT_OVRUDR: Overrun underrun interrupt enable
lypinator 0:bb348c97df44 596 * @arg SAI_IT_MUTEDET: Mute detection interrupt enable
lypinator 0:bb348c97df44 597 * @arg SAI_IT_WCKCFG: Wrong Clock Configuration interrupt enable
lypinator 0:bb348c97df44 598 * @arg SAI_IT_FREQ: FIFO request interrupt enable
lypinator 0:bb348c97df44 599 * @arg SAI_IT_CNRDY: Codec not ready interrupt enable
lypinator 0:bb348c97df44 600 * @arg SAI_IT_AFSDET: Anticipated frame synchronization detection interrupt enable
lypinator 0:bb348c97df44 601 * @arg SAI_IT_LFSDET: Late frame synchronization detection interrupt enable
lypinator 0:bb348c97df44 602 * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
lypinator 0:bb348c97df44 603 */
lypinator 0:bb348c97df44 604 #define __HAL_SAI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IMR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
lypinator 0:bb348c97df44 605
lypinator 0:bb348c97df44 606 /** @brief Check whether the specified SAI flag is set or not.
lypinator 0:bb348c97df44 607 * @param __HANDLE__ specifies the SAI Handle.
lypinator 0:bb348c97df44 608 * @param __FLAG__ specifies the flag to check.
lypinator 0:bb348c97df44 609 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 610 * @arg SAI_FLAG_OVRUDR: Overrun underrun flag.
lypinator 0:bb348c97df44 611 * @arg SAI_FLAG_MUTEDET: Mute detection flag.
lypinator 0:bb348c97df44 612 * @arg SAI_FLAG_WCKCFG: Wrong Clock Configuration flag.
lypinator 0:bb348c97df44 613 * @arg SAI_FLAG_FREQ: FIFO request flag.
lypinator 0:bb348c97df44 614 * @arg SAI_FLAG_CNRDY: Codec not ready flag.
lypinator 0:bb348c97df44 615 * @arg SAI_FLAG_AFSDET: Anticipated frame synchronization detection flag.
lypinator 0:bb348c97df44 616 * @arg SAI_FLAG_LFSDET: Late frame synchronization detection flag.
lypinator 0:bb348c97df44 617 * @retval The new state of __FLAG__ (TRUE or FALSE).
lypinator 0:bb348c97df44 618 */
lypinator 0:bb348c97df44 619 #define __HAL_SAI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
lypinator 0:bb348c97df44 620
lypinator 0:bb348c97df44 621 /** @brief Clear the specified SAI pending flag.
lypinator 0:bb348c97df44 622 * @param __HANDLE__ specifies the SAI Handle.
lypinator 0:bb348c97df44 623 * @param __FLAG__ specifies the flag to check.
lypinator 0:bb348c97df44 624 * This parameter can be any combination of the following values:
lypinator 0:bb348c97df44 625 * @arg SAI_FLAG_OVRUDR: Clear Overrun underrun
lypinator 0:bb348c97df44 626 * @arg SAI_FLAG_MUTEDET: Clear Mute detection
lypinator 0:bb348c97df44 627 * @arg SAI_FLAG_WCKCFG: Clear Wrong Clock Configuration
lypinator 0:bb348c97df44 628 * @arg SAI_FLAG_FREQ: Clear FIFO request
lypinator 0:bb348c97df44 629 * @arg SAI_FLAG_CNRDY: Clear Codec not ready
lypinator 0:bb348c97df44 630 * @arg SAI_FLAG_AFSDET: Clear Anticipated frame synchronization detection
lypinator 0:bb348c97df44 631 * @arg SAI_FLAG_LFSDET: Clear Late frame synchronization detection
lypinator 0:bb348c97df44 632 * @retval None
lypinator 0:bb348c97df44 633 */
lypinator 0:bb348c97df44 634 #define __HAL_SAI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLRFR = (__FLAG__))
lypinator 0:bb348c97df44 635
lypinator 0:bb348c97df44 636 /** @brief Enable SAI
lypinator 0:bb348c97df44 637 * @param __HANDLE__ specifies the SAI Handle.
lypinator 0:bb348c97df44 638 * @retval None
lypinator 0:bb348c97df44 639 */
lypinator 0:bb348c97df44 640 #define __HAL_SAI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SAI_xCR1_SAIEN)
lypinator 0:bb348c97df44 641
lypinator 0:bb348c97df44 642 /** @brief Disable SAI
lypinator 0:bb348c97df44 643 * @param __HANDLE__ specifies the SAI Handle.
lypinator 0:bb348c97df44 644 * @retval None
lypinator 0:bb348c97df44 645 */
lypinator 0:bb348c97df44 646 #define __HAL_SAI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~SAI_xCR1_SAIEN)
lypinator 0:bb348c97df44 647
lypinator 0:bb348c97df44 648 /**
lypinator 0:bb348c97df44 649 * @}
lypinator 0:bb348c97df44 650 */
lypinator 0:bb348c97df44 651
lypinator 0:bb348c97df44 652 /* Include RCC SAI Extension module */
lypinator 0:bb348c97df44 653 #include "stm32f4xx_hal_sai_ex.h"
lypinator 0:bb348c97df44 654
lypinator 0:bb348c97df44 655 /* Exported functions --------------------------------------------------------*/
lypinator 0:bb348c97df44 656
lypinator 0:bb348c97df44 657 /** @addtogroup SAI_Exported_Functions
lypinator 0:bb348c97df44 658 * @{
lypinator 0:bb348c97df44 659 */
lypinator 0:bb348c97df44 660
lypinator 0:bb348c97df44 661 /* Initialization/de-initialization functions **********************************/
lypinator 0:bb348c97df44 662 /** @addtogroup SAI_Exported_Functions_Group1
lypinator 0:bb348c97df44 663 * @{
lypinator 0:bb348c97df44 664 */
lypinator 0:bb348c97df44 665 HAL_StatusTypeDef HAL_SAI_InitProtocol(SAI_HandleTypeDef *hsai, uint32_t protocol, uint32_t datasize, uint32_t nbslot);
lypinator 0:bb348c97df44 666 HAL_StatusTypeDef HAL_SAI_Init(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 667 HAL_StatusTypeDef HAL_SAI_DeInit (SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 668 void HAL_SAI_MspInit(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 669 void HAL_SAI_MspDeInit(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 670
lypinator 0:bb348c97df44 671 /**
lypinator 0:bb348c97df44 672 * @}
lypinator 0:bb348c97df44 673 */
lypinator 0:bb348c97df44 674
lypinator 0:bb348c97df44 675 /* I/O operation functions *****************************************************/
lypinator 0:bb348c97df44 676 /** @addtogroup SAI_Exported_Functions_Group2
lypinator 0:bb348c97df44 677 * @{
lypinator 0:bb348c97df44 678 */
lypinator 0:bb348c97df44 679 /* Blocking mode: Polling */
lypinator 0:bb348c97df44 680 HAL_StatusTypeDef HAL_SAI_Transmit(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout);
lypinator 0:bb348c97df44 681 HAL_StatusTypeDef HAL_SAI_Receive(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout);
lypinator 0:bb348c97df44 682
lypinator 0:bb348c97df44 683 /* Non-Blocking mode: Interrupt */
lypinator 0:bb348c97df44 684 HAL_StatusTypeDef HAL_SAI_Transmit_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size);
lypinator 0:bb348c97df44 685 HAL_StatusTypeDef HAL_SAI_Receive_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size);
lypinator 0:bb348c97df44 686
lypinator 0:bb348c97df44 687 /* Non-Blocking mode: DMA */
lypinator 0:bb348c97df44 688 HAL_StatusTypeDef HAL_SAI_Transmit_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size);
lypinator 0:bb348c97df44 689 HAL_StatusTypeDef HAL_SAI_Receive_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size);
lypinator 0:bb348c97df44 690 HAL_StatusTypeDef HAL_SAI_DMAPause(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 691 HAL_StatusTypeDef HAL_SAI_DMAResume(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 692 HAL_StatusTypeDef HAL_SAI_DMAStop(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 693
lypinator 0:bb348c97df44 694 /* Abort function */
lypinator 0:bb348c97df44 695 HAL_StatusTypeDef HAL_SAI_Abort(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 696
lypinator 0:bb348c97df44 697 /* Mute management */
lypinator 0:bb348c97df44 698 HAL_StatusTypeDef HAL_SAI_EnableTxMuteMode(SAI_HandleTypeDef *hsai, uint16_t val);
lypinator 0:bb348c97df44 699 HAL_StatusTypeDef HAL_SAI_DisableTxMuteMode(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 700 HAL_StatusTypeDef HAL_SAI_EnableRxMuteMode(SAI_HandleTypeDef *hsai, SAIcallback callback, uint16_t counter);
lypinator 0:bb348c97df44 701 HAL_StatusTypeDef HAL_SAI_DisableRxMuteMode(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 702
lypinator 0:bb348c97df44 703 /* SAI IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */
lypinator 0:bb348c97df44 704 void HAL_SAI_IRQHandler(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 705 void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 706 void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 707 void HAL_SAI_RxHalfCpltCallback(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 708 void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 709 void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 710 /**
lypinator 0:bb348c97df44 711 * @}
lypinator 0:bb348c97df44 712 */
lypinator 0:bb348c97df44 713
lypinator 0:bb348c97df44 714 /** @addtogroup SAI_Exported_Functions_Group3
lypinator 0:bb348c97df44 715 * @{
lypinator 0:bb348c97df44 716 */
lypinator 0:bb348c97df44 717 /* Peripheral State functions ************************************************/
lypinator 0:bb348c97df44 718 HAL_SAI_StateTypeDef HAL_SAI_GetState(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 719 uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai);
lypinator 0:bb348c97df44 720 /**
lypinator 0:bb348c97df44 721 * @}
lypinator 0:bb348c97df44 722 */
lypinator 0:bb348c97df44 723
lypinator 0:bb348c97df44 724 /**
lypinator 0:bb348c97df44 725 * @}
lypinator 0:bb348c97df44 726 */
lypinator 0:bb348c97df44 727
lypinator 0:bb348c97df44 728 /* Private macros ------------------------------------------------------------*/
lypinator 0:bb348c97df44 729 /** @addtogroup SAI_Private_Macros
lypinator 0:bb348c97df44 730 * @{
lypinator 0:bb348c97df44 731 */
lypinator 0:bb348c97df44 732 #define IS_SAI_BLOCK_SYNCEXT(STATE) (((STATE) == SAI_SYNCEXT_DISABLE) ||\
lypinator 0:bb348c97df44 733 ((STATE) == SAI_SYNCEXT_OUTBLOCKA_ENABLE) ||\
lypinator 0:bb348c97df44 734 ((STATE) == SAI_SYNCEXT_OUTBLOCKB_ENABLE))
lypinator 0:bb348c97df44 735
lypinator 0:bb348c97df44 736 #define IS_SAI_SUPPORTED_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_I2S_STANDARD) ||\
lypinator 0:bb348c97df44 737 ((PROTOCOL) == SAI_I2S_MSBJUSTIFIED) ||\
lypinator 0:bb348c97df44 738 ((PROTOCOL) == SAI_I2S_LSBJUSTIFIED) ||\
lypinator 0:bb348c97df44 739 ((PROTOCOL) == SAI_PCM_LONG) ||\
lypinator 0:bb348c97df44 740 ((PROTOCOL) == SAI_PCM_SHORT))
lypinator 0:bb348c97df44 741
lypinator 0:bb348c97df44 742 #define IS_SAI_PROTOCOL_DATASIZE(DATASIZE) (((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BIT) ||\
lypinator 0:bb348c97df44 743 ((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BITEXTENDED) ||\
lypinator 0:bb348c97df44 744 ((DATASIZE) == SAI_PROTOCOL_DATASIZE_24BIT) ||\
lypinator 0:bb348c97df44 745 ((DATASIZE) == SAI_PROTOCOL_DATASIZE_32BIT))
lypinator 0:bb348c97df44 746
lypinator 0:bb348c97df44 747 #define IS_SAI_AUDIO_FREQUENCY(AUDIO) (((AUDIO) == SAI_AUDIO_FREQUENCY_192K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_96K) || \
lypinator 0:bb348c97df44 748 ((AUDIO) == SAI_AUDIO_FREQUENCY_48K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_44K) || \
lypinator 0:bb348c97df44 749 ((AUDIO) == SAI_AUDIO_FREQUENCY_32K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_22K) || \
lypinator 0:bb348c97df44 750 ((AUDIO) == SAI_AUDIO_FREQUENCY_16K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_11K) || \
lypinator 0:bb348c97df44 751 ((AUDIO) == SAI_AUDIO_FREQUENCY_8K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_MCKDIV))
lypinator 0:bb348c97df44 752
lypinator 0:bb348c97df44 753 #define IS_SAI_BLOCK_MODE(MODE) (((MODE) == SAI_MODEMASTER_TX) || \
lypinator 0:bb348c97df44 754 ((MODE) == SAI_MODEMASTER_RX) || \
lypinator 0:bb348c97df44 755 ((MODE) == SAI_MODESLAVE_TX) || \
lypinator 0:bb348c97df44 756 ((MODE) == SAI_MODESLAVE_RX))
lypinator 0:bb348c97df44 757
lypinator 0:bb348c97df44 758 #define IS_SAI_BLOCK_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_FREE_PROTOCOL) || \
lypinator 0:bb348c97df44 759 ((PROTOCOL) == SAI_AC97_PROTOCOL) || \
lypinator 0:bb348c97df44 760 ((PROTOCOL) == SAI_SPDIF_PROTOCOL))
lypinator 0:bb348c97df44 761
lypinator 0:bb348c97df44 762 #define IS_SAI_BLOCK_DATASIZE(DATASIZE) (((DATASIZE) == SAI_DATASIZE_8) || \
lypinator 0:bb348c97df44 763 ((DATASIZE) == SAI_DATASIZE_10) || \
lypinator 0:bb348c97df44 764 ((DATASIZE) == SAI_DATASIZE_16) || \
lypinator 0:bb348c97df44 765 ((DATASIZE) == SAI_DATASIZE_20) || \
lypinator 0:bb348c97df44 766 ((DATASIZE) == SAI_DATASIZE_24) || \
lypinator 0:bb348c97df44 767 ((DATASIZE) == SAI_DATASIZE_32))
lypinator 0:bb348c97df44 768
lypinator 0:bb348c97df44 769 #define IS_SAI_BLOCK_FIRST_BIT(BIT) (((BIT) == SAI_FIRSTBIT_MSB) || \
lypinator 0:bb348c97df44 770 ((BIT) == SAI_FIRSTBIT_LSB))
lypinator 0:bb348c97df44 771
lypinator 0:bb348c97df44 772 #define IS_SAI_BLOCK_CLOCK_STROBING(CLOCK) (((CLOCK) == SAI_CLOCKSTROBING_FALLINGEDGE) || \
lypinator 0:bb348c97df44 773 ((CLOCK) == SAI_CLOCKSTROBING_RISINGEDGE))
lypinator 0:bb348c97df44 774
lypinator 0:bb348c97df44 775 #define IS_SAI_BLOCK_SYNCHRO(SYNCHRO) (((SYNCHRO) == SAI_ASYNCHRONOUS) || \
lypinator 0:bb348c97df44 776 ((SYNCHRO) == SAI_SYNCHRONOUS) || \
lypinator 0:bb348c97df44 777 ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI1) ||\
lypinator 0:bb348c97df44 778 ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI2))
lypinator 0:bb348c97df44 779
lypinator 0:bb348c97df44 780 #define IS_SAI_BLOCK_OUTPUT_DRIVE(DRIVE) (((DRIVE) == SAI_OUTPUTDRIVE_DISABLE) || \
lypinator 0:bb348c97df44 781 ((DRIVE) == SAI_OUTPUTDRIVE_ENABLE))
lypinator 0:bb348c97df44 782
lypinator 0:bb348c97df44 783 #define IS_SAI_BLOCK_NODIVIDER(NODIVIDER) (((NODIVIDER) == SAI_MASTERDIVIDER_ENABLE) || \
lypinator 0:bb348c97df44 784 ((NODIVIDER) == SAI_MASTERDIVIDER_DISABLE))
lypinator 0:bb348c97df44 785
lypinator 0:bb348c97df44 786 #define IS_SAI_BLOCK_MUTE_COUNTER(COUNTER) ((COUNTER) <= 63U)
lypinator 0:bb348c97df44 787
lypinator 0:bb348c97df44 788 #define IS_SAI_BLOCK_MUTE_VALUE(VALUE) (((VALUE) == SAI_ZERO_VALUE) || \
lypinator 0:bb348c97df44 789 ((VALUE) == SAI_LAST_SENT_VALUE))
lypinator 0:bb348c97df44 790
lypinator 0:bb348c97df44 791 #define IS_SAI_BLOCK_COMPANDING_MODE(MODE) (((MODE) == SAI_NOCOMPANDING) || \
lypinator 0:bb348c97df44 792 ((MODE) == SAI_ULAW_1CPL_COMPANDING) || \
lypinator 0:bb348c97df44 793 ((MODE) == SAI_ALAW_1CPL_COMPANDING) || \
lypinator 0:bb348c97df44 794 ((MODE) == SAI_ULAW_2CPL_COMPANDING) || \
lypinator 0:bb348c97df44 795 ((MODE) == SAI_ALAW_2CPL_COMPANDING))
lypinator 0:bb348c97df44 796
lypinator 0:bb348c97df44 797 #define IS_SAI_BLOCK_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == SAI_FIFOTHRESHOLD_EMPTY) || \
lypinator 0:bb348c97df44 798 ((THRESHOLD) == SAI_FIFOTHRESHOLD_1QF) || \
lypinator 0:bb348c97df44 799 ((THRESHOLD) == SAI_FIFOTHRESHOLD_HF) || \
lypinator 0:bb348c97df44 800 ((THRESHOLD) == SAI_FIFOTHRESHOLD_3QF) || \
lypinator 0:bb348c97df44 801 ((THRESHOLD) == SAI_FIFOTHRESHOLD_FULL))
lypinator 0:bb348c97df44 802
lypinator 0:bb348c97df44 803 #define IS_SAI_BLOCK_TRISTATE_MANAGEMENT(STATE) (((STATE) == SAI_OUTPUT_NOTRELEASED) ||\
lypinator 0:bb348c97df44 804 ((STATE) == SAI_OUTPUT_RELEASED))
lypinator 0:bb348c97df44 805
lypinator 0:bb348c97df44 806 #define IS_SAI_MONO_STEREO_MODE(MODE) (((MODE) == SAI_MONOMODE) ||\
lypinator 0:bb348c97df44 807 ((MODE) == SAI_STEREOMODE))
lypinator 0:bb348c97df44 808
lypinator 0:bb348c97df44 809 #define IS_SAI_SLOT_ACTIVE(ACTIVE) ((ACTIVE) <= SAI_SLOTACTIVE_ALL)
lypinator 0:bb348c97df44 810
lypinator 0:bb348c97df44 811 #define IS_SAI_BLOCK_SLOT_NUMBER(NUMBER) ((1U <= (NUMBER)) && ((NUMBER) <= 16U))
lypinator 0:bb348c97df44 812
lypinator 0:bb348c97df44 813 #define IS_SAI_BLOCK_SLOT_SIZE(SIZE) (((SIZE) == SAI_SLOTSIZE_DATASIZE) || \
lypinator 0:bb348c97df44 814 ((SIZE) == SAI_SLOTSIZE_16B) || \
lypinator 0:bb348c97df44 815 ((SIZE) == SAI_SLOTSIZE_32B))
lypinator 0:bb348c97df44 816
lypinator 0:bb348c97df44 817 #define IS_SAI_BLOCK_FIRSTBIT_OFFSET(OFFSET) ((OFFSET) <= 24U)
lypinator 0:bb348c97df44 818
lypinator 0:bb348c97df44 819 #define IS_SAI_BLOCK_FS_OFFSET(OFFSET) (((OFFSET) == SAI_FS_FIRSTBIT) || \
lypinator 0:bb348c97df44 820 ((OFFSET) == SAI_FS_BEFOREFIRSTBIT))
lypinator 0:bb348c97df44 821
lypinator 0:bb348c97df44 822 #define IS_SAI_BLOCK_FS_POLARITY(POLARITY) (((POLARITY) == SAI_FS_ACTIVE_LOW) || \
lypinator 0:bb348c97df44 823 ((POLARITY) == SAI_FS_ACTIVE_HIGH))
lypinator 0:bb348c97df44 824
lypinator 0:bb348c97df44 825 #define IS_SAI_BLOCK_FS_DEFINITION(DEFINITION) (((DEFINITION) == SAI_FS_STARTFRAME) || \
lypinator 0:bb348c97df44 826 ((DEFINITION) == SAI_FS_CHANNEL_IDENTIFICATION))
lypinator 0:bb348c97df44 827
lypinator 0:bb348c97df44 828 #define IS_SAI_BLOCK_MASTER_DIVIDER(DIVIDER) ((DIVIDER) <= 15U)
lypinator 0:bb348c97df44 829
lypinator 0:bb348c97df44 830 #define IS_SAI_BLOCK_FRAME_LENGTH(LENGTH) ((8U <= (LENGTH)) && ((LENGTH) <= 256U))
lypinator 0:bb348c97df44 831
lypinator 0:bb348c97df44 832 #define IS_SAI_BLOCK_ACTIVE_FRAME(LENGTH) ((1U <= (LENGTH)) && ((LENGTH) <= 128U))
lypinator 0:bb348c97df44 833
lypinator 0:bb348c97df44 834
lypinator 0:bb348c97df44 835 /**
lypinator 0:bb348c97df44 836 * @}
lypinator 0:bb348c97df44 837 */
lypinator 0:bb348c97df44 838
lypinator 0:bb348c97df44 839 /* Private functions ---------------------------------------------------------*/
lypinator 0:bb348c97df44 840 /** @defgroup SAI_Private_Functions SAI Private Functions
lypinator 0:bb348c97df44 841 * @{
lypinator 0:bb348c97df44 842 */
lypinator 0:bb348c97df44 843
lypinator 0:bb348c97df44 844 /**
lypinator 0:bb348c97df44 845 * @}
lypinator 0:bb348c97df44 846 */
lypinator 0:bb348c97df44 847
lypinator 0:bb348c97df44 848 /**
lypinator 0:bb348c97df44 849 * @}
lypinator 0:bb348c97df44 850 */
lypinator 0:bb348c97df44 851
lypinator 0:bb348c97df44 852 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F413xx || STM32F423xx */
lypinator 0:bb348c97df44 853
lypinator 0:bb348c97df44 854 /**
lypinator 0:bb348c97df44 855 * @}
lypinator 0:bb348c97df44 856 */
lypinator 0:bb348c97df44 857
lypinator 0:bb348c97df44 858 #ifdef __cplusplus
lypinator 0:bb348c97df44 859 }
lypinator 0:bb348c97df44 860 #endif
lypinator 0:bb348c97df44 861
lypinator 0:bb348c97df44 862 #endif /* __STM32F4xx_HAL_SAI_H */
lypinator 0:bb348c97df44 863
lypinator 0:bb348c97df44 864 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/