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:
Thu Oct 16 14:30:08 2014 +0100
Revision:
352:95e80f5e68f6
Parent:
235:685d5f11838f
Synchronized with git revision a40d0bb4ca0dc314c03ff7dc0192addf4d7ea8fa

Full URL: https://github.com/mbedmicro/mbed/commit/a40d0bb4ca0dc314c03ff7dc0192addf4d7ea8fa/

Targets: NUCLEO_F411RE - CMSIS files to build/export to IAR

Who changed what in which revision?

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