mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Committer:
janekm
Date:
Tue Sep 16 22:42:01 2014 +0000
Revision:
310:6188e0254baa
Parent:
237:f3da66175598
N/A

Who changed what in which revision?

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