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:
Kojto
Date:
Wed Mar 02 09:58:28 2016 +0100
Revision:
115:87f2f5183dfb
Child:
116:c0f6e94411f5
Release 115 of the mbed library

Changes:
- new targets - NUCLEO_F746ZG
- Bugfix - STM32F7 + STM32L4 - RTC init fix
- Bugfix - STM32L4 Set NVIC_RAM_VECTOR_ADDRESS to 0x10000000
- B96B_F446VE - CAN addition
- Changed target name from NZ32SC151 to NZ32_SC151

Who changed what in which revision?

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