STM32G474xx HAL用户手册
stm32g4xx_hal_i2s.h
转到此文件的文档。
00001 /**
00002   ******************************************************************************
00003   * @file    stm32g4xx_hal_i2s.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of I2S HAL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2019 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32G4xx_HAL_I2S_H
00021 #define STM32G4xx_HAL_I2S_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32g4xx_hal_def.h"
00029 
00030 #if defined(SPI_I2S_SUPPORT)
00031 /** @addtogroup STM32G4xx_HAL_Driver
00032   * @{
00033   */
00034 
00035 /** @addtogroup I2S
00036   * @{
00037   */
00038 
00039 /* Exported types ------------------------------------------------------------*/
00040 /** @defgroup I2S_Exported_Types I2S Exported Types
00041   * @{
00042   */
00043 
00044 /**
00045   * @brief I2S Init structure definition
00046   */
00047 typedef struct
00048 {
00049   uint32_t Mode;                /*!< Specifies the I2S operating mode.
00050                                      This parameter can be a value of @ref I2S_Mode */
00051 
00052   uint32_t Standard;            /*!< Specifies the standard used for the I2S communication.
00053                                      This parameter can be a value of @ref I2S_Standard */
00055 
00055   uint32_t DataFormat;          /*!< Specifies the data format for the I2S communication.
00056                                      This parameter can be a value of @ref I2S_Data_Format */
00058 
00059   uint32_t MCLKOutput;          /*!< Specifies whether the I2S MCLK output is enabled or not.
00060                                      This parameter can be a value of @ref I2S_MCLK_Output */
00061 
00062   uint32_t AudioFreq;           /*!< Specifies the frequency selected for the I2S communication.
00063                                      This parameter can be a value of @ref I2S_Audio_Frequency */
00064 
00065   uint32_t CPOL;                /*!< Specifies the idle state of the I2S clock.
00066                                      This parameter can be a value of @ref I2S_Clock_Polarity */
00067 } I2S_InitTypeDef;
00068 
00069 /**
00070   * @brief  HAL State structures definition
00071   */
00072 typedef enum
00073 {
00074   HAL_I2S_STATE_RESET      = 0x00U,  /*!< I2S not yet initialized or disabled                */
00075   HAL_I2S_STATE_READY      = 0x01U,  /*!< I2S initialized and ready for use                  */
00076   HAL_I2S_STATE_BUSY       = 0x02U,  /*!< I2S internal process is ongoing                    */
00077   HAL_I2S_STATE_BUSY_TX    = 0x03U,  /*!< Data Transmission process is ongoing               */
00078   HAL_I2S_STATE_BUSY_RX    = 0x04U,  /*!< Data Reception process is ongoing                  */
00079   HAL_I2S_STATE_TIMEOUT    = 0x06U,  /*!< I2S timeout state                                  */
00080   HAL_I2S_STATE_ERROR      = 0x07U   /*!< I2S error state                                    */
00081 } HAL_I2S_StateTypeDef;
00082 
00083 /**
00084   * @brief I2S handle Structure definition
00085   */
00086 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1)
00087 typedef struct __I2S_HandleTypeDef
00088 #else
00089 typedef struct
00090 #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
00091 {
00092   SPI_TypeDef                *Instance;    /*!< I2S registers base address */
00093 
00094   I2S_InitTypeDef            Init;         /*!< I2S communication parameters */
00095 
00096   uint16_t                   *pTxBuffPtr;  /*!< Pointer to I2S Tx transfer buffer */
00097 
00098   __IO uint16_t              TxXferSize;   /*!< I2S Tx transfer size */
00099 
00100   __IO uint16_t              TxXferCount;  /*!< I2S Tx transfer Counter */
00101 
00102   uint16_t                   *pRxBuffPtr;  /*!< Pointer to I2S Rx transfer buffer */
00103 
00104   __IO uint16_t              RxXferSize;   /*!< I2S Rx transfer size */
00105 
00106   __IO uint16_t              RxXferCount;  /*!< I2S Rx transfer counter
00107                                               (This field is initialized at the
00108                                                same value as transfer size at the
00109                                                beginning of the transfer and
00110                                                decremented when a sample is received
00111                                                NbSamplesReceived = RxBufferSize-RxBufferCount) */
00112   DMA_HandleTypeDef          *hdmatx;      /*!< I2S Tx DMA handle parameters */
00113 
00114   DMA_HandleTypeDef          *hdmarx;      /*!< I2S Rx DMA handle parameters */
00115 
00116   __IO HAL_LockTypeDef       Lock;         /*!< I2S locking object */
00117 
00118   __IO HAL_I2S_StateTypeDef  State;        /*!< I2S communication state */
00119 
<