STM32F479xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_hal_sai.h 00004 * @author MCD Application Team 00005 * @brief Header file of SAI HAL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Define to prevent recursive inclusion -------------------------------------*/ 00021 #ifndef __STM32F4xx_HAL_SAI_H 00022 #define __STM32F4xx_HAL_SAI_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f4xx_hal_def.h" 00030 00031 /** @addtogroup STM32F4xx_HAL_Driver 00032 * @{ 00033 */ 00034 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ 00035 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || \ 00036 defined(STM32F423xx) 00037 00038 /** @addtogroup SAI 00039 * @{ 00040 */ 00041 00042 /* Exported types ------------------------------------------------------------*/ 00043 /** @defgroup SAI_Exported_Types SAI Exported Types 00044 * @{ 00045 */ 00046 00047 /** 00048 * @brief HAL State structures definition 00049 */ 00050 typedef enum 00051 { 00052 HAL_SAI_STATE_RESET = 0x00U, /*!< SAI not yet initialized or disabled */ 00053 HAL_SAI_STATE_READY = 0x01U, /*!< SAI initialized and ready for use */ 00054 HAL_SAI_STATE_BUSY = 0x02U, /*!< SAI internal process is ongoing */ 00055 HAL_SAI_STATE_BUSY_TX = 0x12U, /*!< Data transmission process is ongoing */ 00056 HAL_SAI_STATE_BUSY_RX = 0x22U, /*!< Data reception process is ongoing */ 00057 HAL_SAI_STATE_TIMEOUT = 0x03U, /*!< SAI timeout state */ 00058 HAL_SAI_STATE_ERROR = 0x04U /*!< SAI error state */ 00059 } HAL_SAI_StateTypeDef; 00060 00061 /** 00062 * @brief SAI Callback prototype 00063 */ 00064 typedef void (*SAIcallback)(void); 00065 00066 /** @defgroup SAI_Init_Structure_definition SAI Init Structure definition 00067 * @brief SAI Init Structure definition 00068 * @{ 00069 */ 00070 typedef struct 00071 { 00072 uint32_t AudioMode; /*!< Specifies the SAI Block audio Mode. 00073 This parameter can be a value of @ref SAI_Block_Mode */ 00074 00075 uint32_t Synchro; /*!< Specifies SAI Block synchronization 00076 This parameter can be a value of @ref SAI_Block_Synchronization */ 00077 00078 uint32_t SynchroExt; /*!< Specifies SAI external output synchronization, this setup is common 00079 for BlockA and BlockB 00080 This parameter can be a value of @ref SAI_Block_SyncExt 00081 @note: If both audio blocks of same SAI are used, this parameter has 00082 to be set to the same value for each audio block */ 00083 00084 uint32_t OutputDrive; /*!< Specifies when SAI Block outputs are driven. 00085 This parameter can be a value of @ref SAI_Block_Output_Drive 00086 @note this value has to be set before enabling the audio block 00087 but after the audio block configuration. */ 00088 00089 uint32_t NoDivider; /*!< Specifies whether master clock will be divided or not. 00090 This parameter can be a value of @ref SAI_Block_NoDivider 00091 @note If bit NODIV in the SAI_xCR1 register is cleared, the frame length 00092 should be aligned to a number equal to a power of 2, from 8 to 256. 00093 If bit NODIV in the SAI_xCR1 register is set, the frame length can 00094 take any of the values without constraint since the input clock of 00095 the audio block should be equal to the bit clock. 00096 There is no MCLK_x clock which can be output. */ 00097 00098 uint32_t FIFOThreshold; /*!< Specifies SAI Block FIFO threshold. 00099 This parameter can be a value of @ref SAI_Block_Fifo_Threshold */ 00100 00101 uint32_t ClockSource; /*!< Specifies the SAI Block x Clock source. 00102 This parameter is not used for STM32F446xx devices. */ 00103 00104 uint32_t AudioFrequency; /*!< Specifies the audio frequency sampling. 00105 This parameter can be a value of @ref SAI_Audio_Frequency */ 00106 00107 uint32_t Mckdiv; /*!< Specifies the master clock divider. 00108 This parameter must be a number between Min_Data = 0 and Max_Data = 15. 00109 @note This parameter is used only if AudioFrequency is set to 00110 SAI_AUDIO_FREQUENCY_MCKDIV otherwise it is internally computed. */ 00111 00112 uint32_t MonoStereoMode; /*!< Specifies if the mono or stereo mode is selected. 00113 This parameter can be a value of @ref SAI_Mono_Stereo_Mode */ 00114 00115 uint32_t CompandingMode; /*!< Specifies the companding mode type. 00116 This parameter can be a value of @ref SAI_Block_Companding_Mode */ 00117 00118 uint32_t TriState; /*!< Specifies the companding mode type. 00119 This parameter can be a value of @ref SAI_TRIState_Management */ 00120 00121 /* This part of the structure is automatically filled if your are using the high level intialisation 00122 function HAL_SAI_InitProtocol */ 00123 00124 uint32_t Protocol; /*!< Specifies the SAI Block protocol. 00125 This parameter can be a value of @ref SAI_Block_Protocol */ 00126 00127 uint32_t DataSize; /*!< Specifies the SAI Block data size. 00128 This parameter can be a value of @ref SAI_Block_Data_Size */ 00129 00130 uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit. 00131 This parameter can be a value of @ref SAI_Block_MSB_LSB_transmission */ 00132 00133 uint32_t ClockStrobing; /*!< Specifies the SAI Block clock strobing edge sensitivity. 00134 This parameter can be a value of @ref SAI_Block_Clock_Strobing */ 00135 } SAI_InitTypeDef; 00136 /** 00137 * @} 00138 */ 00139 00140 /** @defgroup SAI_Frame_Structure_definition SAI Frame Structure definition 00141 * @brief SAI Frame Init structure definition 00142 * @note For SPDIF and AC97 protocol, these parameters are not used (set by hardware). 00143 * @{ 00144 */ 00145 typedef struct 00146 { 00147 uint32_t FrameLength; /*!< Specifies the Frame length, the number of SCK clocks for each audio frame. 00148 This parameter must be a number between Min_Data = 8 and Max_Data = 256. 00149 @note If master clock MCLK_x pin is declared as an output, the frame length 00150 should be aligned to a number equal to power of 2 in order to keep 00151 in an audio frame, an integer number of MCLK pulses by bit Clock. */ 00152 00153 uint32_t ActiveFrameLength; /*!< Specifies the Frame synchronization active level length. 00154 This Parameter specifies the length in number of bit clock (SCK + 1) 00155 of the active level of FS signal in audio frame. 00156 This parameter must be a number between Min_Data = 1 and Max_Data = 128 */ 00157 00158 uint32_t FSDefinition; /*!< Specifies the Frame synchronization definition. 00159 This parameter can be a value of @ref SAI_Block_FS_Definition */ 00160 00161 uint32_t FSPolarity; /*!< Specifies the Frame synchronization Polarity. 00162 This parameter can be a value of @ref SAI_Block_FS_Polarity */ 00163 00164 uint32_t FSOffset; /*!< Specifies the Frame synchronization Offset. 00165 This parameter can be a value of @ref SAI_Block_FS_Offset */ 00166 } SAI_FrameInitTypeDef; 00167 /** 00168 * @} 00169 */ 00170 00171 /** @defgroup SAI_Slot_Structure_definition SAI Slot Structure definition 00172 * @brief SAI Block Slot Init Structure definition 00173 * @note For SPDIF protocol, these parameters are not used (set by hardware). 00174 * @note For AC97 protocol, only SlotActive parameter is used (the others are set by hardware). 00175 * @{ 00176 */ 00177 typedef struct 00178 { 00179 uint32_t FirstBitOffset; /*!< Specifies the position of first data transfer bit in the slot. 00180 This parameter must be a number between Min_Data = 0 and Max_Data = 24 */ 00181 00182 uint32_t SlotSize; /*!< Specifies the Slot Size. 00183 This parameter can be a value of @ref SAI_Block_Slot_Size */ 00184 00185 uint32_t SlotNumber; /*!< Specifies the number of slot in the audio frame. 00186 This parameter must be a number between Min_Data = 1 and Max_Data = 16 */ 00187 00188 uint32_t SlotActive; /*!< Specifies the slots in audio frame that will be activated. 00189 This parameter can be a value of @ref SAI_Block_Slot_Active */ 00190 } SAI_SlotInitTypeDef; 00191 /** 00192 * @} 00193 */ 00194 00195 /** @defgroup SAI_Handle_Structure_definition SAI Handle Structure definition 00196 * @brief SAI handle Structure definition 00197 * @{ 00198 */ 00199 typedef struct __SAI_HandleTypeDef 00200 { 00201 SAI_Block_TypeDef *Instance; /*!< SAI Blockx registers base address */ 00202 00203 SAI_InitTypeDef Init; /*!< SAI communication parameters */ 00204 00205 SAI_FrameInitTypeDef FrameInit; /*!< SAI Frame configuration parameters */ 00206 00207 SAI_SlotInitTypeDef SlotInit; /*!< SAI Slot configuration parameters */ 00208 00209 uint8_t *pBuffPtr; /*!< Pointer to SAI transfer Buffer */ 00210 00211 uint16_t XferSize; /*!< SAI transfer size */ 00212 00213 uint16_t XferCount; /*!< SAI transfer counter */ 00214 00215 DMA_HandleTypeDef *hdmatx; /*!< SAI Tx DMA handle parameters */ 00216 00217 DMA_HandleTypeDef *hdmarx; /*!< SAI Rx DMA handle parameters */ 00218 00219 SAIcallback mutecallback;/*!< SAI mute callback */ 00220 00221 void (*InterruptServiceRoutine)(struct __SAI_HandleTypeDef *hsai); /* function pointer for IRQ handler */ 00222 00223 HAL_LockTypeDef Lock; /*!< SAI locking object */ 00224 00225 __IO HAL_SAI_StateTypeDef State; /*!< SAI communication state */ 00226 00227 __IO uint32_t ErrorCode; /*!< SAI Error code */ 00228 00229 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) 00230 void (*RxCpltCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI receive complete callback */ 00231 void (*RxHalfCpltCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI receive half complete callback */ 00232 void (*TxCpltCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI transmit complete callback */ 00233 void (*TxHalfCpltCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI transmit half complete callback */ 00234 void (*ErrorCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI error callback */ 00235 void (*MspInitCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI MSP init callback */ 00236 void (*MspDeInitCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI MSP de-init callback */ 00237 #endif /* USE_HAL_SAI_REGISTER_CALLBACKS */ 00238 } SAI_HandleTypeDef; 00239 /** 00240 * @} 00241 */ 00242 00243 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) 00244 /** 00245 * @brief SAI callback ID enumeration definition 00246 */ 00247 typedef enum 00248 { 00249 HAL_SAI_RX_COMPLETE_CB_ID = 0x00U, /*!< SAI receive complete callback ID */ 00250 HAL_SAI_RX_HALFCOMPLETE_CB_ID = 0x01U, /*!< SAI receive half complete callback ID */ 00251 HAL_SAI_TX_COMPLETE_CB_ID = 0x02U, /*!< SAI transmit complete callback ID */ 00252 HAL_SAI_TX_HALFCOMPLETE_CB_ID = 0x03U, /*!< SAI transmit half complete callback ID */ 00253 HAL_SAI_ERROR_CB_ID = 0x04U, /*!< SAI error callback ID */ 00254 HAL_SAI_MSPINIT_CB_ID = 0x05U, /*!< SAI MSP init callback ID */ 00255 HAL_SAI_MSPDEINIT_CB_ID = 0x06U /*!< SAI MSP de-init callback ID */ 00256 } HAL_SAI_CallbackIDTypeDef; 00257 00258 /** 00259 * @brief SAI callback pointer definition 00260 */ 00261 typedef void (*pSAI_CallbackTypeDef)(SAI_HandleTypeDef *hsai); 00262 #endif /* USE_HAL_SAI_REGISTER_CALLBACKS */ 00263 00264 /** 00265 * @} 00266 */ 00267 00268 /* Exported constants --------------------------------------------------------*/ 00269 /** @defgroup SAI_Exported_Constants SAI Exported Constants 00270 * @{ 00271 */ 00272 00273 /** @defgroup SAI_Error_Code SAI Error Code 00274 * @{ 00275 */ 00276 #define HAL_SAI_ERROR_NONE 0x00000000U /*!< No error */ 00277 #define HAL_SAI_ERROR_OVR 0x00000001U /*!< Overrun Error */ 00278 #define HAL_SAI_ERROR_UDR 0x00000002U /*!< Underrun error */ 00279 #define HAL_SAI_ERROR_AFSDET 0x00000004U /*!< Anticipated Frame synchronisation detection */ 00280 #define HAL_SAI_ERROR_LFSDET 0x00000008U /*!< Late Frame synchronisation detection */ 00281 #define HAL_SAI_ERROR_CNREADY 0x00000010U /*!< codec not ready */ 00282 #define HAL_SAI_ERROR_WCKCFG 0x00000020U /*!< Wrong clock configuration */ 00283 #define HAL_SAI_ERROR_TIMEOUT 0x00000040U /*!< Timeout error */ 00284 #define HAL_SAI_ERROR_DMA 0x00000080U /*!< DMA error */ 00285 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) 00286 #define HAL_SAI_ERROR_INVALID_CALLBACK 0x00000100U /*!< Invalid callback error */ 00287 #endif /* USE_HAL_SAI_REGISTER_CALLBACKS */ 00288 /** 00289 * @} 00290 */ 00291 00292 /** @defgroup SAI_Block_SyncExt SAI External synchronisation 00293 * @{ 00294 */ 00295 #define SAI_SYNCEXT_DISABLE 0U 00296 #define SAI_SYNCEXT_OUTBLOCKA_ENABLE 1U 00297 #define SAI_SYNCEXT_OUTBLOCKB_ENABLE 2U 00298 /** 00299 * @} 00300 */ 00301 00302 /** @defgroup SAI_Protocol SAI Supported protocol 00303 * @{ 00304 */ 00305 #define SAI_I2S_STANDARD 0U 00306 #define SAI_I2S_MSBJUSTIFIED 1U 00307 #define SAI_I2S_LSBJUSTIFIED 2U 00308 #define SAI_PCM_LONG 3U 00309 #define SAI_PCM_SHORT 4U 00310 /** 00311 * @} 00312 */ 00313 00314 /** @defgroup SAI_Protocol_DataSize SAI protocol data size 00315 * @{ 00316 */ 00317 #define SAI_PROTOCOL_DATASIZE_16BIT 0U 00318 #define SAI_PROTOCOL_DATASIZE_16BITEXTENDED 1U 00319 #define SAI_PROTOCOL_DATASIZE_24BIT 2U 00320 #define SAI_PROTOCOL_DATASIZE_32BIT 3U 00321 /** 00322 * @} 00323 */ 00324 00325 /** @defgroup SAI_Audio_Frequency SAI Audio Frequency 00326 * @{ 00327 */ 00328 #define SAI_AUDIO_FREQUENCY_192K 192000U 00329 #define SAI_AUDIO_FREQUENCY_96K 96000U 00330 #define SAI_AUDIO_FREQUENCY_48K 48000U 00331 #define SAI_AUDIO_FREQUENCY_44K 44100U 00332 #define SAI_AUDIO_FREQUENCY_32K 32000U 00333 #define SAI_AUDIO_FREQUENCY_22K 22050U 00334 #define SAI_AUDIO_FREQUENCY_16K 16000U 00335 #define SAI_AUDIO_FREQUENCY_11K 11025U 00336 #define SAI_AUDIO_FREQUENCY_8K 8000U 00337 #define SAI_AUDIO_FREQUENCY_MCKDIV 0U 00338 /** 00339 * @} 00340 */ 00341 00342 /** @defgroup SAI_Block_Mode SAI Block Mode 00343 * @{ 00344 */ 00345 #define SAI_MODEMASTER_TX 0x00000000U 00346 #define SAI_MODEMASTER_RX ((uint32_t)SAI_xCR1_MODE_0) 00347 #define SAI_MODESLAVE_TX ((uint32_t)SAI_xCR1_MODE_1) 00348 #define SAI_MODESLAVE_RX ((uint32_t)(SAI_xCR1_MODE_1 | SAI_xCR1_MODE_0)) 00349 /** 00350 * @} 00351 */ 00352 00353 /** @defgroup SAI_Block_Protocol SAI Block Protocol 00354 * @{ 00355 */ 00356 #define SAI_FREE_PROTOCOL 0x00000000U 00357 #define SAI_SPDIF_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_0) 00358 #define SAI_AC97_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_1) 00359 /** 00360 * @} 00361 */ 00362 00363 /** @defgroup SAI_Block_Data_Size SAI Block Data Size 00364 * @{ 00365 */ 00366 #define SAI_DATASIZE_8 ((uint32_t)SAI_xCR1_DS_1) 00367 #define SAI_DATASIZE_10 ((uint32_t)(SAI_xCR1_DS_1 | SAI_xCR1_DS_0)) 00368 #define SAI_DATASIZE_16 ((uint32_t)SAI_xCR1_DS_2) 00369 #define SAI_DATASIZE_20 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_0)) 00370 #define SAI_DATASIZE_24 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1)) 00371 #define SAI_DATASIZE_32 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1 | SAI_xCR1_DS_0)) 00372 /** 00373 * @} 00374 */ 00375 00376 /** @defgroup SAI_Block_MSB_LSB_transmission SAI Block MSB LSB transmission 00377 * @{ 00378 */ 00379 #define SAI_FIRSTBIT_MSB 0x00000000U 00380 #define SAI_FIRSTBIT_LSB ((uint32_t)SAI_xCR1_LSBFIRST) 00381 /** 00382 * @} 00383 */ 00384 00385 /** @defgroup SAI_Block_Clock_Strobing SAI Block Clock Strobing 00386 * @{ 00387 */ 00388 #define SAI_CLOCKSTROBING_FALLINGEDGE 0U 00389 #define SAI_CLOCKSTROBING_RISINGEDGE 1U 00390 /** 00391 * @} 00392 */ 00393 00394 /** @defgroup SAI_Block_Synchronization SAI Block Synchronization 00395 * @{ 00396 */ 00397 #define SAI_ASYNCHRONOUS 0U /*!< Asynchronous */ 00398 #define SAI_SYNCHRONOUS 1U /*!< Synchronous with other block of same SAI */ 00399 #define SAI_SYNCHRONOUS_EXT_SAI1 2U /*!< Synchronous with other SAI, SAI1 */ 00400 #define SAI_SYNCHRONOUS_EXT_SAI2 3U /*!< Synchronous with other SAI, SAI2 */ 00401 /** 00402 * @} 00403 */ 00404 00405 /** @defgroup SAI_Block_Output_Drive SAI Block Output Drive 00406 * @{ 00407 */ 00408 #define SAI_OUTPUTDRIVE_DISABLE 0x00000000U 00409 #define SAI_OUTPUTDRIVE_ENABLE ((uint32_t)SAI_xCR1_OUTDRIV) 00410 /** 00411 * @} 00412 */ 00413 00414 /** @defgroup SAI_Block_NoDivider SAI Block NoDivider 00415 * @{ 00416 */ 00417 #define SAI_MASTERDIVIDER_ENABLE 0x00000000U 00418 #define SAI_MASTERDIVIDER_DISABLE ((uint32_t)SAI_xCR1_NODIV) 00419 /** 00420 * @} 00421 */ 00422 00423 /** @defgroup SAI_Block_FS_Definition SAI Block FS Definition 00424 * @{ 00425 */ 00426 #define SAI_FS_STARTFRAME 0x00000000U 00427 #define SAI_FS_CHANNEL_IDENTIFICATION ((uint32_t)SAI_xFRCR_FSDEF) 00428 /** 00429 * @} 00430 */ 00431 00432 /** @defgroup SAI_Block_FS_Polarity SAI Block FS Polarity 00433 * @{ 00434 */ 00435 #define SAI_FS_ACTIVE_LOW 0x00000000U 00436 #define SAI_FS_ACTIVE_HIGH ((uint32_t)SAI_xFRCR_FSPOL) 00437 /** 00438 * @} 00439 */ 00440 00441 /** @defgroup SAI_Block_FS_Offset SAI Block FS Offset 00442 * @{ 00443 */ 00444 #define SAI_FS_FIRSTBIT 0x00000000U 00445 #define SAI_FS_BEFOREFIRSTBIT ((uint32_t)SAI_xFRCR_FSOFF) 00446 /** 00447 * @} 00448 */ 00449 00450 /** @defgroup SAI_Block_Slot_Size SAI Block Slot Size 00451 * @{ 00452 */ 00453 #define SAI_SLOTSIZE_DATASIZE 0x00000000U 00454 #define SAI_SLOTSIZE_16B ((uint32_t)SAI_xSLOTR_SLOTSZ_0) 00455 #define SAI_SLOTSIZE_32B ((uint32_t)SAI_xSLOTR_SLOTSZ_1) 00456 /** 00457 * @} 00458 */ 00459 00460 /** @defgroup SAI_Block_Slot_Active SAI Block Slot Active 00461 * @{ 00462 */ 00463 #define SAI_SLOT_NOTACTIVE 0x00000000U 00464 #define SAI_SLOTACTIVE_0 0x00000001U 00465 #define SAI_SLOTACTIVE_1 0x00000002U 00466 #define SAI_SLOTACTIVE_2 0x00000004U 00467 #define SAI_SLOTACTIVE_3 0x00000008U 00468 #define SAI_SLOTACTIVE_4 0x00000010U 00469 #define SAI_SLOTACTIVE_5 0x00000020U 00470 #define SAI_SLOTACTIVE_6 0x00000040U 00471 #define SAI_SLOTACTIVE_7 0x00000080U 00472 #define SAI_SLOTACTIVE_8 0x00000100U 00473 #define SAI_SLOTACTIVE_9 0x00000200U 00474 #define SAI_SLOTACTIVE_10 0x00000400U 00475 #define SAI_SLOTACTIVE_11 0x00000800U 00476 #define SAI_SLOTACTIVE_12 0x00001000U 00477 #define SAI_SLOTACTIVE_13 0x00002000U 00478 #define SAI_SLOTACTIVE_14 0x00004000U 00479 #define SAI_SLOTACTIVE_15 0x00008000U 00480 #define SAI_SLOTACTIVE_ALL 0x0000FFFFU 00481 /** 00482 * @} 00483 */ 00484 00485 /** @defgroup SAI_Mono_Stereo_Mode SAI Mono Stereo Mode 00486 * @{ 00487 */ 00488 #define SAI_STEREOMODE 0x00000000U 00489 #define SAI_MONOMODE ((uint32_t)SAI_xCR1_MONO) 00490 /** 00491 * @} 00492 */ 00493 00494 /** @defgroup SAI_TRIState_Management SAI TRIState Management 00495 * @{ 00496 */ 00497 #define SAI_OUTPUT_NOTRELEASED 0x00000000U 00498 #define SAI_OUTPUT_RELEASED ((uint32_t)SAI_xCR2_TRIS) 00499 /** 00500 * @} 00501 */ 00502 00503 /** @defgroup SAI_Block_Fifo_Threshold SAI Block Fifo Threshold 00504 * @{ 00505 */ 00506 #define SAI_FIFOTHRESHOLD_EMPTY 0x00000000U 00507 #define SAI_FIFOTHRESHOLD_1QF ((uint32_t)(SAI_xCR2_FTH_0)) 00508 #define SAI_FIFOTHRESHOLD_HF ((uint32_t)(SAI_xCR2_FTH_1)) 00509 #define SAI_FIFOTHRESHOLD_3QF ((uint32_t)(SAI_xCR2_FTH_1 | SAI_xCR2_FTH_0)) 00510 #define SAI_FIFOTHRESHOLD_FULL ((uint32_t)(SAI_xCR2_FTH_2)) 00511 /** 00512 * @} 00513 */ 00514 00515 /** @defgroup SAI_Block_Companding_Mode SAI Block Companding Mode 00516 * @{ 00517 */ 00518 #define SAI_NOCOMPANDING 0x00000000U 00519 #define SAI_ULAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1)) 00520 #define SAI_ALAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0)) 00521 #define SAI_ULAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_CPL)) 00522 #define SAI_ALAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0 | SAI_xCR2_CPL)) 00523 /** 00524 * @} 00525 */ 00526 00527 /** @defgroup SAI_Block_Mute_Value SAI Block Mute Value 00528 * @{ 00529 */ 00530 #define SAI_ZERO_VALUE 0x00000000U 00531 #define SAI_LAST_SENT_VALUE ((uint32_t)SAI_xCR2_MUTEVAL) 00532 /** 00533 * @} 00534 */ 00535 00536 /** @defgroup SAI_Block_Interrupts_Definition SAI Block Interrupts Definition 00537 * @{ 00538 */ 00539 #define SAI_IT_OVRUDR ((uint32_t)SAI_xIMR_OVRUDRIE) 00540 #define SAI_IT_MUTEDET ((uint32_t)SAI_xIMR_MUTEDETIE) 00541 #define SAI_IT_WCKCFG ((uint32_t)SAI_xIMR_WCKCFGIE) 00542 #define SAI_IT_FREQ ((uint32_t)SAI_xIMR_FREQIE) 00543 #define SAI_IT_CNRDY ((uint32_t)SAI_xIMR_CNRDYIE) 00544 #define SAI_IT_AFSDET ((uint32_t)SAI_xIMR_AFSDETIE) 00545 #define SAI_IT_LFSDET ((uint32_t)SAI_xIMR_LFSDETIE) 00546 /** 00547 * @} 00548 */ 00549 00550 /** @defgroup SAI_Block_Flags_Definition SAI Block Flags Definition 00551 * @{ 00552 */ 00553 #define SAI_FLAG_OVRUDR ((uint32_t)SAI_xSR_OVRUDR) 00554 #define SAI_FLAG_MUTEDET ((uint32_t)SAI_xSR_MUTEDET) 00555 #define SAI_FLAG_WCKCFG ((uint32_t)SAI_xSR_WCKCFG) 00556 #define SAI_FLAG_FREQ ((uint32_t)SAI_xSR_FREQ) 00557 #define SAI_FLAG_CNRDY ((uint32_t)SAI_xSR_CNRDY) 00558 #define SAI_FLAG_AFSDET ((uint32_t)SAI_xSR_AFSDET) 00559 #define SAI_FLAG_LFSDET ((uint32_t)SAI_xSR_LFSDET) 00560 /** 00561 * @} 00562 */ 00563 00564 /** @defgroup SAI_Block_Fifo_Status_Level SAI Block Fifo Status Level 00565 * @{ 00566 */ 00567 #define SAI_FIFOSTATUS_EMPTY 0x00000000U 00568 #define SAI_FIFOSTATUS_LESS1QUARTERFULL 0x00010000U 00569 #define SAI_FIFOSTATUS_1QUARTERFULL 0x00020000U 00570 #define SAI_FIFOSTATUS_HALFFULL 0x00030000U 00571 #define SAI_FIFOSTATUS_3QUARTERFULL 0x00040000U 00572 #define SAI_FIFOSTATUS_FULL 0x00050000U 00573 /** 00574 * @} 00575 */ 00576 00577 /** 00578 * @} 00579 */ 00580 00581 /* Exported macro ------------------------------------------------------------*/ 00582 /** @defgroup SAI_Exported_Macros SAI Exported Macros 00583 * @brief macros to handle interrupts and specific configurations 00584 * @{ 00585 */ 00586 00587 /** @brief Reset SAI handle state 00588 * @param __HANDLE__ specifies the SAI Handle. 00589 * @retval None 00590 */ 00591 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) 00592 #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) do{ \ 00593 (__HANDLE__)->State = HAL_SAI_STATE_RESET; \ 00594 (__HANDLE__)->MspInitCallback = NULL; \ 00595 (__HANDLE__)->MspDeInitCallback = NULL; \ 00596 } while(0U) 00597 #else 00598 #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SAI_STATE_RESET) 00599 #endif /* USE_HAL_SAI_REGISTER_CALLBACKS */ 00600 00601 /** @brief Enable or disable the specified SAI interrupts. 00602 * @param __HANDLE__ specifies the SAI Handle. 00603 * @param __INTERRUPT__ specifies the interrupt source to enable or disable. 00604 * This parameter can be one of the following values: 00605 * @arg SAI_IT_OVRUDR: Overrun underrun interrupt enable 00606 * @arg SAI_IT_MUTEDET: Mute detection interrupt enable 00607 * @arg SAI_IT_WCKCFG: Wrong Clock Configuration interrupt enable 00608 * @arg SAI_IT_FREQ: FIFO request interrupt enable 00609 * @arg SAI_IT_CNRDY: Codec not ready interrupt enable 00610 * @arg SAI_IT_AFSDET: Anticipated frame synchronization detection interrupt enable 00611 * @arg SAI_IT_LFSDET: Late frame synchronization detection interrupt enable 00612 * @retval None 00613 */ 00614 #define __HAL_SAI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__)) 00615 #define __HAL_SAI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (~(__INTERRUPT__))) 00616 00617 /** @brief Check if the specified SAI interrupt source is enabled or disabled. 00618 * @param __HANDLE__ specifies the SAI Handle. 00619 * This parameter can be SAI where x: 1, 2, or 3 to select the SAI peripheral. 00620 * @param __INTERRUPT__ specifies the SAI interrupt source to check. 00621 * This parameter can be one of the following values: 00622 * @arg SAI_IT_OVRUDR: Overrun underrun interrupt enable 00623 * @arg SAI_IT_MUTEDET: Mute detection interrupt enable 00624 * @arg SAI_IT_WCKCFG: Wrong Clock Configuration interrupt enable 00625 * @arg SAI_IT_FREQ: FIFO request interrupt enable 00626 * @arg SAI_IT_CNRDY: Codec not ready interrupt enable 00627 * @arg SAI_IT_AFSDET: Anticipated frame synchronization detection interrupt enable 00628 * @arg SAI_IT_LFSDET: Late frame synchronization detection interrupt enable 00629 * @retval The new state of __INTERRUPT__ (TRUE or FALSE). 00630 */ 00631 #define __HAL_SAI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IMR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) 00632 00633 /** @brief Check whether the specified SAI flag is set or not. 00634 * @param __HANDLE__ specifies the SAI Handle. 00635 * @param __FLAG__ specifies the flag to check. 00636 * This parameter can be one of the following values: 00637 * @arg SAI_FLAG_OVRUDR: Overrun underrun flag. 00638 * @arg SAI_FLAG_MUTEDET: Mute detection flag. 00639 * @arg SAI_FLAG_WCKCFG: Wrong Clock Configuration flag. 00640 * @arg SAI_FLAG_FREQ: FIFO request flag. 00641 * @arg SAI_FLAG_CNRDY: Codec not ready flag. 00642 * @arg SAI_FLAG_AFSDET: Anticipated frame synchronization detection flag. 00643 * @arg SAI_FLAG_LFSDET: Late frame synchronization detection flag. 00644 * @retval The new state of __FLAG__ (TRUE or FALSE). 00645 */ 00646 #define __HAL_SAI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) 00647 00648 /** @brief Clear the specified SAI pending flag. 00649 * @param __HANDLE__ specifies the SAI Handle. 00650 * @param __FLAG__ specifies the flag to check. 00651 * This parameter can be any combination of the following values: 00652 * @arg SAI_FLAG_OVRUDR: Clear Overrun underrun 00653 * @arg SAI_FLAG_MUTEDET: Clear Mute detection 00654 * @arg SAI_FLAG_WCKCFG: Clear Wrong Clock Configuration 00655 * @arg SAI_FLAG_FREQ: Clear FIFO request 00656 * @arg SAI_FLAG_CNRDY: Clear Codec not ready 00657 * @arg SAI_FLAG_AFSDET: Clear Anticipated frame synchronization detection 00658 * @arg SAI_FLAG_LFSDET: Clear Late frame synchronization detection 00659 * @retval None 00660 */ 00661 #define __HAL_SAI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLRFR = (__FLAG__)) 00662 00663 /** @brief Enable SAI 00664 * @param __HANDLE__ specifies the SAI Handle. 00665 * @retval None 00666 */ 00667 #define __HAL_SAI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SAI_xCR1_SAIEN) 00668 00669 /** @brief Disable SAI 00670 * @param __HANDLE__ specifies the SAI Handle. 00671 * @retval None 00672 */ 00673 #define __HAL_SAI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~SAI_xCR1_SAIEN) 00674 00675 /** 00676 * @} 00677 */ 00678 00679 /* Include HAL SAI Extension module */ 00680 #include "stm32f4xx_hal_sai_ex.h" 00681 00682 /* Exported functions --------------------------------------------------------*/ 00683 /** @addtogroup SAI_Exported_Functions 00684 * @{ 00685 */ 00686 00687 /* Initialization/de-initialization functions **********************************/ 00688 /** @addtogroup SAI_Exported_Functions_Group1 00689 * @{ 00690 */ 00691 HAL_StatusTypeDef HAL_SAI_InitProtocol(SAI_HandleTypeDef *hsai, uint32_t protocol, uint32_t datasize, uint32_t nbslot); 00692 HAL_StatusTypeDef HAL_SAI_Init(SAI_HandleTypeDef *hsai); 00693 HAL_StatusTypeDef HAL_SAI_DeInit(SAI_HandleTypeDef *hsai); 00694 void HAL_SAI_MspInit(SAI_HandleTypeDef *hsai); 00695 void HAL_SAI_MspDeInit(SAI_HandleTypeDef *hsai); 00696 00697 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) 00698 /* SAI callbacks register/unregister functions ********************************/ 00699 HAL_StatusTypeDef HAL_SAI_RegisterCallback(SAI_HandleTypeDef *hsai, 00700 HAL_SAI_CallbackIDTypeDef CallbackID, 00701 pSAI_CallbackTypeDef pCallback); 00702 HAL_StatusTypeDef HAL_SAI_UnRegisterCallback(SAI_HandleTypeDef *hsai, 00703 HAL_SAI_CallbackIDTypeDef CallbackID); 00704 #endif /* USE_HAL_SAI_REGISTER_CALLBACKS */ 00705 /** 00706 * @} 00707 */ 00708 00709 /* I/O operation functions *****************************************************/ 00710 /** @addtogroup SAI_Exported_Functions_Group2 00711 * @{ 00712 */ 00713 /* Blocking mode: Polling */ 00714 HAL_StatusTypeDef HAL_SAI_Transmit(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout); 00715 HAL_StatusTypeDef HAL_SAI_Receive(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout); 00716 00717 /* Non-Blocking mode: Interrupt */ 00718 HAL_StatusTypeDef HAL_SAI_Transmit_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); 00719 HAL_StatusTypeDef HAL_SAI_Receive_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); 00720 00721 /* Non-Blocking mode: DMA */ 00722 HAL_StatusTypeDef HAL_SAI_Transmit_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); 00723 HAL_StatusTypeDef HAL_SAI_Receive_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); 00724 HAL_StatusTypeDef HAL_SAI_DMAPause(SAI_HandleTypeDef *hsai); 00725 HAL_StatusTypeDef HAL_SAI_DMAResume(SAI_HandleTypeDef *hsai); 00726 HAL_StatusTypeDef HAL_SAI_DMAStop(SAI_HandleTypeDef *hsai); 00727 00728 /* Abort function */ 00729 HAL_StatusTypeDef HAL_SAI_Abort(SAI_HandleTypeDef *hsai); 00730 00731 /* Mute management */ 00732 HAL_StatusTypeDef HAL_SAI_EnableTxMuteMode(SAI_HandleTypeDef *hsai, uint16_t val); 00733 HAL_StatusTypeDef HAL_SAI_DisableTxMuteMode(SAI_HandleTypeDef *hsai); 00734 HAL_StatusTypeDef HAL_SAI_EnableRxMuteMode(SAI_HandleTypeDef *hsai, SAIcallback callback, uint16_t counter); 00735 HAL_StatusTypeDef HAL_SAI_DisableRxMuteMode(SAI_HandleTypeDef *hsai); 00736 00737 /* SAI IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ 00738 void HAL_SAI_IRQHandler(SAI_HandleTypeDef *hsai); 00739 void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai); 00740 void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai); 00741 void HAL_SAI_RxHalfCpltCallback(SAI_HandleTypeDef *hsai); 00742 void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai); 00743 void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai); 00744 /** 00745 * @} 00746 */ 00747 00748 /** @addtogroup SAI_Exported_Functions_Group3 00749 * @{ 00750 */ 00751 /* Peripheral State functions ************************************************/ 00752 HAL_SAI_StateTypeDef HAL_SAI_GetState(SAI_HandleTypeDef *hsai); 00753 uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); 00754 /** 00755 * @} 00756 */ 00757 00758 /** 00759 * @} 00760 */ 00761 00762 /* Private macros ------------------------------------------------------------*/ 00763 /** @addtogroup SAI_Private_Macros 00764 * @{ 00765 */ 00766 #define IS_SAI_BLOCK_SYNCEXT(STATE) (((STATE) == SAI_SYNCEXT_DISABLE) ||\ 00767 ((STATE) == SAI_SYNCEXT_OUTBLOCKA_ENABLE) ||\ 00768 ((STATE) == SAI_SYNCEXT_OUTBLOCKB_ENABLE)) 00769 00770 #define IS_SAI_SUPPORTED_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_I2S_STANDARD) ||\ 00771 ((PROTOCOL) == SAI_I2S_MSBJUSTIFIED) ||\ 00772 ((PROTOCOL) == SAI_I2S_LSBJUSTIFIED) ||\ 00773 ((PROTOCOL) == SAI_PCM_LONG) ||\ 00774 ((PROTOCOL) == SAI_PCM_SHORT)) 00775 00776 #define IS_SAI_PROTOCOL_DATASIZE(DATASIZE) (((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BIT) ||\ 00777 ((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BITEXTENDED) ||\ 00778 ((DATASIZE) == SAI_PROTOCOL_DATASIZE_24BIT) ||\ 00779 ((DATASIZE) == SAI_PROTOCOL_DATASIZE_32BIT)) 00780 00781 #define IS_SAI_AUDIO_FREQUENCY(AUDIO) (((AUDIO) == SAI_AUDIO_FREQUENCY_192K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_96K) || \ 00782 ((AUDIO) == SAI_AUDIO_FREQUENCY_48K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_44K) || \ 00783 ((AUDIO) == SAI_AUDIO_FREQUENCY_32K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_22K) || \ 00784 ((AUDIO) == SAI_AUDIO_FREQUENCY_16K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_11K) || \ 00785 ((AUDIO) == SAI_AUDIO_FREQUENCY_8K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_MCKDIV)) 00786 00787 #define IS_SAI_BLOCK_MODE(MODE) (((MODE) == SAI_MODEMASTER_TX) || \ 00788 ((MODE) == SAI_MODEMASTER_RX) || \ 00789 ((MODE) == SAI_MODESLAVE_TX) || \ 00790 ((MODE) == SAI_MODESLAVE_RX)) 00791 00792 #define IS_SAI_BLOCK_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_FREE_PROTOCOL) || \ 00793 ((PROTOCOL) == SAI_AC97_PROTOCOL) || \ 00794 ((PROTOCOL) == SAI_SPDIF_PROTOCOL)) 00795 00796 #define IS_SAI_BLOCK_DATASIZE(DATASIZE) (((DATASIZE) == SAI_DATASIZE_8) || \ 00797 ((DATASIZE) == SAI_DATASIZE_10) || \ 00798 ((DATASIZE) == SAI_DATASIZE_16) || \ 00799 ((DATASIZE) == SAI_DATASIZE_20) || \ 00800 ((DATASIZE) == SAI_DATASIZE_24) || \ 00801 ((DATASIZE) == SAI_DATASIZE_32)) 00802 00803 #define IS_SAI_BLOCK_FIRST_BIT(BIT) (((BIT) == SAI_FIRSTBIT_MSB) || \ 00804 ((BIT) == SAI_FIRSTBIT_LSB)) 00805 00806 #define IS_SAI_BLOCK_CLOCK_STROBING(CLOCK) (((CLOCK) == SAI_CLOCKSTROBING_FALLINGEDGE) || \ 00807 ((CLOCK) == SAI_CLOCKSTROBING_RISINGEDGE)) 00808 00809 #define IS_SAI_BLOCK_SYNCHRO(SYNCHRO) (((SYNCHRO) == SAI_ASYNCHRONOUS) || \ 00810 ((SYNCHRO) == SAI_SYNCHRONOUS) || \ 00811 ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI1) ||\ 00812 ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI2)) 00813 00814 #define IS_SAI_BLOCK_OUTPUT_DRIVE(DRIVE) (((DRIVE) == SAI_OUTPUTDRIVE_DISABLE) || \ 00815 ((DRIVE) == SAI_OUTPUTDRIVE_ENABLE)) 00816 00817 #define IS_SAI_BLOCK_NODIVIDER(NODIVIDER) (((NODIVIDER) == SAI_MASTERDIVIDER_ENABLE) || \ 00818 ((NODIVIDER) == SAI_MASTERDIVIDER_DISABLE)) 00819 00820 #define IS_SAI_BLOCK_MUTE_COUNTER(COUNTER) ((COUNTER) <= 63U) 00821 00822 #define IS_SAI_BLOCK_MUTE_VALUE(VALUE) (((VALUE) == SAI_ZERO_VALUE) || \ 00823 ((VALUE) == SAI_LAST_SENT_VALUE)) 00824 00825 #define IS_SAI_BLOCK_COMPANDING_MODE(MODE) (((MODE) == SAI_NOCOMPANDING) || \ 00826 ((MODE) == SAI_ULAW_1CPL_COMPANDING) || \ 00827 ((MODE) == SAI_ALAW_1CPL_COMPANDING) || \ 00828 ((MODE) == SAI_ULAW_2CPL_COMPANDING) || \ 00829 ((MODE) == SAI_ALAW_2CPL_COMPANDING)) 00830 00831 #define IS_SAI_BLOCK_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == SAI_FIFOTHRESHOLD_EMPTY) || \ 00832 ((THRESHOLD) == SAI_FIFOTHRESHOLD_1QF) || \ 00833 ((THRESHOLD) == SAI_FIFOTHRESHOLD_HF) || \ 00834 ((THRESHOLD) == SAI_FIFOTHRESHOLD_3QF) || \ 00835 ((THRESHOLD) == SAI_FIFOTHRESHOLD_FULL)) 00836 00837 #define IS_SAI_BLOCK_TRISTATE_MANAGEMENT(STATE) (((STATE) == SAI_OUTPUT_NOTRELEASED) ||\ 00838 ((STATE) == SAI_OUTPUT_RELEASED)) 00839 00840 #define IS_SAI_MONO_STEREO_MODE(MODE) (((MODE) == SAI_MONOMODE) ||\ 00841 ((MODE) == SAI_STEREOMODE)) 00842 00843 #define IS_SAI_SLOT_ACTIVE(ACTIVE) ((ACTIVE) <= SAI_SLOTACTIVE_ALL) 00844 00845 #define IS_SAI_BLOCK_SLOT_NUMBER(NUMBER) ((1U <= (NUMBER)) && ((NUMBER) <= 16U)) 00846 00847 #define IS_SAI_BLOCK_SLOT_SIZE(SIZE) (((SIZE) == SAI_SLOTSIZE_DATASIZE) || \ 00848 ((SIZE) == SAI_SLOTSIZE_16B) || \ 00849 ((SIZE) == SAI_SLOTSIZE_32B)) 00850 00851 #define IS_SAI_BLOCK_FIRSTBIT_OFFSET(OFFSET) ((OFFSET) <= 24U) 00852 00853 #define IS_SAI_BLOCK_FS_OFFSET(OFFSET) (((OFFSET) == SAI_FS_FIRSTBIT) || \ 00854 ((OFFSET) == SAI_FS_BEFOREFIRSTBIT)) 00855 00856 #define IS_SAI_BLOCK_FS_POLARITY(POLARITY) (((POLARITY) == SAI_FS_ACTIVE_LOW) || \ 00857 ((POLARITY) == SAI_FS_ACTIVE_HIGH)) 00858 00859 #define IS_SAI_BLOCK_FS_DEFINITION(DEFINITION) (((DEFINITION) == SAI_FS_STARTFRAME) || \ 00860 ((DEFINITION) == SAI_FS_CHANNEL_IDENTIFICATION)) 00861 00862 #define IS_SAI_BLOCK_MASTER_DIVIDER(DIVIDER) ((DIVIDER) <= 15U) 00863 00864 #define IS_SAI_BLOCK_FRAME_LENGTH(LENGTH) ((8U <= (LENGTH)) && ((LENGTH) <= 256U)) 00865 00866 #define IS_SAI_BLOCK_ACTIVE_FRAME(LENGTH) ((1U <= (LENGTH)) && ((LENGTH) <= 128U)) 00867 00868 /** 00869 * @} 00870 */ 00871 00872 /* Private functions ---------------------------------------------------------*/ 00873 /** @defgroup SAI_Private_Functions SAI Private Functions 00874 * @{ 00875 */ 00876 00877 /** 00878 * @} 00879 */ 00880 00881 /** 00882 * @} 00883 */ 00884 00885 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F413xx || STM32F423xx */ 00886 00887 /** 00888 * @} 00889 */ 00890 00891 #ifdef __cplusplus 00892 } 00893 #endif 00894 00895 #endif /* __STM32F4xx_HAL_SAI_H */ 00896 00897 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/