mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri May 30 15:30:09 2014 +0100
Revision:
218:44081b78fdc2
Parent:
205:c41fc65bcfb4
Synchronized with git revision d854859072d318241476ccc5f335965444d4c1d8

Full URL: https://github.com/mbedmicro/mbed/commit/d854859072d318241476ccc5f335965444d4c1d8/

[NUCLEO_F072RB] Update CubeF0 HAL driver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 205:c41fc65bcfb4 1 /**
mbed_official 205:c41fc65bcfb4 2 ******************************************************************************
mbed_official 205:c41fc65bcfb4 3 * @file stm32f0xx_hal_def.h
mbed_official 205:c41fc65bcfb4 4 * @author MCD Application Team
mbed_official 205:c41fc65bcfb4 5 * @version V1.0.0
mbed_official 218:44081b78fdc2 6 * @date 28-May-2014
mbed_official 205:c41fc65bcfb4 7 * @brief This file contains HAL common defines, enumeration, macros and
mbed_official 205:c41fc65bcfb4 8 * structures definitions.
mbed_official 205:c41fc65bcfb4 9 ******************************************************************************
mbed_official 205:c41fc65bcfb4 10 * @attention
mbed_official 205:c41fc65bcfb4 11 *
mbed_official 205:c41fc65bcfb4 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 205:c41fc65bcfb4 13 *
mbed_official 205:c41fc65bcfb4 14 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 205:c41fc65bcfb4 15 * are permitted provided that the following conditions are met:
mbed_official 205:c41fc65bcfb4 16 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 205:c41fc65bcfb4 17 * this list of conditions and the following disclaimer.
mbed_official 205:c41fc65bcfb4 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 205:c41fc65bcfb4 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 205:c41fc65bcfb4 20 * and/or other materials provided with the distribution.
mbed_official 205:c41fc65bcfb4 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 205:c41fc65bcfb4 22 * may be used to endorse or promote products derived from this software
mbed_official 205:c41fc65bcfb4 23 * without specific prior written permission.
mbed_official 205:c41fc65bcfb4 24 *
mbed_official 205:c41fc65bcfb4 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 205:c41fc65bcfb4 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 205:c41fc65bcfb4 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 205:c41fc65bcfb4 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 205:c41fc65bcfb4 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 205:c41fc65bcfb4 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 205:c41fc65bcfb4 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 205:c41fc65bcfb4 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 205:c41fc65bcfb4 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 205:c41fc65bcfb4 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 205:c41fc65bcfb4 35 *
mbed_official 205:c41fc65bcfb4 36 ******************************************************************************
mbed_official 205:c41fc65bcfb4 37 */
mbed_official 205:c41fc65bcfb4 38
mbed_official 205:c41fc65bcfb4 39 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 205:c41fc65bcfb4 40 #ifndef __STM32F0xx_HAL_DEF
mbed_official 205:c41fc65bcfb4 41 #define __STM32F0xx_HAL_DEF
mbed_official 205:c41fc65bcfb4 42
mbed_official 205:c41fc65bcfb4 43 #ifdef __cplusplus
mbed_official 205:c41fc65bcfb4 44 extern "C" {
mbed_official 205:c41fc65bcfb4 45 #endif
mbed_official 205:c41fc65bcfb4 46
mbed_official 205:c41fc65bcfb4 47 /* Includes ------------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 48 #include "stm32f0xx.h"
mbed_official 205:c41fc65bcfb4 49
mbed_official 205:c41fc65bcfb4 50 /* Exported types ------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 51
mbed_official 205:c41fc65bcfb4 52 /**
mbed_official 205:c41fc65bcfb4 53 * @brief HAL Status structures definition
mbed_official 205:c41fc65bcfb4 54 */
mbed_official 205:c41fc65bcfb4 55 typedef enum
mbed_official 205:c41fc65bcfb4 56 {
mbed_official 205:c41fc65bcfb4 57 HAL_OK = 0x00,
mbed_official 205:c41fc65bcfb4 58 HAL_ERROR = 0x01,
mbed_official 205:c41fc65bcfb4 59 HAL_BUSY = 0x02,
mbed_official 205:c41fc65bcfb4 60 HAL_TIMEOUT = 0x03
mbed_official 205:c41fc65bcfb4 61 } HAL_StatusTypeDef;
mbed_official 205:c41fc65bcfb4 62
mbed_official 205:c41fc65bcfb4 63 /**
mbed_official 205:c41fc65bcfb4 64 * @brief HAL Lock structures definition
mbed_official 205:c41fc65bcfb4 65 */
mbed_official 205:c41fc65bcfb4 66 typedef enum
mbed_official 205:c41fc65bcfb4 67 {
mbed_official 205:c41fc65bcfb4 68 HAL_UNLOCKED = 0x00,
mbed_official 205:c41fc65bcfb4 69 HAL_LOCKED = 0x01
mbed_official 205:c41fc65bcfb4 70 } HAL_LockTypeDef;
mbed_official 205:c41fc65bcfb4 71
mbed_official 205:c41fc65bcfb4 72 /* Exported macro ------------------------------------------------------------*/
mbed_official 205:c41fc65bcfb4 73 #ifndef NULL
mbed_official 205:c41fc65bcfb4 74 #define NULL (void *) 0
mbed_official 205:c41fc65bcfb4 75 #endif
mbed_official 205:c41fc65bcfb4 76
mbed_official 205:c41fc65bcfb4 77 #define HAL_MAX_DELAY 0xFFFFFFFF
mbed_official 205:c41fc65bcfb4 78
mbed_official 205:c41fc65bcfb4 79 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
mbed_official 205:c41fc65bcfb4 80 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
mbed_official 205:c41fc65bcfb4 81
mbed_official 205:c41fc65bcfb4 82 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
mbed_official 205:c41fc65bcfb4 83 do{ \
mbed_official 205:c41fc65bcfb4 84 (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
mbed_official 205:c41fc65bcfb4 85 (__DMA_HANDLE_).Parent = (__HANDLE__); \
mbed_official 205:c41fc65bcfb4 86 } while(0)
mbed_official 205:c41fc65bcfb4 87
mbed_official 205:c41fc65bcfb4 88 #if (USE_RTOS == 1)
mbed_official 205:c41fc65bcfb4 89 #error " USE_RTOS should be 0 in the current HAL release "
mbed_official 205:c41fc65bcfb4 90 #else
mbed_official 205:c41fc65bcfb4 91 #define __HAL_LOCK(__HANDLE__) \
mbed_official 205:c41fc65bcfb4 92 do{ \
mbed_official 205:c41fc65bcfb4 93 if((__HANDLE__)->Lock == HAL_LOCKED) \
mbed_official 205:c41fc65bcfb4 94 { \
mbed_official 205:c41fc65bcfb4 95 return HAL_BUSY; \
mbed_official 205:c41fc65bcfb4 96 } \
mbed_official 205:c41fc65bcfb4 97 else \
mbed_official 205:c41fc65bcfb4 98 { \
mbed_official 205:c41fc65bcfb4 99 (__HANDLE__)->Lock = HAL_LOCKED; \
mbed_official 205:c41fc65bcfb4 100 } \
mbed_official 205:c41fc65bcfb4 101 }while (0)
mbed_official 205:c41fc65bcfb4 102
mbed_official 205:c41fc65bcfb4 103 #define __HAL_UNLOCK(__HANDLE__) \
mbed_official 205:c41fc65bcfb4 104 do{ \
mbed_official 205:c41fc65bcfb4 105 (__HANDLE__)->Lock = HAL_UNLOCKED; \
mbed_official 205:c41fc65bcfb4 106 }while (0)
mbed_official 205:c41fc65bcfb4 107 #endif /* USE_RTOS */
mbed_official 205:c41fc65bcfb4 108
mbed_official 205:c41fc65bcfb4 109 #if defined ( __GNUC__ )
mbed_official 205:c41fc65bcfb4 110 #ifndef __weak
mbed_official 205:c41fc65bcfb4 111 #define __weak __attribute__((weak))
mbed_official 205:c41fc65bcfb4 112 #endif /* __weak */
mbed_official 205:c41fc65bcfb4 113 #ifndef __packed
mbed_official 205:c41fc65bcfb4 114 #define __packed __attribute__((__packed__))
mbed_official 205:c41fc65bcfb4 115 #endif /* __packed */
mbed_official 205:c41fc65bcfb4 116 #endif /* __GNUC__ */
mbed_official 205:c41fc65bcfb4 117
mbed_official 205:c41fc65bcfb4 118
mbed_official 205:c41fc65bcfb4 119 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
mbed_official 205:c41fc65bcfb4 120 #if defined (__GNUC__) /* GNU Compiler */
mbed_official 205:c41fc65bcfb4 121 #ifndef __ALIGN_END
mbed_official 205:c41fc65bcfb4 122 #define __ALIGN_END __attribute__ ((aligned (4)))
mbed_official 205:c41fc65bcfb4 123 #endif /* __ALIGN_END */
mbed_official 205:c41fc65bcfb4 124 #ifndef __ALIGN_BEGIN
mbed_official 205:c41fc65bcfb4 125 #define __ALIGN_BEGIN
mbed_official 205:c41fc65bcfb4 126 #endif /* __ALIGN_BEGIN */
mbed_official 205:c41fc65bcfb4 127 #else
mbed_official 205:c41fc65bcfb4 128 #ifndef __ALIGN_END
mbed_official 205:c41fc65bcfb4 129 #define __ALIGN_END
mbed_official 205:c41fc65bcfb4 130 #endif /* __ALIGN_END */
mbed_official 205:c41fc65bcfb4 131 #ifndef __ALIGN_BEGIN
mbed_official 205:c41fc65bcfb4 132 #if defined (__CC_ARM) /* ARM Compiler */
mbed_official 205:c41fc65bcfb4 133 #define __ALIGN_BEGIN __align(4)
mbed_official 205:c41fc65bcfb4 134 #elif defined (__ICCARM__) /* IAR Compiler */
mbed_official 205:c41fc65bcfb4 135 #define __ALIGN_BEGIN
mbed_official 205:c41fc65bcfb4 136 #elif defined (__TASKING__) /* TASKING Compiler */
mbed_official 205:c41fc65bcfb4 137 #define __ALIGN_BEGIN __align(4)
mbed_official 205:c41fc65bcfb4 138 #endif /* __CC_ARM */
mbed_official 205:c41fc65bcfb4 139 #endif /* __ALIGN_BEGIN */
mbed_official 205:c41fc65bcfb4 140 #endif /* __GNUC__ */
mbed_official 205:c41fc65bcfb4 141
mbed_official 205:c41fc65bcfb4 142 #ifdef __cplusplus
mbed_official 205:c41fc65bcfb4 143 }
mbed_official 205:c41fc65bcfb4 144 #endif
mbed_official 205:c41fc65bcfb4 145
mbed_official 205:c41fc65bcfb4 146 #endif /* ___STM32F0xx_HAL_DEF */
mbed_official 205:c41fc65bcfb4 147
mbed_official 205:c41fc65bcfb4 148 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/