my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
90:cb3d968589d8
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

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