mbed library sources
Fork of mbed-src by
Diff: targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_i2s.c
- Revision:
- 441:d2c15dda23c1
- Parent:
- 392:2b59412bb664
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_i2s.c Tue Dec 16 08:15:08 2014 +0000 +++ b/targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_i2s.c Tue Jan 06 16:15:36 2015 +0000 @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f0xx_hal_i2s.c * @author MCD Application Team - * @version V1.1.0 - * @date 03-Oct-2014 + * @version V1.2.0 + * @date 11-December-2014 * @brief I2S HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Integrated Interchip Sound (I2S) peripheral: @@ -93,7 +93,7 @@ *** I2S HAL driver macros list *** ============================================= [..] - Below the list of most used macros in USART HAL driver. + Below the list of most used macros in I2S HAL driver. (+) __HAL_I2S_ENABLE: Enable the specified SPI peripheral (in I2S mode) (+) __HAL_I2S_DISABLE: Disable the specified SPI peripheral (in I2S mode) @@ -138,6 +138,14 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32f0xx_hal.h" +#ifdef HAL_I2S_MODULE_ENABLED + +#if defined(STM32F031x6) || defined(STM32F038xx) || \ + defined(STM32F051x8) || defined(STM32F058xx) || \ + defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \ + defined(STM32F042x6) || defined(STM32F048xx) || \ + defined(STM32F091xC) || defined(STM32F098xx) + /** @addtogroup STM32F0xx_HAL_Driver * @{ */ @@ -147,19 +155,14 @@ * @{ */ -#ifdef HAL_I2S_MODULE_ENABLED - -#if defined(STM32F031x6) || defined(STM32F038xx) || \ - defined(STM32F051x8) || defined(STM32F058xx) || \ - defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \ - defined(STM32F042x6) || defined(STM32F048xx) || \ - defined(STM32F091xC) || defined(STM32F098xx) - /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ +/** @defgroup I2S_Private_Functions I2S Private Functions + * @{ + */ static void I2S_DMATxCplt(DMA_HandleTypeDef *hdma); static void I2S_DMATxHalfCplt(DMA_HandleTypeDef *hdma); static void I2S_DMARxCplt(DMA_HandleTypeDef *hdma); @@ -168,8 +171,11 @@ static void I2S_Transmit_IT(I2S_HandleTypeDef *hi2s); static void I2S_Receive_IT(I2S_HandleTypeDef *hi2s); static HAL_StatusTypeDef I2S_WaitFlagStateUntilTimeout(I2S_HandleTypeDef *hi2s, uint32_t Flag, uint32_t State, uint32_t Timeout); +/** + * @} + */ -/* Private functions ---------------------------------------------------------*/ +/* Exported functions ---------------------------------------------------------*/ /** @defgroup I2S_Exported_Functions I2S Exported Functions * @{ @@ -216,7 +222,7 @@ uint32_t tmp = 0, i2sclk = 0; /* Check the I2S handle allocation */ - if(hi2s == HAL_NULL) + if(hi2s == NULL) { return HAL_ERROR; } @@ -329,7 +335,7 @@ HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s) { /* Check the I2S handle allocation */ - if(hi2s == HAL_NULL) + if(hi2s == NULL) { return HAL_ERROR; } @@ -443,7 +449,7 @@ */ HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout) { - if((pData == HAL_NULL ) || (Size == 0)) + if((pData == NULL ) || (Size == 0)) { return HAL_ERROR; } @@ -533,7 +539,7 @@ */ HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout) { - if((pData == HAL_NULL ) || (Size == 0)) + if((pData == NULL ) || (Size == 0)) { return HAL_ERROR; } @@ -611,7 +617,7 @@ */ HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) { - if((pData == HAL_NULL) || (Size == 0)) + if((pData == NULL) || (Size == 0)) { return HAL_ERROR; } @@ -678,7 +684,7 @@ */ HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) { - if((pData == HAL_NULL) || (Size == 0)) + if((pData == NULL) || (Size == 0)) { return HAL_ERROR; } @@ -743,7 +749,7 @@ */ HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) { - if((pData == HAL_NULL) || (Size == 0)) + if((pData == NULL) || (Size == 0)) { return HAL_ERROR; } @@ -824,7 +830,7 @@ */ HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size) { - if((pData == HAL_NULL) || (Size == 0)) + if((pData == NULL) || (Size == 0)) { return HAL_ERROR; } @@ -981,12 +987,12 @@ __HAL_DMA_DISABLE(hi2s->hdmarx); /* Abort the I2S DMA tx channel */ - if(hi2s->hdmatx != HAL_NULL) + if(hi2s->hdmatx != NULL) { HAL_DMA_Abort(hi2s->hdmatx); } /* Abort the I2S DMA rx channel */ - if(hi2s->hdmarx != HAL_NULL) + if(hi2s->hdmarx != NULL) { HAL_DMA_Abort(hi2s->hdmarx); } @@ -1157,7 +1163,7 @@ * the configuration information for I2S module * @retval I2S Error Code */ -HAL_I2S_ErrorTypeDef HAL_I2S_GetError(I2S_HandleTypeDef *hi2s) +uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s) { return hi2s->ErrorCode; } @@ -1169,8 +1175,7 @@ * @} */ - -/** @defgroup I2S_Private_Functions I2S Private Functions +/** @addtogroup I2S_Private_Functions I2S Private Functions * @{ */ /** @@ -1365,13 +1370,6 @@ * @} */ -#endif /* defined(STM32F031x6) || defined(STM32F038xx) || */ - /* defined(STM32F051x8) || defined(STM32F058xx) || */ - /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || */ - /* defined(STM32F042x6) || defined(STM32F048xx) || */ - /* defined(STM32F091xC) || defined(STM32F098xx) */ - -#endif /* HAL_I2S_MODULE_ENABLED */ /** * @} */ @@ -1380,4 +1378,12 @@ * @} */ +#endif /* defined(STM32F031x6) || defined(STM32F038xx) || */ + /* defined(STM32F051x8) || defined(STM32F058xx) || */ + /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || */ + /* defined(STM32F042x6) || defined(STM32F048xx) || */ + /* defined(STM32F091xC) || defined(STM32F098xx) */ + +#endif /* HAL_I2S_MODULE_ENABLED */ + /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/