The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_NUCLEO_F411RE/stm32f4xx_hal_def.h@86:04dd9b1680ae, 2014-07-02 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Jul 02 13:22:23 2014 +0100
- Revision:
- 86:04dd9b1680ae
- Child:
- 90:cb3d968589d8
Release 86 of the mbed library
Main changes:
- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 86:04dd9b1680ae | 1 | /** |
bogdanm | 86:04dd9b1680ae | 2 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 3 | * @file stm32f4xx_hal_def.h |
bogdanm | 86:04dd9b1680ae | 4 | * @author MCD Application Team |
bogdanm | 86:04dd9b1680ae | 5 | * @version V1.1.0 |
bogdanm | 86:04dd9b1680ae | 6 | * @date 19-June-2014 |
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 | * |
bogdanm | 86:04dd9b1680ae | 12 | * <h2><center>© COPYRIGHT(c) 2014 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 __STM32F4xx_HAL_DEF |
bogdanm | 86:04dd9b1680ae | 41 | #define __STM32F4xx_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 "stm32f4xx.h" |
bogdanm | 86:04dd9b1680ae | 49 | |
bogdanm | 86:04dd9b1680ae | 50 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 51 | |
bogdanm | 86:04dd9b1680ae | 52 | /** |
bogdanm | 86:04dd9b1680ae | 53 | * @brief HAL Status structures definition |
bogdanm | 86:04dd9b1680ae | 54 | */ |
bogdanm | 86:04dd9b1680ae | 55 | typedef enum |
bogdanm | 86:04dd9b1680ae | 56 | { |
bogdanm | 86:04dd9b1680ae | 57 | HAL_OK = 0x00, |
bogdanm | 86:04dd9b1680ae | 58 | HAL_ERROR = 0x01, |
bogdanm | 86:04dd9b1680ae | 59 | HAL_BUSY = 0x02, |
bogdanm | 86:04dd9b1680ae | 60 | HAL_TIMEOUT = 0x03 |
bogdanm | 86:04dd9b1680ae | 61 | } HAL_StatusTypeDef; |
bogdanm | 86:04dd9b1680ae | 62 | |
bogdanm | 86:04dd9b1680ae | 63 | /** |
bogdanm | 86:04dd9b1680ae | 64 | * @brief HAL Lock structures definition |
bogdanm | 86:04dd9b1680ae | 65 | */ |
bogdanm | 86:04dd9b1680ae | 66 | typedef enum |
bogdanm | 86:04dd9b1680ae | 67 | { |
bogdanm | 86:04dd9b1680ae | 68 | HAL_UNLOCKED = 0x00, |
bogdanm | 86:04dd9b1680ae | 69 | HAL_LOCKED = 0x01 |
bogdanm | 86:04dd9b1680ae | 70 | } HAL_LockTypeDef; |
bogdanm | 86:04dd9b1680ae | 71 | |
bogdanm | 86:04dd9b1680ae | 72 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 73 | #ifndef NULL |
bogdanm | 86:04dd9b1680ae | 74 | #define NULL (void *) 0 |
bogdanm | 86:04dd9b1680ae | 75 | #endif |
bogdanm | 86:04dd9b1680ae | 76 | |
bogdanm | 86:04dd9b1680ae | 77 | #define HAL_MAX_DELAY 0xFFFFFFFF |
bogdanm | 86:04dd9b1680ae | 78 | |
bogdanm | 86:04dd9b1680ae | 79 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) |
bogdanm | 86:04dd9b1680ae | 80 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) |
bogdanm | 86:04dd9b1680ae | 81 | |
bogdanm | 86:04dd9b1680ae | 82 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ |
bogdanm | 86:04dd9b1680ae | 83 | do{ \ |
bogdanm | 86:04dd9b1680ae | 84 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ |
bogdanm | 86:04dd9b1680ae | 85 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ |
bogdanm | 86:04dd9b1680ae | 86 | } while(0) |
bogdanm | 86:04dd9b1680ae | 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 | /* Reserved for future use */ |
bogdanm | 86:04dd9b1680ae | 107 | #error USE_RTOS should be 0 in the current HAL release |
bogdanm | 86:04dd9b1680ae | 108 | #else |
bogdanm | 86:04dd9b1680ae | 109 | #define __HAL_LOCK(__HANDLE__) \ |
bogdanm | 86:04dd9b1680ae | 110 | do{ \ |
bogdanm | 86:04dd9b1680ae | 111 | if((__HANDLE__)->Lock == HAL_LOCKED) \ |
bogdanm | 86:04dd9b1680ae | 112 | { \ |
bogdanm | 86:04dd9b1680ae | 113 | return HAL_BUSY; \ |
bogdanm | 86:04dd9b1680ae | 114 | } \ |
bogdanm | 86:04dd9b1680ae | 115 | else \ |
bogdanm | 86:04dd9b1680ae | 116 | { \ |
bogdanm | 86:04dd9b1680ae | 117 | (__HANDLE__)->Lock = HAL_LOCKED; \ |
bogdanm | 86:04dd9b1680ae | 118 | } \ |
bogdanm | 86:04dd9b1680ae | 119 | }while (0) |
bogdanm | 86:04dd9b1680ae | 120 | |
bogdanm | 86:04dd9b1680ae | 121 | #define __HAL_UNLOCK(__HANDLE__) \ |
bogdanm | 86:04dd9b1680ae | 122 | do{ \ |
bogdanm | 86:04dd9b1680ae | 123 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ |
bogdanm | 86:04dd9b1680ae | 124 | }while (0) |
bogdanm | 86:04dd9b1680ae | 125 | #endif /* USE_RTOS */ |
bogdanm | 86:04dd9b1680ae | 126 | |
bogdanm | 86:04dd9b1680ae | 127 | #if defined ( __GNUC__ ) |
bogdanm | 86:04dd9b1680ae | 128 | #ifndef __weak |
bogdanm | 86:04dd9b1680ae | 129 | #define __weak __attribute__((weak)) |
bogdanm | 86:04dd9b1680ae | 130 | #endif /* __weak */ |
bogdanm | 86:04dd9b1680ae | 131 | #ifndef __packed |
bogdanm | 86:04dd9b1680ae | 132 | #define __packed __attribute__((__packed__)) |
bogdanm | 86:04dd9b1680ae | 133 | #endif /* __packed */ |
bogdanm | 86:04dd9b1680ae | 134 | #endif /* __GNUC__ */ |
bogdanm | 86:04dd9b1680ae | 135 | |
bogdanm | 86:04dd9b1680ae | 136 | |
bogdanm | 86:04dd9b1680ae | 137 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ |
bogdanm | 86:04dd9b1680ae | 138 | #if defined (__GNUC__) /* GNU Compiler */ |
bogdanm | 86:04dd9b1680ae | 139 | #ifndef __ALIGN_END |
bogdanm | 86:04dd9b1680ae | 140 | #define __ALIGN_END __attribute__ ((aligned (4))) |
bogdanm | 86:04dd9b1680ae | 141 | #endif /* __ALIGN_END */ |
bogdanm | 86:04dd9b1680ae | 142 | #ifndef __ALIGN_BEGIN |
bogdanm | 86:04dd9b1680ae | 143 | #define __ALIGN_BEGIN |
bogdanm | 86:04dd9b1680ae | 144 | #endif /* __ALIGN_BEGIN */ |
bogdanm | 86:04dd9b1680ae | 145 | #else |
bogdanm | 86:04dd9b1680ae | 146 | #ifndef __ALIGN_END |
bogdanm | 86:04dd9b1680ae | 147 | #define __ALIGN_END |
bogdanm | 86:04dd9b1680ae | 148 | #endif /* __ALIGN_END */ |
bogdanm | 86:04dd9b1680ae | 149 | #ifndef __ALIGN_BEGIN |
bogdanm | 86:04dd9b1680ae | 150 | #if defined (__CC_ARM) /* ARM Compiler */ |
bogdanm | 86:04dd9b1680ae | 151 | #define __ALIGN_BEGIN __align(4) |
bogdanm | 86:04dd9b1680ae | 152 | #elif defined (__ICCARM__) /* IAR Compiler */ |
bogdanm | 86:04dd9b1680ae | 153 | #define __ALIGN_BEGIN |
bogdanm | 86:04dd9b1680ae | 154 | #endif /* __CC_ARM */ |
bogdanm | 86:04dd9b1680ae | 155 | #endif /* __ALIGN_BEGIN */ |
bogdanm | 86:04dd9b1680ae | 156 | #endif /* __GNUC__ */ |
bogdanm | 86:04dd9b1680ae | 157 | |
bogdanm | 86:04dd9b1680ae | 158 | |
bogdanm | 86:04dd9b1680ae | 159 | /** |
bogdanm | 86:04dd9b1680ae | 160 | * @brief __RAM_FUNC definition |
bogdanm | 86:04dd9b1680ae | 161 | */ |
bogdanm | 86:04dd9b1680ae | 162 | #if defined ( __CC_ARM ) |
bogdanm | 86:04dd9b1680ae | 163 | /* ARM Compiler |
bogdanm | 86:04dd9b1680ae | 164 | ------------ |
bogdanm | 86:04dd9b1680ae | 165 | RAM functions are defined using the toolchain options. |
bogdanm | 86:04dd9b1680ae | 166 | Functions that are executed in RAM should reside in a separate source module. |
bogdanm | 86:04dd9b1680ae | 167 | Using the 'Options for File' dialog you can simply change the 'Code / Const' |
bogdanm | 86:04dd9b1680ae | 168 | area of a module to a memory space in physical RAM. |
bogdanm | 86:04dd9b1680ae | 169 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' |
bogdanm | 86:04dd9b1680ae | 170 | dialog. |
bogdanm | 86:04dd9b1680ae | 171 | */ |
bogdanm | 86:04dd9b1680ae | 172 | #define __RAM_FUNC HAL_StatusTypeDef |
bogdanm | 86:04dd9b1680ae | 173 | |
bogdanm | 86:04dd9b1680ae | 174 | #elif defined ( __ICCARM__ ) |
bogdanm | 86:04dd9b1680ae | 175 | /* ICCARM Compiler |
bogdanm | 86:04dd9b1680ae | 176 | --------------- |
bogdanm | 86:04dd9b1680ae | 177 | RAM functions are defined using a specific toolchain keyword "__ramfunc". |
bogdanm | 86:04dd9b1680ae | 178 | */ |
bogdanm | 86:04dd9b1680ae | 179 | #define __RAM_FUNC __ramfunc HAL_StatusTypeDef |
bogdanm | 86:04dd9b1680ae | 180 | |
bogdanm | 86:04dd9b1680ae | 181 | #elif defined ( __GNUC__ ) |
bogdanm | 86:04dd9b1680ae | 182 | /* GNU Compiler |
bogdanm | 86:04dd9b1680ae | 183 | ------------ |
bogdanm | 86:04dd9b1680ae | 184 | RAM functions are defined using a specific toolchain attribute |
bogdanm | 86:04dd9b1680ae | 185 | "__attribute__((section(".RamFunc")))". |
bogdanm | 86:04dd9b1680ae | 186 | */ |
bogdanm | 86:04dd9b1680ae | 187 | #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc"))) |
bogdanm | 86:04dd9b1680ae | 188 | |
bogdanm | 86:04dd9b1680ae | 189 | #endif |
bogdanm | 86:04dd9b1680ae | 190 | |
bogdanm | 86:04dd9b1680ae | 191 | |
bogdanm | 86:04dd9b1680ae | 192 | #ifdef __cplusplus |
bogdanm | 86:04dd9b1680ae | 193 | } |
bogdanm | 86:04dd9b1680ae | 194 | #endif |
bogdanm | 86:04dd9b1680ae | 195 | |
bogdanm | 86:04dd9b1680ae | 196 | #endif /* ___STM32F4xx_HAL_DEF */ |
bogdanm | 86:04dd9b1680ae | 197 | |
bogdanm | 86:04dd9b1680ae | 198 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |