Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
112:6f327212ef96
.

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