mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
112:6f327212ef96
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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