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