mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
jaerts
Date:
Tue Dec 22 13:22:16 2015 +0000
Revision:
637:ed69428d4850
Parent:
610:813dcc80987e
Add very shady LPC1768 CAN Filter implementation

Who changed what in which revision?

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