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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Tue Dec 20 15:36:52 2016 +0000
Revision:
132:9baf128c2fab
Parent:
128:9bcdf88f62b0
Child:
142:4eea097334d6
Release 132 of the mbed library

Ports for Upcoming Targets

3241: Add support for FRDM-KW41 https://github.com/ARMmbed/mbed-os/pull/3241
3291: Adding mbed enabled Maker board with NINA-B1 and EVA-M8Q https://github.com/ARMmbed/mbed-os/pull/3291

Fixes and Changes

3062: TARGET_STM :USB device FS https://github.com/ARMmbed/mbed-os/pull/3062
3213: STM32: Refactor us_ticker.c + hal_tick.c files https://github.com/ARMmbed/mbed-os/pull/3213
3288: Dev spi asynch l0l1 https://github.com/ARMmbed/mbed-os/pull/3288
3289: Bug fix of initial value of interrupt edge in "gpio_irq_init" function. https://github.com/ARMmbed/mbed-os/pull/3289
3302: STM32F4 AnalogIn - Clear VBATE and TSVREFE bits before configuring ADC channels https://github.com/ARMmbed/mbed-os/pull/3302
3320: STM32 - Add ADC_VREF label https://github.com/ARMmbed/mbed-os/pull/3320
3321: no HSE available by default for NUCLEO_L432KC https://github.com/ARMmbed/mbed-os/pull/3321
3352: ublox eva nina - fix line endings https://github.com/ARMmbed/mbed-os/pull/3352
3322: DISCO_L053C8 doesn't support LSE https://github.com/ARMmbed/mbed-os/pull/3322
3345: STM32 - Remove TIM_IT_UPDATE flag in HAL_Suspend/ResumeTick functions https://github.com/ARMmbed/mbed-os/pull/3345
3309: [NUC472/M453] Fix CI failed tests https://github.com/ARMmbed/mbed-os/pull/3309
3157: [Silicon Labs] Adding support for EFR32MG1 wireless SoC https://github.com/ARMmbed/mbed-os/pull/3157
3301: I2C - correct return values for write functions (docs) - part 1 https://github.com/ARMmbed/mbed-os/pull/3301
3303: Fix #2956 #2939 #2957 #2959 #2960: Add HAL_DeInit function in gpio_irq destructor https://github.com/ARMmbed/mbed-os/pull/3303
3304: STM32L476: no HSE is present in NUCLEO and DISCO boards https://github.com/ARMmbed/mbed-os/pull/3304
3318: Register map changes for RevG https://github.com/ARMmbed/mbed-os/pull/3318
3317: NUCLEO_F429ZI has integrated LSE https://github.com/ARMmbed/mbed-os/pull/3317
3312: K64F: SPI Asynch API implementation https://github.com/ARMmbed/mbed-os/pull/3312
3324: Dev i2c common code https://github.com/ARMmbed/mbed-os/pull/3324
3369: Add CAN2 missing pins for connector CN12 https://github.com/ARMmbed/mbed-os/pull/3369
3377: STM32 NUCLEO-L152RE Update system core clock to 32MHz https://github.com/ARMmbed/mbed-os/pull/3377
3378: K66F: Enable LWIP feature https://github.com/ARMmbed/mbed-os/pull/3378
3382: [MAX32620] Fixing serial readable function. https://github.com/ARMmbed/mbed-os/pull/3382
3399: NUCLEO_F103RB - Add SERIAL_FC feature https://github.com/ARMmbed/mbed-os/pull/3399
3409: STM32L1 : map ST HAL assert into MBED assert https://github.com/ARMmbed/mbed-os/pull/3409
3416: Renames i2c_api.c for STM32F1 targets to fix IAR exporter https://github.com/ARMmbed/mbed-os/pull/3416
3348: Fix frequency function of CAN driver. https://github.com/ARMmbed/mbed-os/pull/3348
3366: NUCLEO_F412ZG - Add new platform https://github.com/ARMmbed/mbed-os/pull/3366
3379: STM32F0 : map ST HAL assert into MBED assert https://github.com/ARMmbed/mbed-os/pull/3379
3393: ISR register never re-evaluated in HAL_DMA_PollForTransfer for STM32F4 https://github.com/ARMmbed/mbed-os/pull/3393
3408: STM32F7 : map ST HAL assert into MBED assert https://github.com/ARMmbed/mbed-os/pull/3408
3411: STM32L0 : map ST HAL assert into MBED assert https://github.com/ARMmbed/mbed-os/pull/3411
3424: STM32F4 - FIX to add the update of hdma->State variable https://github.com/ARMmbed/mbed-os/pull/3424
3427: Fix stm i2c slave https://github.com/ARMmbed/mbed-os/pull/3427
3429: Fix stm i2c fix init https://github.com/ARMmbed/mbed-os/pull/3429
3434: [NUC472/M453] Fix stuck in lp_ticker_init and other updates https://github.com/ARMmbed/mbed-os/pull/3434

Who changed what in which revision?

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