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