Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_i2s_ex.h@0:bb348c97df44, 2020-09-16 (annotated)
- Committer:
- lypinator
- Date:
- Wed Sep 16 01:11:49 2020 +0000
- Revision:
- 0:bb348c97df44
Added PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lypinator | 0:bb348c97df44 | 1 | /** |
lypinator | 0:bb348c97df44 | 2 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 3 | * @file stm32f4xx_hal_i2s_ex.h |
lypinator | 0:bb348c97df44 | 4 | * @author MCD Application Team |
lypinator | 0:bb348c97df44 | 5 | * @brief Header file of I2S HAL module. |
lypinator | 0:bb348c97df44 | 6 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 7 | * @attention |
lypinator | 0:bb348c97df44 | 8 | * |
lypinator | 0:bb348c97df44 | 9 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
lypinator | 0:bb348c97df44 | 10 | * |
lypinator | 0:bb348c97df44 | 11 | * Redistribution and use in source and binary forms, with or without modification, |
lypinator | 0:bb348c97df44 | 12 | * are permitted provided that the following conditions are met: |
lypinator | 0:bb348c97df44 | 13 | * 1. Redistributions of source code must retain the above copyright notice, |
lypinator | 0:bb348c97df44 | 14 | * this list of conditions and the following disclaimer. |
lypinator | 0:bb348c97df44 | 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
lypinator | 0:bb348c97df44 | 16 | * this list of conditions and the following disclaimer in the documentation |
lypinator | 0:bb348c97df44 | 17 | * and/or other materials provided with the distribution. |
lypinator | 0:bb348c97df44 | 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
lypinator | 0:bb348c97df44 | 19 | * may be used to endorse or promote products derived from this software |
lypinator | 0:bb348c97df44 | 20 | * without specific prior written permission. |
lypinator | 0:bb348c97df44 | 21 | * |
lypinator | 0:bb348c97df44 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
lypinator | 0:bb348c97df44 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
lypinator | 0:bb348c97df44 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
lypinator | 0:bb348c97df44 | 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
lypinator | 0:bb348c97df44 | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
lypinator | 0:bb348c97df44 | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
lypinator | 0:bb348c97df44 | 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
lypinator | 0:bb348c97df44 | 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
lypinator | 0:bb348c97df44 | 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
lypinator | 0:bb348c97df44 | 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
lypinator | 0:bb348c97df44 | 32 | * |
lypinator | 0:bb348c97df44 | 33 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 34 | */ |
lypinator | 0:bb348c97df44 | 35 | |
lypinator | 0:bb348c97df44 | 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
lypinator | 0:bb348c97df44 | 37 | #ifndef __STM32F4xx_HAL_I2S_EX_H |
lypinator | 0:bb348c97df44 | 38 | #define __STM32F4xx_HAL_I2S_EX_H |
lypinator | 0:bb348c97df44 | 39 | |
lypinator | 0:bb348c97df44 | 40 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 41 | extern "C" { |
lypinator | 0:bb348c97df44 | 42 | #endif |
lypinator | 0:bb348c97df44 | 43 | |
lypinator | 0:bb348c97df44 | 44 | /* Includes ------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 45 | #include "stm32f4xx_hal_def.h" |
lypinator | 0:bb348c97df44 | 46 | |
lypinator | 0:bb348c97df44 | 47 | /** @addtogroup STM32F4xx_HAL_Driver |
lypinator | 0:bb348c97df44 | 48 | * @{ |
lypinator | 0:bb348c97df44 | 49 | */ |
lypinator | 0:bb348c97df44 | 50 | #if defined(SPI_I2S_FULLDUPLEX_SUPPORT) |
lypinator | 0:bb348c97df44 | 51 | /** @addtogroup I2SEx I2SEx |
lypinator | 0:bb348c97df44 | 52 | * @{ |
lypinator | 0:bb348c97df44 | 53 | */ |
lypinator | 0:bb348c97df44 | 54 | |
lypinator | 0:bb348c97df44 | 55 | /* Exported types ------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 56 | /* Exported constants --------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 57 | /* Exported macros -----------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 58 | /** @defgroup I2SEx_Exported_Macros I2S Extended Exported Macros |
lypinator | 0:bb348c97df44 | 59 | * @{ |
lypinator | 0:bb348c97df44 | 60 | */ |
lypinator | 0:bb348c97df44 | 61 | |
lypinator | 0:bb348c97df44 | 62 | #define I2SxEXT(__INSTANCE__) ((__INSTANCE__) == (SPI2)? (SPI_TypeDef *)(I2S2ext_BASE): (SPI_TypeDef *)(I2S3ext_BASE)) |
lypinator | 0:bb348c97df44 | 63 | |
lypinator | 0:bb348c97df44 | 64 | /** @brief Enable or disable the specified I2SExt peripheral. |
lypinator | 0:bb348c97df44 | 65 | * @param __HANDLE__ specifies the I2S Handle. |
lypinator | 0:bb348c97df44 | 66 | * @retval None |
lypinator | 0:bb348c97df44 | 67 | */ |
lypinator | 0:bb348c97df44 | 68 | #define __HAL_I2SEXT_ENABLE(__HANDLE__) (I2SxEXT((__HANDLE__)->Instance)->I2SCFGR |= SPI_I2SCFGR_I2SE) |
lypinator | 0:bb348c97df44 | 69 | #define __HAL_I2SEXT_DISABLE(__HANDLE__) (I2SxEXT((__HANDLE__)->Instance)->I2SCFGR &= ~SPI_I2SCFGR_I2SE) |
lypinator | 0:bb348c97df44 | 70 | |
lypinator | 0:bb348c97df44 | 71 | /** @brief Enable or disable the specified I2SExt interrupts. |
lypinator | 0:bb348c97df44 | 72 | * @param __HANDLE__ specifies the I2S Handle. |
lypinator | 0:bb348c97df44 | 73 | * @param __INTERRUPT__ specifies the interrupt source to enable or disable. |
lypinator | 0:bb348c97df44 | 74 | * This parameter can be one of the following values: |
lypinator | 0:bb348c97df44 | 75 | * @arg I2S_IT_TXE: Tx buffer empty interrupt enable |
lypinator | 0:bb348c97df44 | 76 | * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable |
lypinator | 0:bb348c97df44 | 77 | * @arg I2S_IT_ERR: Error interrupt enable |
lypinator | 0:bb348c97df44 | 78 | * @retval None |
lypinator | 0:bb348c97df44 | 79 | */ |
lypinator | 0:bb348c97df44 | 80 | #define __HAL_I2SEXT_ENABLE_IT(__HANDLE__, __INTERRUPT__) (I2SxEXT((__HANDLE__)->Instance)->CR2 |= (__INTERRUPT__)) |
lypinator | 0:bb348c97df44 | 81 | #define __HAL_I2SEXT_DISABLE_IT(__HANDLE__, __INTERRUPT__) (I2SxEXT((__HANDLE__)->Instance)->CR2 &= ~(__INTERRUPT__)) |
lypinator | 0:bb348c97df44 | 82 | |
lypinator | 0:bb348c97df44 | 83 | /** @brief Checks if the specified I2SExt interrupt source is enabled or disabled. |
lypinator | 0:bb348c97df44 | 84 | * @param __HANDLE__ specifies the I2S Handle. |
lypinator | 0:bb348c97df44 | 85 | * This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral. |
lypinator | 0:bb348c97df44 | 86 | * @param __INTERRUPT__ specifies the I2S interrupt source to check. |
lypinator | 0:bb348c97df44 | 87 | * This parameter can be one of the following values: |
lypinator | 0:bb348c97df44 | 88 | * @arg I2S_IT_TXE: Tx buffer empty interrupt enable |
lypinator | 0:bb348c97df44 | 89 | * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable |
lypinator | 0:bb348c97df44 | 90 | * @arg I2S_IT_ERR: Error interrupt enable |
lypinator | 0:bb348c97df44 | 91 | * @retval The new state of __IT__ (TRUE or FALSE). |
lypinator | 0:bb348c97df44 | 92 | */ |
lypinator | 0:bb348c97df44 | 93 | #define __HAL_I2SEXT_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((I2SxEXT((__HANDLE__)->Instance)->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
lypinator | 0:bb348c97df44 | 94 | |
lypinator | 0:bb348c97df44 | 95 | /** @brief Checks whether the specified I2SExt flag is set or not. |
lypinator | 0:bb348c97df44 | 96 | * @param __HANDLE__ specifies the I2S Handle. |
lypinator | 0:bb348c97df44 | 97 | * @param __FLAG__ specifies the flag to check. |
lypinator | 0:bb348c97df44 | 98 | * This parameter can be one of the following values: |
lypinator | 0:bb348c97df44 | 99 | * @arg I2S_FLAG_RXNE: Receive buffer not empty flag |
lypinator | 0:bb348c97df44 | 100 | * @arg I2S_FLAG_TXE: Transmit buffer empty flag |
lypinator | 0:bb348c97df44 | 101 | * @arg I2S_FLAG_UDR: Underrun flag |
lypinator | 0:bb348c97df44 | 102 | * @arg I2S_FLAG_OVR: Overrun flag |
lypinator | 0:bb348c97df44 | 103 | * @arg I2S_FLAG_FRE: Frame error flag |
lypinator | 0:bb348c97df44 | 104 | * @arg I2S_FLAG_CHSIDE: Channel Side flag |
lypinator | 0:bb348c97df44 | 105 | * @arg I2S_FLAG_BSY: Busy flag |
lypinator | 0:bb348c97df44 | 106 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
lypinator | 0:bb348c97df44 | 107 | */ |
lypinator | 0:bb348c97df44 | 108 | #define __HAL_I2SEXT_GET_FLAG(__HANDLE__, __FLAG__) (((I2SxEXT((__HANDLE__)->Instance)->SR) & (__FLAG__)) == (__FLAG__)) |
lypinator | 0:bb348c97df44 | 109 | |
lypinator | 0:bb348c97df44 | 110 | /** @brief Clears the I2SExt OVR pending flag. |
lypinator | 0:bb348c97df44 | 111 | * @param __HANDLE__ specifies the I2S Handle. |
lypinator | 0:bb348c97df44 | 112 | * @retval None |
lypinator | 0:bb348c97df44 | 113 | */ |
lypinator | 0:bb348c97df44 | 114 | #define __HAL_I2SEXT_CLEAR_OVRFLAG(__HANDLE__) do{ \ |
lypinator | 0:bb348c97df44 | 115 | __IO uint32_t tmpreg_ovr = 0x00U; \ |
lypinator | 0:bb348c97df44 | 116 | tmpreg_ovr = I2SxEXT((__HANDLE__)->Instance)->DR;\ |
lypinator | 0:bb348c97df44 | 117 | tmpreg_ovr = I2SxEXT((__HANDLE__)->Instance)->SR;\ |
lypinator | 0:bb348c97df44 | 118 | UNUSED(tmpreg_ovr); \ |
lypinator | 0:bb348c97df44 | 119 | }while(0U) |
lypinator | 0:bb348c97df44 | 120 | /** @brief Clears the I2SExt UDR pending flag. |
lypinator | 0:bb348c97df44 | 121 | * @param __HANDLE__ specifies the I2S Handle. |
lypinator | 0:bb348c97df44 | 122 | * @retval None |
lypinator | 0:bb348c97df44 | 123 | */ |
lypinator | 0:bb348c97df44 | 124 | #define __HAL_I2SEXT_CLEAR_UDRFLAG(__HANDLE__) do{ \ |
lypinator | 0:bb348c97df44 | 125 | __IO uint32_t tmpreg_udr = 0x00U; \ |
lypinator | 0:bb348c97df44 | 126 | tmpreg_udr = I2SxEXT((__HANDLE__)->Instance)->SR;\ |
lypinator | 0:bb348c97df44 | 127 | UNUSED(tmpreg_udr); \ |
lypinator | 0:bb348c97df44 | 128 | }while(0U) |
lypinator | 0:bb348c97df44 | 129 | /** |
lypinator | 0:bb348c97df44 | 130 | * @} |
lypinator | 0:bb348c97df44 | 131 | */ |
lypinator | 0:bb348c97df44 | 132 | |
lypinator | 0:bb348c97df44 | 133 | /* Exported functions --------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 134 | /** @addtogroup I2SEx_Exported_Functions I2S Extended Exported Functions |
lypinator | 0:bb348c97df44 | 135 | * @{ |
lypinator | 0:bb348c97df44 | 136 | */ |
lypinator | 0:bb348c97df44 | 137 | |
lypinator | 0:bb348c97df44 | 138 | /** @addtogroup I2SEx_Exported_Functions_Group1 I2S Extended IO operation functions |
lypinator | 0:bb348c97df44 | 139 | * @{ |
lypinator | 0:bb348c97df44 | 140 | */ |
lypinator | 0:bb348c97df44 | 141 | |
lypinator | 0:bb348c97df44 | 142 | /* Extended features functions *************************************************/ |
lypinator | 0:bb348c97df44 | 143 | /* Blocking mode: Polling */ |
lypinator | 0:bb348c97df44 | 144 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, |
lypinator | 0:bb348c97df44 | 145 | uint16_t Size, uint32_t Timeout); |
lypinator | 0:bb348c97df44 | 146 | /* Non-Blocking mode: Interrupt */ |
lypinator | 0:bb348c97df44 | 147 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, |
lypinator | 0:bb348c97df44 | 148 | uint16_t Size); |
lypinator | 0:bb348c97df44 | 149 | /* Non-Blocking mode: DMA */ |
lypinator | 0:bb348c97df44 | 150 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, |
lypinator | 0:bb348c97df44 | 151 | uint16_t Size); |
lypinator | 0:bb348c97df44 | 152 | /* I2S IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ |
lypinator | 0:bb348c97df44 | 153 | void HAL_I2SEx_FullDuplex_IRQHandler(I2S_HandleTypeDef *hi2s); |
lypinator | 0:bb348c97df44 | 154 | void HAL_I2SEx_TxRxHalfCpltCallback(I2S_HandleTypeDef *hi2s); |
lypinator | 0:bb348c97df44 | 155 | void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s); |
lypinator | 0:bb348c97df44 | 156 | /** |
lypinator | 0:bb348c97df44 | 157 | * @} |
lypinator | 0:bb348c97df44 | 158 | */ |
lypinator | 0:bb348c97df44 | 159 | |
lypinator | 0:bb348c97df44 | 160 | /** |
lypinator | 0:bb348c97df44 | 161 | * @} |
lypinator | 0:bb348c97df44 | 162 | */ |
lypinator | 0:bb348c97df44 | 163 | /* Private types -------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 164 | /* Private variables ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 165 | /* Private constants ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 166 | /* Private macros ------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 167 | |
lypinator | 0:bb348c97df44 | 168 | /** |
lypinator | 0:bb348c97df44 | 169 | * @} |
lypinator | 0:bb348c97df44 | 170 | */ |
lypinator | 0:bb348c97df44 | 171 | |
lypinator | 0:bb348c97df44 | 172 | /* Private functions ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 173 | |
lypinator | 0:bb348c97df44 | 174 | /** |
lypinator | 0:bb348c97df44 | 175 | * @} |
lypinator | 0:bb348c97df44 | 176 | */ |
lypinator | 0:bb348c97df44 | 177 | |
lypinator | 0:bb348c97df44 | 178 | #endif /* SPI_I2S_FULLDUPLEX_SUPPORT */ |
lypinator | 0:bb348c97df44 | 179 | /** |
lypinator | 0:bb348c97df44 | 180 | * @} |
lypinator | 0:bb348c97df44 | 181 | */ |
lypinator | 0:bb348c97df44 | 182 | |
lypinator | 0:bb348c97df44 | 183 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 184 | } |
lypinator | 0:bb348c97df44 | 185 | #endif |
lypinator | 0:bb348c97df44 | 186 | |
lypinator | 0:bb348c97df44 | 187 | |
lypinator | 0:bb348c97df44 | 188 | #endif /* __STM32F4xx_HAL_I2S_EX_H */ |
lypinator | 0:bb348c97df44 | 189 | |
lypinator | 0:bb348c97df44 | 190 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |