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