mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Tue Jan 06 16:15:36 2015 +0000
Revision:
441:d2c15dda23c1
Parent:
392:2b59412bb664
Child:
630:825f75ca301e
Synchronized with git revision 245a60b29caabb42eabdd19658eeac7c3f68313b

Full URL: https://github.com/mbedmicro/mbed/commit/245a60b29caabb42eabdd19658eeac7c3f68313b/

NUCLEO_F072RB/F091RC - adding target to rtos lib and exporter for coide and gcc_arm

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 340:28d1f895c6fe 1 /**
mbed_official 340:28d1f895c6fe 2 ******************************************************************************
mbed_official 340:28d1f895c6fe 3 * @file stm32f0xx_hal_def.h
mbed_official 340:28d1f895c6fe 4 * @author MCD Application Team
mbed_official 441:d2c15dda23c1 5 * @version V1.2.0
mbed_official 441:d2c15dda23c1 6 * @date 11-December-2014
mbed_official 340:28d1f895c6fe 7 * @brief This file contains HAL common defines, enumeration, macros and
mbed_official 340:28d1f895c6fe 8 * structures definitions.
mbed_official 340:28d1f895c6fe 9 ******************************************************************************
mbed_official 340:28d1f895c6fe 10 * @attention
mbed_official 340:28d1f895c6fe 11 *
mbed_official 340:28d1f895c6fe 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 340:28d1f895c6fe 13 *
mbed_official 340:28d1f895c6fe 14 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 340:28d1f895c6fe 15 * are permitted provided that the following conditions are met:
mbed_official 340:28d1f895c6fe 16 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 340:28d1f895c6fe 17 * this list of conditions and the following disclaimer.
mbed_official 340:28d1f895c6fe 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 340:28d1f895c6fe 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 340:28d1f895c6fe 20 * and/or other materials provided with the distribution.
mbed_official 340:28d1f895c6fe 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 340:28d1f895c6fe 22 * may be used to endorse or promote products derived from this software
mbed_official 340:28d1f895c6fe 23 * without specific prior written permission.
mbed_official 340:28d1f895c6fe 24 *
mbed_official 340:28d1f895c6fe 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 340:28d1f895c6fe 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 340:28d1f895c6fe 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 340:28d1f895c6fe 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 340:28d1f895c6fe 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 340:28d1f895c6fe 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 340:28d1f895c6fe 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 340:28d1f895c6fe 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 340:28d1f895c6fe 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 340:28d1f895c6fe 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 340:28d1f895c6fe 35 *
mbed_official 340:28d1f895c6fe 36 ******************************************************************************
mbed_official 340:28d1f895c6fe 37 */
mbed_official 340:28d1f895c6fe 38
mbed_official 340:28d1f895c6fe 39 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 340:28d1f895c6fe 40 #ifndef __STM32F0xx_HAL_DEF
mbed_official 340:28d1f895c6fe 41 #define __STM32F0xx_HAL_DEF
mbed_official 340:28d1f895c6fe 42
mbed_official 340:28d1f895c6fe 43 #ifdef __cplusplus
mbed_official 340:28d1f895c6fe 44 extern "C" {
mbed_official 340:28d1f895c6fe 45 #endif
mbed_official 340:28d1f895c6fe 46
mbed_official 340:28d1f895c6fe 47 /* Includes ------------------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 48 #include "stm32f0xx.h"
mbed_official 340:28d1f895c6fe 49
mbed_official 340:28d1f895c6fe 50 /* Exported types ------------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 51
mbed_official 340:28d1f895c6fe 52 /**
mbed_official 340:28d1f895c6fe 53 * @brief HAL Status structures definition
mbed_official 340:28d1f895c6fe 54 */
mbed_official 340:28d1f895c6fe 55 typedef enum
mbed_official 340:28d1f895c6fe 56 {
mbed_official 340:28d1f895c6fe 57 HAL_OK = 0x00,
mbed_official 340:28d1f895c6fe 58 HAL_ERROR = 0x01,
mbed_official 340:28d1f895c6fe 59 HAL_BUSY = 0x02,
mbed_official 340:28d1f895c6fe 60 HAL_TIMEOUT = 0x03
mbed_official 340:28d1f895c6fe 61 } HAL_StatusTypeDef;
mbed_official 340:28d1f895c6fe 62
mbed_official 340:28d1f895c6fe 63 /**
mbed_official 340:28d1f895c6fe 64 * @brief HAL Lock structures definition
mbed_official 340:28d1f895c6fe 65 */
mbed_official 340:28d1f895c6fe 66 typedef enum
mbed_official 340:28d1f895c6fe 67 {
mbed_official 340:28d1f895c6fe 68 HAL_UNLOCKED = 0x00,
mbed_official 340:28d1f895c6fe 69 HAL_LOCKED = 0x01
mbed_official 340:28d1f895c6fe 70 } HAL_LockTypeDef;
mbed_official 340:28d1f895c6fe 71
mbed_official 340:28d1f895c6fe 72 /* Exported macro ------------------------------------------------------------*/
mbed_official 441:d2c15dda23c1 73 #ifndef NULL
mbed_official 441:d2c15dda23c1 74 #define NULL 0
mbed_official 340:28d1f895c6fe 75 #endif
mbed_official 340:28d1f895c6fe 76
mbed_official 340:28d1f895c6fe 77 #define HAL_MAX_DELAY 0xFFFFFFFF
mbed_official 340:28d1f895c6fe 78
mbed_official 340:28d1f895c6fe 79 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
mbed_official 340:28d1f895c6fe 80 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
mbed_official 340:28d1f895c6fe 81
mbed_official 340:28d1f895c6fe 82 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
mbed_official 340:28d1f895c6fe 83 do{ \
mbed_official 340:28d1f895c6fe 84 (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
mbed_official 340:28d1f895c6fe 85 (__DMA_HANDLE_).Parent = (__HANDLE__); \
mbed_official 340:28d1f895c6fe 86 } while(0)
mbed_official 340:28d1f895c6fe 87
mbed_official 441:d2c15dda23c1 88 #define UNUSED(x) ((void)(x))
mbed_official 441:d2c15dda23c1 89
mbed_official 340:28d1f895c6fe 90 /** @brief Reset the Handle's State field.
mbed_official 340:28d1f895c6fe 91 * @param __HANDLE__: specifies the Peripheral Handle.
mbed_official 340:28d1f895c6fe 92 * @note This macro can be used for the following purpose:
mbed_official 340:28d1f895c6fe 93 * - When the Handle is declared as local variable; before passing it as parameter
mbed_official 340:28d1f895c6fe 94 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
mbed_official 340:28d1f895c6fe 95 * to set to 0 the Handle's "State" field.
mbed_official 340:28d1f895c6fe 96 * Otherwise, "State" field may have any random value and the first time the function
mbed_official 340:28d1f895c6fe 97 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
mbed_official 340:28d1f895c6fe 98 * (i.e. HAL_PPP_MspInit() will not be executed).
mbed_official 340:28d1f895c6fe 99 * - When there is a need to reconfigure the low level hardware: instead of calling
mbed_official 340:28d1f895c6fe 100 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
mbed_official 340:28d1f895c6fe 101 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
mbed_official 340:28d1f895c6fe 102 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
mbed_official 340:28d1f895c6fe 103 * @retval None
mbed_official 340:28d1f895c6fe 104 */
mbed_official 340:28d1f895c6fe 105 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
mbed_official 340:28d1f895c6fe 106
mbed_official 340:28d1f895c6fe 107 #if (USE_RTOS == 1)
mbed_official 340:28d1f895c6fe 108 #error " USE_RTOS should be 0 in the current HAL release "
mbed_official 340:28d1f895c6fe 109 #else
mbed_official 340:28d1f895c6fe 110 #define __HAL_LOCK(__HANDLE__) \
mbed_official 340:28d1f895c6fe 111 do{ \
mbed_official 340:28d1f895c6fe 112 if((__HANDLE__)->Lock == HAL_LOCKED) \
mbed_official 340:28d1f895c6fe 113 { \
mbed_official 340:28d1f895c6fe 114 return HAL_BUSY; \
mbed_official 340:28d1f895c6fe 115 } \
mbed_official 340:28d1f895c6fe 116 else \
mbed_official 340:28d1f895c6fe 117 { \
mbed_official 340:28d1f895c6fe 118 (__HANDLE__)->Lock = HAL_LOCKED; \
mbed_official 340:28d1f895c6fe 119 } \
mbed_official 340:28d1f895c6fe 120 }while (0)
mbed_official 340:28d1f895c6fe 121
mbed_official 340:28d1f895c6fe 122 #define __HAL_UNLOCK(__HANDLE__) \
mbed_official 340:28d1f895c6fe 123 do{ \
mbed_official 340:28d1f895c6fe 124 (__HANDLE__)->Lock = HAL_UNLOCKED; \
mbed_official 340:28d1f895c6fe 125 }while (0)
mbed_official 340:28d1f895c6fe 126 #endif /* USE_RTOS */
mbed_official 340:28d1f895c6fe 127
mbed_official 340:28d1f895c6fe 128 #if defined ( __GNUC__ )
mbed_official 340:28d1f895c6fe 129 #ifndef __weak
mbed_official 340:28d1f895c6fe 130 #define __weak __attribute__((weak))
mbed_official 340:28d1f895c6fe 131 #endif /* __weak */
mbed_official 340:28d1f895c6fe 132 #ifndef __packed
mbed_official 340:28d1f895c6fe 133 #define __packed __attribute__((__packed__))
mbed_official 340:28d1f895c6fe 134 #endif /* __packed */
mbed_official 340:28d1f895c6fe 135 #endif /* __GNUC__ */
mbed_official 340:28d1f895c6fe 136
mbed_official 340:28d1f895c6fe 137
mbed_official 340:28d1f895c6fe 138 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
mbed_official 340:28d1f895c6fe 139 #if defined (__GNUC__) /* GNU Compiler */
mbed_official 340:28d1f895c6fe 140 #ifndef __ALIGN_END
mbed_official 340:28d1f895c6fe 141 #define __ALIGN_END __attribute__ ((aligned (4)))
mbed_official 340:28d1f895c6fe 142 #endif /* __ALIGN_END */
mbed_official 340:28d1f895c6fe 143 #ifndef __ALIGN_BEGIN
mbed_official 340:28d1f895c6fe 144 #define __ALIGN_BEGIN
mbed_official 340:28d1f895c6fe 145 #endif /* __ALIGN_BEGIN */
mbed_official 340:28d1f895c6fe 146 #else
mbed_official 340:28d1f895c6fe 147 #ifndef __ALIGN_END
mbed_official 340:28d1f895c6fe 148 #define __ALIGN_END
mbed_official 340:28d1f895c6fe 149 #endif /* __ALIGN_END */
mbed_official 340:28d1f895c6fe 150 #ifndef __ALIGN_BEGIN
mbed_official 340:28d1f895c6fe 151 #if defined (__CC_ARM) /* ARM Compiler */
mbed_official 340:28d1f895c6fe 152 #define __ALIGN_BEGIN __align(4)
mbed_official 340:28d1f895c6fe 153 #elif defined (__ICCARM__) /* IAR Compiler */
mbed_official 340:28d1f895c6fe 154 #define __ALIGN_BEGIN
mbed_official 340:28d1f895c6fe 155 #endif /* __CC_ARM */
mbed_official 340:28d1f895c6fe 156 #endif /* __ALIGN_BEGIN */
mbed_official 340:28d1f895c6fe 157 #endif /* __GNUC__ */
mbed_official 340:28d1f895c6fe 158
mbed_official 441:d2c15dda23c1 159 /**
mbed_official 441:d2c15dda23c1 160 * @brief __NOINLINE definition
mbed_official 441:d2c15dda23c1 161 */
mbed_official 441:d2c15dda23c1 162 #if defined ( __CC_ARM ) || defined ( __GNUC__ )
mbed_official 441:d2c15dda23c1 163 /* ARM & GNUCompiler
mbed_official 441:d2c15dda23c1 164 ----------------
mbed_official 441:d2c15dda23c1 165 */
mbed_official 441:d2c15dda23c1 166 #define __NOINLINE __attribute__ ( (noinline) )
mbed_official 441:d2c15dda23c1 167
mbed_official 441:d2c15dda23c1 168 #elif defined ( __ICCARM__ )
mbed_official 441:d2c15dda23c1 169 /* ICCARM Compiler
mbed_official 441:d2c15dda23c1 170 ---------------
mbed_official 441:d2c15dda23c1 171 */
mbed_official 441:d2c15dda23c1 172 #define __NOINLINE _Pragma("optimize = no_inline")
mbed_official 441:d2c15dda23c1 173
mbed_official 441:d2c15dda23c1 174 #endif
mbed_official 441:d2c15dda23c1 175
mbed_official 340:28d1f895c6fe 176 #ifdef __cplusplus
mbed_official 340:28d1f895c6fe 177 }
mbed_official 340:28d1f895c6fe 178 #endif
mbed_official 340:28d1f895c6fe 179
mbed_official 340:28d1f895c6fe 180 #endif /* ___STM32F0xx_HAL_DEF */
mbed_official 340:28d1f895c6fe 181
mbed_official 340:28d1f895c6fe 182 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
mbed_official 340:28d1f895c6fe 183