mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
AnnaBridge
Date:
Wed Jun 21 17:31:38 2017 +0100
Revision:
145:64910690c574
Parent:
128:9bcdf88f62b0
Release 145 of the mbed library.

Who changed what in which revision?

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