meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed May 13 08:08:21 2015 +0200
Revision:
99:dbbf35b96557
Parent:
92:4fc01daae5a5
Child:
106:ba1f97679dad
Release 99 of the mbed library

Changes:
- new targets - MAXWSNENV, DISCO_L053C8
- STM32F4xx - ST Cube driver
- KSDK mcu - SPI timing fix
- Nordic - update to softdevice s130

Who changed what in which revision?

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