mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
Anna Bridge
Date:
Wed May 10 12:06:41 2017 +0100
Revision:
164:289d4deac6e4
Parent:
149:156823d33999
Child:
184:08ed48f1de7f
This updates the lib to the mbed lib v142

Who changed what in which revision?

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