mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

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