stm32f7xx_hal_sai.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F7xx_HAL_SAI_H
22 #define __STM32F7xx_HAL_SAI_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 
29 /* Includes ------------------------------------------------------------------*/
30 #include "stm32f7xx_hal_def.h"
31 
40 /* Exported types ------------------------------------------------------------*/
48 typedef enum
49 {
56 
60 typedef void (*SAIcallback)(void);
61 
66 typedef struct
67 {
68  uint32_t AudioMode;
71  uint32_t Synchro;
74  uint32_t SynchroExt;
80  uint32_t OutputDrive;
85  uint32_t NoDivider;
94  uint32_t FIFOThreshold;
97  uint32_t AudioFrequency;
100  uint32_t Mckdiv;
105  uint32_t MonoStereoMode;
108  uint32_t CompandingMode;
111  uint32_t TriState;
114  /* This part of the structure is automatically filled if your are using the high level initialisation
115  function HAL_SAI_InitProtocol */
116 
117  uint32_t Protocol;
120  uint32_t DataSize;
123  uint32_t FirstBit;
126  uint32_t ClockStrobing;
137 typedef struct
138 {
139 
140  uint32_t FrameLength;
146  uint32_t ActiveFrameLength;
151  uint32_t FSDefinition;
154  uint32_t FSPolarity;
157  uint32_t FSOffset;
169 typedef struct
170 {
171  uint32_t FirstBitOffset;
174  uint32_t SlotSize;
177  uint32_t SlotNumber;
180  uint32_t SlotActive;
191 typedef struct __SAI_HandleTypeDef
192 {
201  uint8_t *pBuffPtr;
203  uint16_t XferSize;
205  uint16_t XferCount;
213  void (*InterruptServiceRoutine)(struct __SAI_HandleTypeDef *hsai); /* function pointer for IRQ handler */
214 
219  __IO uint32_t ErrorCode;
221 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1)
222  void (*RxCpltCallback)(struct __SAI_HandleTypeDef *hsai);
223  void (*RxHalfCpltCallback)(struct __SAI_HandleTypeDef *hsai);
224  void (*TxCpltCallback)(struct __SAI_HandleTypeDef *hsai);
225  void (*TxHalfCpltCallback)(struct __SAI_HandleTypeDef *hsai);
226  void (*ErrorCallback)(struct __SAI_HandleTypeDef *hsai);
227  void (*MspInitCallback)(struct __SAI_HandleTypeDef *hsai);
228  void (*MspDeInitCallback)(struct __SAI_HandleTypeDef *hsai);
229 #endif
235 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1)
236 
239 typedef enum
240 {
241  HAL_SAI_RX_COMPLETE_CB_ID = 0x00U,
242  HAL_SAI_RX_HALFCOMPLETE_CB_ID = 0x01U,
243  HAL_SAI_TX_COMPLETE_CB_ID = 0x02U,
244  HAL_SAI_TX_HALFCOMPLETE_CB_ID = 0x03U,
245  HAL_SAI_ERROR_CB_ID = 0x04U,
246  HAL_SAI_MSPINIT_CB_ID = 0x05U,
247  HAL_SAI_MSPDEINIT_CB_ID = 0x06U
248 } HAL_SAI_CallbackIDTypeDef;
249 
253 typedef void (*pSAI_CallbackTypeDef)(SAI_HandleTypeDef *hsai);
254 #endif
255 
260 /* Exported constants --------------------------------------------------------*/
261 
269 #define HAL_SAI_ERROR_NONE ((uint32_t)0x00000000U)
270 #define HAL_SAI_ERROR_OVR ((uint32_t)0x00000001U)
271 #define HAL_SAI_ERROR_UDR ((uint32_t)0x00000002U)
272 #define HAL_SAI_ERROR_AFSDET ((uint32_t)0x00000004U)
273 #define HAL_SAI_ERROR_LFSDET ((uint32_t)0x00000008U)
274 #define HAL_SAI_ERROR_CNREADY ((uint32_t)0x00000010U)
275 #define HAL_SAI_ERROR_WCKCFG ((uint32_t)0x00000020U)
276 #define HAL_SAI_ERROR_TIMEOUT ((uint32_t)0x00000040U)
277 #define HAL_SAI_ERROR_DMA ((uint32_t)0x00000080U)
278 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1)
279 #define HAL_SAI_ERROR_INVALID_CALLBACK 0x00000100U
280 #endif
281 
288 #define SAI_SYNCEXT_DISABLE 0
289 #define SAI_SYNCEXT_OUTBLOCKA_ENABLE 1
290 #define SAI_SYNCEXT_OUTBLOCKB_ENABLE 2
291 
298 #define SAI_I2S_STANDARD 0
299 #define SAI_I2S_MSBJUSTIFIED 1
300 #define SAI_I2S_LSBJUSTIFIED 2
301 #define SAI_PCM_LONG 3
302 #define SAI_PCM_SHORT 4
303 
310 #define SAI_PROTOCOL_DATASIZE_16BIT 0
311 #define SAI_PROTOCOL_DATASIZE_16BITEXTENDED 1
312 #define SAI_PROTOCOL_DATASIZE_24BIT 2
313 #define SAI_PROTOCOL_DATASIZE_32BIT 3
314 
321 #define SAI_AUDIO_FREQUENCY_192K ((uint32_t)192000U)
322 #define SAI_AUDIO_FREQUENCY_96K ((uint32_t)96000U)
323 #define SAI_AUDIO_FREQUENCY_48K ((uint32_t)48000U)
324 #define SAI_AUDIO_FREQUENCY_44K ((uint32_t)44100U)
325 #define SAI_AUDIO_FREQUENCY_32K ((uint32_t)32000U)
326 #define SAI_AUDIO_FREQUENCY_22K ((uint32_t)22050U)
327 #define SAI_AUDIO_FREQUENCY_16K ((uint32_t)16000U)
328 #define SAI_AUDIO_FREQUENCY_11K ((uint32_t)11025U)
329 #define SAI_AUDIO_FREQUENCY_8K ((uint32_t)8000U)
330 #define SAI_AUDIO_FREQUENCY_MCKDIV ((uint32_t)0U)
331 
338 #define SAI_MODEMASTER_TX ((uint32_t)0x00000000U)
339 #define SAI_MODEMASTER_RX ((uint32_t)SAI_xCR1_MODE_0)
340 #define SAI_MODESLAVE_TX ((uint32_t)SAI_xCR1_MODE_1)
341 #define SAI_MODESLAVE_RX ((uint32_t)(SAI_xCR1_MODE_1 | SAI_xCR1_MODE_0))
342 
350 #define SAI_FREE_PROTOCOL ((uint32_t)0x00000000U)
351 #define SAI_SPDIF_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_0)
352 #define SAI_AC97_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_1)
353 
360 #define SAI_DATASIZE_8 ((uint32_t)SAI_xCR1_DS_1)
361 #define SAI_DATASIZE_10 ((uint32_t)(SAI_xCR1_DS_1 | SAI_xCR1_DS_0))
362 #define SAI_DATASIZE_16 ((uint32_t)SAI_xCR1_DS_2)
363 #define SAI_DATASIZE_20 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_0))
364 #define SAI_DATASIZE_24 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1))
365 #define SAI_DATASIZE_32 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1 | SAI_xCR1_DS_0))
366 
373 #define SAI_FIRSTBIT_MSB ((uint32_t)0x00000000U)
374 #define SAI_FIRSTBIT_LSB ((uint32_t)SAI_xCR1_LSBFIRST)
375 
382 #define SAI_CLOCKSTROBING_FALLINGEDGE 0
383 #define SAI_CLOCKSTROBING_RISINGEDGE 1
384 
391 #define SAI_ASYNCHRONOUS 0
392 #define SAI_SYNCHRONOUS 1
393 #define SAI_SYNCHRONOUS_EXT_SAI1 2
394 #define SAI_SYNCHRONOUS_EXT_SAI2 3
402 #define SAI_OUTPUTDRIVE_DISABLE ((uint32_t)0x00000000U)
403 #define SAI_OUTPUTDRIVE_ENABLE ((uint32_t)SAI_xCR1_OUTDRIV)
404 
411 #define SAI_MASTERDIVIDER_ENABLE ((uint32_t)0x00000000U)
412 #define SAI_MASTERDIVIDER_DISABLE ((uint32_t)SAI_xCR1_NODIV)
413 
420 #define SAI_FS_STARTFRAME ((uint32_t)0x00000000U)
421 #define SAI_FS_CHANNEL_IDENTIFICATION ((uint32_t)SAI_xFRCR_FSDEF)
422 
429 #define SAI_FS_ACTIVE_LOW ((uint32_t)0x00000000U)
430 #define SAI_FS_ACTIVE_HIGH ((uint32_t)SAI_xFRCR_FSPOL)
431 
438 #define SAI_FS_FIRSTBIT ((uint32_t)0x00000000U)
439 #define SAI_FS_BEFOREFIRSTBIT ((uint32_t)SAI_xFRCR_FSOFF)
440 
447 #define SAI_SLOTSIZE_DATASIZE ((uint32_t)0x00000000U)
448 #define SAI_SLOTSIZE_16B ((uint32_t)SAI_xSLOTR_SLOTSZ_0)
449 #define SAI_SLOTSIZE_32B ((uint32_t)SAI_xSLOTR_SLOTSZ_1)
450 
457 #define SAI_SLOT_NOTACTIVE ((uint32_t)0x00000000U)
458 #define SAI_SLOTACTIVE_0 ((uint32_t)0x00000001U)
459 #define SAI_SLOTACTIVE_1 ((uint32_t)0x00000002U)
460 #define SAI_SLOTACTIVE_2 ((uint32_t)0x00000004U)
461 #define SAI_SLOTACTIVE_3 ((uint32_t)0x00000008U)
462 #define SAI_SLOTACTIVE_4 ((uint32_t)0x00000010U)
463 #define SAI_SLOTACTIVE_5 ((uint32_t)0x00000020U)
464 #define SAI_SLOTACTIVE_6 ((uint32_t)0x00000040U)
465 #define SAI_SLOTACTIVE_7 ((uint32_t)0x00000080U)
466 #define SAI_SLOTACTIVE_8 ((uint32_t)0x00000100U)
467 #define SAI_SLOTACTIVE_9 ((uint32_t)0x00000200U)
468 #define SAI_SLOTACTIVE_10 ((uint32_t)0x00000400U)
469 #define SAI_SLOTACTIVE_11 ((uint32_t)0x00000800U)
470 #define SAI_SLOTACTIVE_12 ((uint32_t)0x00001000U)
471 #define SAI_SLOTACTIVE_13 ((uint32_t)0x00002000U)
472 #define SAI_SLOTACTIVE_14 ((uint32_t)0x00004000U)
473 #define SAI_SLOTACTIVE_15 ((uint32_t)0x00008000U)
474 #define SAI_SLOTACTIVE_ALL ((uint32_t)0x0000FFFFU)
475 
482 #define SAI_STEREOMODE ((uint32_t)0x00000000U)
483 #define SAI_MONOMODE ((uint32_t)SAI_xCR1_MONO)
484 
491 #define SAI_OUTPUT_NOTRELEASED ((uint32_t)0x00000000U)
492 #define SAI_OUTPUT_RELEASED ((uint32_t)SAI_xCR2_TRIS)
493 
500 #define SAI_FIFOTHRESHOLD_EMPTY ((uint32_t)0x00000000U)
501 #define SAI_FIFOTHRESHOLD_1QF ((uint32_t)(SAI_xCR2_FTH_0))
502 #define SAI_FIFOTHRESHOLD_HF ((uint32_t)(SAI_xCR2_FTH_1))
503 #define SAI_FIFOTHRESHOLD_3QF ((uint32_t)(SAI_xCR2_FTH_1 | SAI_xCR2_FTH_0))
504 #define SAI_FIFOTHRESHOLD_FULL ((uint32_t)(SAI_xCR2_FTH_2))
505 
512 #define SAI_NOCOMPANDING ((uint32_t)0x00000000U)
513 #define SAI_ULAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1))
514 #define SAI_ALAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0))
515 #define SAI_ULAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_CPL))
516 #define SAI_ALAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0 | SAI_xCR2_CPL))
517 
524 #define SAI_ZERO_VALUE ((uint32_t)0x00000000U)
525 #define SAI_LAST_SENT_VALUE ((uint32_t)SAI_xCR2_MUTEVAL)
526 
533 #define SAI_IT_OVRUDR ((uint32_t)SAI_xIMR_OVRUDRIE)
534 #define SAI_IT_MUTEDET ((uint32_t)SAI_xIMR_MUTEDETIE)
535 #define SAI_IT_WCKCFG ((uint32_t)SAI_xIMR_WCKCFGIE)
536 #define SAI_IT_FREQ ((uint32_t)SAI_xIMR_FREQIE)
537 #define SAI_IT_CNRDY ((uint32_t)SAI_xIMR_CNRDYIE)
538 #define SAI_IT_AFSDET ((uint32_t)SAI_xIMR_AFSDETIE)
539 #define SAI_IT_LFSDET ((uint32_t)SAI_xIMR_LFSDETIE)
540 
547 #define SAI_FLAG_OVRUDR ((uint32_t)SAI_xSR_OVRUDR)
548 #define SAI_FLAG_MUTEDET ((uint32_t)SAI_xSR_MUTEDET)
549 #define SAI_FLAG_WCKCFG ((uint32_t)SAI_xSR_WCKCFG)
550 #define SAI_FLAG_FREQ ((uint32_t)SAI_xSR_FREQ)
551 #define SAI_FLAG_CNRDY ((uint32_t)SAI_xSR_CNRDY)
552 #define SAI_FLAG_AFSDET ((uint32_t)SAI_xSR_AFSDET)
553 #define SAI_FLAG_LFSDET ((uint32_t)SAI_xSR_LFSDET)
554 
561 #define SAI_FIFOSTATUS_EMPTY ((uint32_t)0x00000000U)
562 #define SAI_FIFOSTATUS_LESS1QUARTERFULL ((uint32_t)0x00010000U)
563 #define SAI_FIFOSTATUS_1QUARTERFULL ((uint32_t)0x00020000U)
564 #define SAI_FIFOSTATUS_HALFFULL ((uint32_t)0x00030000U)
565 #define SAI_FIFOSTATUS_3QUARTERFULL ((uint32_t)0x00040000U)
566 #define SAI_FIFOSTATUS_FULL ((uint32_t)0x00050000U)
567 
575 /* Exported macro ------------------------------------------------------------*/
585 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1)
586 #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) do{ \
587  (__HANDLE__)->State = HAL_SAI_STATE_RESET; \
588  (__HANDLE__)->MspInitCallback = NULL; \
589  (__HANDLE__)->MspDeInitCallback = NULL; \
590  } while(0U)
591 #else
592 #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SAI_STATE_RESET)
593 #endif /* USE_HAL_SAI_REGISTER_CALLBACKS */
594 
608 #define __HAL_SAI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__))
609 #define __HAL_SAI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (~(__INTERRUPT__)))
610 
624 #define __HAL_SAI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IMR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
625 
639 #define __HAL_SAI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
640 
655 #define __HAL_SAI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLRFR = (__FLAG__))
656 
657 #define __HAL_SAI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SAI_xCR1_SAIEN)
658 #define __HAL_SAI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~SAI_xCR1_SAIEN)
659 
664 /* Exported functions --------------------------------------------------------*/
669 /* Initialization/de-initialization functions ********************************/
673 HAL_StatusTypeDef HAL_SAI_InitProtocol(SAI_HandleTypeDef *hsai, uint32_t protocol, uint32_t datasize, uint32_t nbslot);
678 
679 #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1)
680 /* SAI callbacks register/unregister functions ********************************/
681 HAL_StatusTypeDef HAL_SAI_RegisterCallback(SAI_HandleTypeDef *hsai,
682  HAL_SAI_CallbackIDTypeDef CallbackID,
683  pSAI_CallbackTypeDef pCallback);
684 HAL_StatusTypeDef HAL_SAI_UnRegisterCallback(SAI_HandleTypeDef *hsai,
685  HAL_SAI_CallbackIDTypeDef CallbackID);
686 #endif
687 
691 /* I/O operation functions ***************************************************/
692 
696 /* Blocking mode: Polling */
697 HAL_StatusTypeDef HAL_SAI_Transmit(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout);
698 HAL_StatusTypeDef HAL_SAI_Receive(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout);
699 
700 /* Non-Blocking mode: Interrupt */
701 HAL_StatusTypeDef HAL_SAI_Transmit_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size);
702 HAL_StatusTypeDef HAL_SAI_Receive_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size);
703 
704 /* Non-Blocking mode: DMA */
705 HAL_StatusTypeDef HAL_SAI_Transmit_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size);
706 HAL_StatusTypeDef HAL_SAI_Receive_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size);
710 
711 /* Abort function */
713 
714 /* Mute management */
719 
720 /* SAI IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */
734 /* Peripheral State functions ************************************************/
736 uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai);
745 /* Private macros ------------------------------------------------------------*/
749 #define IS_SAI_BLOCK_SYNCEXT(STATE) (((STATE) == SAI_SYNCEXT_DISABLE) ||\
750  ((STATE) == SAI_SYNCEXT_OUTBLOCKA_ENABLE) ||\
751  ((STATE) == SAI_SYNCEXT_OUTBLOCKB_ENABLE))
752 
753 #define IS_SAI_SUPPORTED_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_I2S_STANDARD) ||\
754  ((PROTOCOL) == SAI_I2S_MSBJUSTIFIED) ||\
755  ((PROTOCOL) == SAI_I2S_LSBJUSTIFIED) ||\
756  ((PROTOCOL) == SAI_PCM_LONG) ||\
757  ((PROTOCOL) == SAI_PCM_SHORT))
758 
759 #define IS_SAI_PROTOCOL_DATASIZE(DATASIZE) (((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BIT) ||\
760  ((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BITEXTENDED) ||\
761  ((DATASIZE) == SAI_PROTOCOL_DATASIZE_24BIT) ||\
762  ((DATASIZE) == SAI_PROTOCOL_DATASIZE_32BIT))
763 
764 #define IS_SAI_AUDIO_FREQUENCY(AUDIO) (((AUDIO) == SAI_AUDIO_FREQUENCY_192K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_96K) || \
765  ((AUDIO) == SAI_AUDIO_FREQUENCY_48K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_44K) || \
766  ((AUDIO) == SAI_AUDIO_FREQUENCY_32K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_22K) || \
767  ((AUDIO) == SAI_AUDIO_FREQUENCY_16K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_11K) || \
768  ((AUDIO) == SAI_AUDIO_FREQUENCY_8K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_MCKDIV))
769 
770 #define IS_SAI_BLOCK_MODE(MODE) (((MODE) == SAI_MODEMASTER_TX) || \
771  ((MODE) == SAI_MODEMASTER_RX) || \
772  ((MODE) == SAI_MODESLAVE_TX) || \
773  ((MODE) == SAI_MODESLAVE_RX))
774 
775 #define IS_SAI_BLOCK_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_FREE_PROTOCOL) || \
776  ((PROTOCOL) == SAI_AC97_PROTOCOL) || \
777  ((PROTOCOL) == SAI_SPDIF_PROTOCOL))
778 
779 #define IS_SAI_BLOCK_DATASIZE(DATASIZE) (((DATASIZE) == SAI_DATASIZE_8) || \
780  ((DATASIZE) == SAI_DATASIZE_10) || \
781  ((DATASIZE) == SAI_DATASIZE_16) || \
782  ((DATASIZE) == SAI_DATASIZE_20) || \
783  ((DATASIZE) == SAI_DATASIZE_24) || \
784  ((DATASIZE) == SAI_DATASIZE_32))
785 
786 #define IS_SAI_BLOCK_FIRST_BIT(BIT) (((BIT) == SAI_FIRSTBIT_MSB) || \
787  ((BIT) == SAI_FIRSTBIT_LSB))
788 
789 #define IS_SAI_BLOCK_CLOCK_STROBING(CLOCK) (((CLOCK) == SAI_CLOCKSTROBING_FALLINGEDGE) || \
790  ((CLOCK) == SAI_CLOCKSTROBING_RISINGEDGE))
791 
792 #define IS_SAI_BLOCK_SYNCHRO(SYNCHRO) (((SYNCHRO) == SAI_ASYNCHRONOUS) || \
793  ((SYNCHRO) == SAI_SYNCHRONOUS) || \
794  ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI1) || \
795  ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI2))
796 
797 #define IS_SAI_BLOCK_OUTPUT_DRIVE(DRIVE) (((DRIVE) == SAI_OUTPUTDRIVE_DISABLE) || \
798  ((DRIVE) == SAI_OUTPUTDRIVE_ENABLE))
799 
800 #define IS_SAI_BLOCK_NODIVIDER(NODIVIDER) (((NODIVIDER) == SAI_MASTERDIVIDER_ENABLE) || \
801  ((NODIVIDER) == SAI_MASTERDIVIDER_DISABLE))
802 
803 #define IS_SAI_BLOCK_MUTE_COUNTER(COUNTER) ((COUNTER) <= 63)
804 
805 #define IS_SAI_BLOCK_MUTE_VALUE(VALUE) (((VALUE) == SAI_ZERO_VALUE) || \
806  ((VALUE) == SAI_LAST_SENT_VALUE))
807 
808 #define IS_SAI_BLOCK_COMPANDING_MODE(MODE) (((MODE) == SAI_NOCOMPANDING) || \
809  ((MODE) == SAI_ULAW_1CPL_COMPANDING) || \
810  ((MODE) == SAI_ALAW_1CPL_COMPANDING) || \
811  ((MODE) == SAI_ULAW_2CPL_COMPANDING) || \
812  ((MODE) == SAI_ALAW_2CPL_COMPANDING))
813 
814 #define IS_SAI_BLOCK_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == SAI_FIFOTHRESHOLD_EMPTY) || \
815  ((THRESHOLD) == SAI_FIFOTHRESHOLD_1QF) || \
816  ((THRESHOLD) == SAI_FIFOTHRESHOLD_HF) || \
817  ((THRESHOLD) == SAI_FIFOTHRESHOLD_3QF) || \
818  ((THRESHOLD) == SAI_FIFOTHRESHOLD_FULL))
819 
820 #define IS_SAI_BLOCK_TRISTATE_MANAGEMENT(STATE) (((STATE) == SAI_OUTPUT_NOTRELEASED) ||\
821  ((STATE) == SAI_OUTPUT_RELEASED))
822 
823 #define IS_SAI_MONO_STEREO_MODE(MODE) (((MODE) == SAI_MONOMODE) ||\
824  ((MODE) == SAI_STEREOMODE))
825 
826 #define IS_SAI_SLOT_ACTIVE(ACTIVE) ((ACTIVE) <= SAI_SLOTACTIVE_ALL)
827 
828 #define IS_SAI_BLOCK_SLOT_NUMBER(NUMBER) ((1 <= (NUMBER)) && ((NUMBER) <= 16))
829 
830 #define IS_SAI_BLOCK_SLOT_SIZE(SIZE) (((SIZE) == SAI_SLOTSIZE_DATASIZE) || \
831  ((SIZE) == SAI_SLOTSIZE_16B) || \
832  ((SIZE) == SAI_SLOTSIZE_32B))
833 
834 #define IS_SAI_BLOCK_FIRSTBIT_OFFSET(OFFSET) ((OFFSET) <= 24)
835 
836 #define IS_SAI_BLOCK_FS_OFFSET(OFFSET) (((OFFSET) == SAI_FS_FIRSTBIT) || \
837  ((OFFSET) == SAI_FS_BEFOREFIRSTBIT))
838 
839 #define IS_SAI_BLOCK_FS_POLARITY(POLARITY) (((POLARITY) == SAI_FS_ACTIVE_LOW) || \
840  ((POLARITY) == SAI_FS_ACTIVE_HIGH))
841 
842 #define IS_SAI_BLOCK_FS_DEFINITION(DEFINITION) (((DEFINITION) == SAI_FS_STARTFRAME) || \
843  ((DEFINITION) == SAI_FS_CHANNEL_IDENTIFICATION))
844 
845 #define IS_SAI_BLOCK_MASTER_DIVIDER(DIVIDER) ((DIVIDER) <= 15U)
846 
847 #define IS_SAI_BLOCK_FRAME_LENGTH(LENGTH) ((8 <= (LENGTH)) && ((LENGTH) <= 256))
848 
849 #define IS_SAI_BLOCK_ACTIVE_FRAME(LENGTH) ((1 <= (LENGTH)) && ((LENGTH) <= 128))
850 
855 /* Private functions ---------------------------------------------------------*/
872 #ifdef __cplusplus
873 }
874 #endif
875 
876 #endif /* __STM32F7xx_HAL_SAI_H */
877 
878 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
__SAI_HandleTypeDef::mutecallback
SAIcallback mutecallback
Definition: stm32f7xx_hal_sai.h:211
HAL_SAI_DisableRxMuteMode
HAL_StatusTypeDef HAL_SAI_DisableRxMuteMode(SAI_HandleTypeDef *hsai)
SAI_InitTypeDef::MonoStereoMode
uint32_t MonoStereoMode
Definition: stm32f7xx_hal_sai.h:105
HAL_SAI_DisableTxMuteMode
HAL_StatusTypeDef HAL_SAI_DisableTxMuteMode(SAI_HandleTypeDef *hsai)
__IO
#define __IO
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:237
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
SAI_InitTypeDef::ClockStrobing
uint32_t ClockStrobing
Definition: stm32f7xx_hal_sai.h:126
HAL_SAI_MspInit
void HAL_SAI_MspInit(SAI_HandleTypeDef *hsai)
Definition: stm32h7xx_hal_msp.c:398
SAI_InitTypeDef::Mckdiv
uint32_t Mckdiv
Definition: stm32f7xx_hal_sai.h:100
HAL_SAI_DMAStop
HAL_StatusTypeDef HAL_SAI_DMAStop(SAI_HandleTypeDef *hsai)
SAI_InitTypeDef::CompandingMode
uint32_t CompandingMode
Definition: stm32f7xx_hal_sai.h:108
SAI_FrameInitTypeDef::ActiveFrameLength
uint32_t ActiveFrameLength
Definition: stm32f7xx_hal_sai.h:146
__DMA_HandleTypeDef
DMA handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:139
__SAI_HandleTypeDef::hdmatx
DMA_HandleTypeDef * hdmatx
Definition: stm32f7xx_hal_sai.h:207
HAL_SAI_DMAPause
HAL_StatusTypeDef HAL_SAI_DMAPause(SAI_HandleTypeDef *hsai)
__SAI_HandleTypeDef::ErrorCode
__IO uint32_t ErrorCode
Definition: stm32f7xx_hal_sai.h:219
HAL_SAI_RxHalfCpltCallback
void HAL_SAI_RxHalfCpltCallback(SAI_HandleTypeDef *hsai)
Half reception complete callback.
Definition: stm32f769i_discovery_audio.c:1593
SAI_HandleTypeDef
struct __SAI_HandleTypeDef SAI_HandleTypeDef
SAI_InitTypeDef::AudioFrequency
uint32_t AudioFrequency
Definition: stm32f7xx_hal_sai.h:97
SAI_FrameInitTypeDef::FSDefinition
uint32_t FSDefinition
Definition: stm32f7xx_hal_sai.h:151
HAL_SAI_TxCpltCallback
void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai)
Tx Transfer completed callbacks.
Definition: stm32469i_discovery_audio.c:606
HAL_SAI_DeInit
HAL_StatusTypeDef HAL_SAI_DeInit(SAI_HandleTypeDef *hsai)
__SAI_HandleTypeDef::pBuffPtr
uint8_t * pBuffPtr
Definition: stm32f7xx_hal_sai.h:201
HAL_SAI_GetState
HAL_SAI_StateTypeDef HAL_SAI_GetState(SAI_HandleTypeDef *hsai)
SAI_InitTypeDef::Protocol
uint32_t Protocol
Definition: stm32f7xx_hal_sai.h:117
__SAI_HandleTypeDef::State
__IO HAL_SAI_StateTypeDef State
Definition: stm32f7xx_hal_sai.h:217
HAL_SAI_STATE_READY
@ HAL_SAI_STATE_READY
Definition: stm32f7xx_hal_sai.h:51
HAL_SAI_Receive
HAL_StatusTypeDef HAL_SAI_Receive(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout)
HAL_LockTypeDef
HAL_LockTypeDef
HAL Lock structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:51
SAI_SlotInitTypeDef::SlotNumber
uint32_t SlotNumber
Definition: stm32f7xx_hal_sai.h:177
HAL_SAI_IRQHandler
void HAL_SAI_IRQHandler(SAI_HandleTypeDef *hsai)
__SAI_HandleTypeDef::hdmarx
DMA_HandleTypeDef * hdmarx
Definition: stm32f7xx_hal_sai.h:209
HAL_SAI_ErrorCallback
void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai)
SAI error callbacks.
Definition: stm32469i_discovery_audio.c:628
__SAI_HandleTypeDef::Instance
SAI_Block_TypeDef * Instance
Definition: stm32f7xx_hal_sai.h:193
__SAI_HandleTypeDef::XferSize
uint16_t XferSize
Definition: stm32f7xx_hal_sai.h:203
SAI_InitTypeDef::FIFOThreshold
uint32_t FIFOThreshold
Definition: stm32f7xx_hal_sai.h:94
SAI_InitTypeDef::SynchroExt
uint32_t SynchroExt
Definition: stm32f7xx_hal_sai.h:74
SAI_FrameInitTypeDef::FSOffset
uint32_t FSOffset
Definition: stm32f7xx_hal_sai.h:157
SAI_InitTypeDef::Synchro
uint32_t Synchro
Definition: stm32f7xx_hal_sai.h:71
HAL_SAI_STATE_BUSY_RX
@ HAL_SAI_STATE_BUSY_RX
Definition: stm32f7xx_hal_sai.h:54
SAI_FrameInitTypeDef
Definition: stm32f7xx_hal_sai.h:137
HAL_SAI_InitProtocol
HAL_StatusTypeDef HAL_SAI_InitProtocol(SAI_HandleTypeDef *hsai, uint32_t protocol, uint32_t datasize, uint32_t nbslot)
__SAI_HandleTypeDef::Init
SAI_InitTypeDef Init
Definition: stm32f7xx_hal_sai.h:195
__SAI_HandleTypeDef
Definition: stm32f7xx_hal_sai.h:191
__SAI_HandleTypeDef::Lock
HAL_LockTypeDef Lock
Definition: stm32f7xx_hal_sai.h:215
SAI_InitTypeDef::OutputDrive
uint32_t OutputDrive
Definition: stm32f7xx_hal_sai.h:80
SAI_InitTypeDef::NoDivider
uint32_t NoDivider
Definition: stm32f7xx_hal_sai.h:85
HAL_SAI_GetError
uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai)
HAL_SAI_DMAResume
HAL_StatusTypeDef HAL_SAI_DMAResume(SAI_HandleTypeDef *hsai)
__SAI_HandleTypeDef::XferCount
uint16_t XferCount
Definition: stm32f7xx_hal_sai.h:205
SAI_Block_TypeDef
Definition: stm32f469xx.h:848
HAL_SAI_Transmit_IT
HAL_StatusTypeDef HAL_SAI_Transmit_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size)
SAI_InitTypeDef
Definition: stm32f7xx_hal_sai.h:66
HAL_SAI_EnableTxMuteMode
HAL_StatusTypeDef HAL_SAI_EnableTxMuteMode(SAI_HandleTypeDef *hsai, uint16_t val)
SAI_SlotInitTypeDef
Definition: stm32f7xx_hal_sai.h:169
HAL_SAI_RxCpltCallback
void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai)
Reception complete callback.
Definition: stm32f769i_discovery_audio.c:1605
SAI_InitTypeDef::TriState
uint32_t TriState
Definition: stm32f7xx_hal_sai.h:111
__SAI_HandleTypeDef::InterruptServiceRoutine
void(* InterruptServiceRoutine)(struct __SAI_HandleTypeDef *hsai)
Definition: stm32f7xx_hal_sai.h:213
SAI_InitTypeDef::DataSize
uint32_t DataSize
Definition: stm32f7xx_hal_sai.h:120
SAI_SlotInitTypeDef::SlotSize
uint32_t SlotSize
Definition: stm32f7xx_hal_sai.h:174
HAL_SAI_TxHalfCpltCallback
void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai)
Tx Half Transfer completed callbacks.
Definition: stm32469i_discovery_audio.c:617
HAL_SAI_Transmit
HAL_StatusTypeDef HAL_SAI_Transmit(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout)
SAI_SlotInitTypeDef::SlotActive
uint32_t SlotActive
Definition: stm32f7xx_hal_sai.h:180
SAI_SlotInitTypeDef::FirstBitOffset
uint32_t FirstBitOffset
Definition: stm32f7xx_hal_sai.h:171
HAL_SAI_Receive_DMA
HAL_StatusTypeDef HAL_SAI_Receive_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size)
HAL_SAI_STATE_BUSY_TX
@ HAL_SAI_STATE_BUSY_TX
Definition: stm32f7xx_hal_sai.h:53
SAI_FrameInitTypeDef::FSPolarity
uint32_t FSPolarity
Definition: stm32f7xx_hal_sai.h:154
stm32f7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_SAI_StateTypeDef
HAL_SAI_StateTypeDef
HAL State structures definition.
Definition: stm32f7xx_hal_sai.h:48
HAL_SAI_Init
HAL_StatusTypeDef HAL_SAI_Init(SAI_HandleTypeDef *hsai)
HAL_SAI_STATE_BUSY
@ HAL_SAI_STATE_BUSY
Definition: stm32f7xx_hal_sai.h:52
HAL_SAI_Receive_IT
HAL_StatusTypeDef HAL_SAI_Receive_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size)
SAI_InitTypeDef::AudioMode
uint32_t AudioMode
Definition: stm32f7xx_hal_sai.h:68
SAI_FrameInitTypeDef::FrameLength
uint32_t FrameLength
Definition: stm32f7xx_hal_sai.h:140
HAL_SAI_STATE_RESET
@ HAL_SAI_STATE_RESET
Definition: stm32f7xx_hal_sai.h:50
SAIcallback
void(* SAIcallback)(void)
SAI Callback prototype.
Definition: stm32f7xx_hal_sai.h:60
HAL_SAI_MspDeInit
void HAL_SAI_MspDeInit(SAI_HandleTypeDef *hsai)
Definition: stm32h7xx_hal_msp.c:456
HAL_SAI_Abort
HAL_StatusTypeDef HAL_SAI_Abort(SAI_HandleTypeDef *hsai)
__SAI_HandleTypeDef::SlotInit
SAI_SlotInitTypeDef SlotInit
Definition: stm32f7xx_hal_sai.h:199
__SAI_HandleTypeDef::FrameInit
SAI_FrameInitTypeDef FrameInit
Definition: stm32f7xx_hal_sai.h:197
SAI_InitTypeDef::FirstBit
uint32_t FirstBit
Definition: stm32f7xx_hal_sai.h:123
HAL_SAI_Transmit_DMA
HAL_StatusTypeDef HAL_SAI_Transmit_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size)
HAL_SAI_EnableRxMuteMode
HAL_StatusTypeDef HAL_SAI_EnableRxMuteMode(SAI_HandleTypeDef *hsai, SAIcallback callback, uint16_t counter)


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53