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:
107:4f6c30876dfa
.

Who changed what in which revision?

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