Ricardo Benitez / mbed

Fork of mbed by mbed official

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?

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