mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
112:6f327212ef96
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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