Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
TARGET_NUCLEO_F401RE/stm32f4xx_hal_def.h@90:cb3d968589d8, 2014-10-28 (annotated)
- Committer:
- Kojto
- Date:
- Tue Oct 28 16:40:41 2014 +0000
- Revision:
- 90:cb3d968589d8
- Parent:
- 85:024bf7f99721
- Child:
- 99:dbbf35b96557
Release 90 of the mbed library
Changes:
- Freescale KSDK update (v1.0)
- K22 - new target addition
- KL43Z - new target addition
- Nucleo F091RC - new target addition
- Nucleo L152RE - STM32Cube driver
- Nordic - Softdevice v7.1.0
- Nvic files - BSD License
- LPC824 - various HAL fixes
- Nucleo F411RE - CMSIS - IAR files
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 | 90:cb3d968589d8 | 5 | * @version V1.1.0 |
Kojto | 90:cb3d968589d8 | 6 | * @date 19-June-2014 |
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 | * |
emilmont | 77:869cf507173a | 12 | * <h2><center>© COPYRIGHT(c) 2014 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" |
emilmont | 77:869cf507173a | 49 | |
emilmont | 77:869cf507173a | 50 | /* Exported types ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 51 | |
emilmont | 77:869cf507173a | 52 | /** |
emilmont | 77:869cf507173a | 53 | * @brief HAL Status structures definition |
emilmont | 77:869cf507173a | 54 | */ |
emilmont | 77:869cf507173a | 55 | typedef enum |
emilmont | 77:869cf507173a | 56 | { |
emilmont | 77:869cf507173a | 57 | HAL_OK = 0x00, |
emilmont | 77:869cf507173a | 58 | HAL_ERROR = 0x01, |
emilmont | 77:869cf507173a | 59 | HAL_BUSY = 0x02, |
emilmont | 77:869cf507173a | 60 | HAL_TIMEOUT = 0x03 |
emilmont | 77:869cf507173a | 61 | } HAL_StatusTypeDef; |
emilmont | 77:869cf507173a | 62 | |
emilmont | 77:869cf507173a | 63 | /** |
emilmont | 77:869cf507173a | 64 | * @brief HAL Lock structures definition |
emilmont | 77:869cf507173a | 65 | */ |
emilmont | 77:869cf507173a | 66 | typedef enum |
emilmont | 77:869cf507173a | 67 | { |
emilmont | 77:869cf507173a | 68 | HAL_UNLOCKED = 0x00, |
emilmont | 77:869cf507173a | 69 | HAL_LOCKED = 0x01 |
emilmont | 77:869cf507173a | 70 | } HAL_LockTypeDef; |
emilmont | 77:869cf507173a | 71 | |
emilmont | 77:869cf507173a | 72 | /* Exported macro ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 73 | #ifndef NULL |
Kojto | 90:cb3d968589d8 | 74 | #define HAL_NULL (void *) 0 |
emilmont | 77:869cf507173a | 75 | #endif |
emilmont | 77:869cf507173a | 76 | |
emilmont | 77:869cf507173a | 77 | #define HAL_MAX_DELAY 0xFFFFFFFF |
emilmont | 77:869cf507173a | 78 | |
emilmont | 77:869cf507173a | 79 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) |
emilmont | 77:869cf507173a | 80 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) |
emilmont | 77:869cf507173a | 81 | |
bogdanm | 85:024bf7f99721 | 82 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ |
emilmont | 77:869cf507173a | 83 | do{ \ |
bogdanm | 85:024bf7f99721 | 84 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ |
bogdanm | 85:024bf7f99721 | 85 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ |
emilmont | 77:869cf507173a | 86 | } while(0) |
emilmont | 77:869cf507173a | 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 | 90:cb3d968589d8 | 191 | |
emilmont | 77:869cf507173a | 192 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 193 | } |
emilmont | 77:869cf507173a | 194 | #endif |
emilmont | 77:869cf507173a | 195 | |
emilmont | 77:869cf507173a | 196 | #endif /* ___STM32F4xx_HAL_DEF */ |
emilmont | 77:869cf507173a | 197 | |
emilmont | 77:869cf507173a | 198 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |