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