meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed May 13 08:08:21 2015 +0200
Revision:
99:dbbf35b96557
Parent:
90:cb3d968589d8
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
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 99:dbbf35b96557 5 * @version V1.3.0
Kojto 99:dbbf35b96557 6 * @date 09-March-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>&copy; 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 ------------------------------------------------------------*/
Kojto 99:dbbf35b96557 75 //#ifndef NULL
Kojto 90:cb3d968589d8 76 #define HAL_NULL (void *) 0
Kojto 99:dbbf35b96557 77 //#endif
emilmont 77:869cf507173a 78 #define HAL_MAX_DELAY 0xFFFFFFFF
emilmont 77:869cf507173a 79
emilmont 77:869cf507173a 80 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
emilmont 77:869cf507173a 81 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
emilmont 77:869cf507173a 82
bogdanm 85:024bf7f99721 83 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
emilmont 77:869cf507173a 84 do{ \
bogdanm 85:024bf7f99721 85 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
bogdanm 85:024bf7f99721 86 (__DMA_HANDLE__).Parent = (__HANDLE__); \
emilmont 77:869cf507173a 87 } while(0)
emilmont 77:869cf507173a 88
Kojto 99:dbbf35b96557 89 #define UNUSED(x) ((void)(x))
Kojto 99:dbbf35b96557 90
Kojto 90:cb3d968589d8 91 /** @brief Reset the Handle's State field.
Kojto 90:cb3d968589d8 92 * @param __HANDLE__: specifies the Peripheral Handle.
Kojto 90:cb3d968589d8 93 * @note This macro can be used for the following purpose:
Kojto 90:cb3d968589d8 94 * - When the Handle is declared as local variable; before passing it as parameter
Kojto 90:cb3d968589d8 95 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
Kojto 90:cb3d968589d8 96 * to set to 0 the Handle's "State" field.
Kojto 90:cb3d968589d8 97 * Otherwise, "State" field may have any random value and the first time the function
Kojto 90:cb3d968589d8 98 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
Kojto 90:cb3d968589d8 99 * (i.e. HAL_PPP_MspInit() will not be executed).
Kojto 90:cb3d968589d8 100 * - When there is a need to reconfigure the low level hardware: instead of calling
Kojto 90:cb3d968589d8 101 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
Kojto 90:cb3d968589d8 102 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
Kojto 90:cb3d968589d8 103 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
Kojto 90:cb3d968589d8 104 * @retval None
Kojto 90:cb3d968589d8 105 */
Kojto 90:cb3d968589d8 106 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
Kojto 90:cb3d968589d8 107
emilmont 77:869cf507173a 108 #if (USE_RTOS == 1)
emilmont 77:869cf507173a 109 /* Reserved for future use */
Kojto 90:cb3d968589d8 110 #error “USE_RTOS should be 0 in the current HAL release”
emilmont 77:869cf507173a 111 #else
emilmont 77:869cf507173a 112 #define __HAL_LOCK(__HANDLE__) \
emilmont 77:869cf507173a 113 do{ \
emilmont 77:869cf507173a 114 if((__HANDLE__)->Lock == HAL_LOCKED) \
emilmont 77:869cf507173a 115 { \
emilmont 77:869cf507173a 116 return HAL_BUSY; \
emilmont 77:869cf507173a 117 } \
emilmont 77:869cf507173a 118 else \
emilmont 77:869cf507173a 119 { \
emilmont 77:869cf507173a 120 (__HANDLE__)->Lock = HAL_LOCKED; \
emilmont 77:869cf507173a 121 } \
emilmont 77:869cf507173a 122 }while (0)
emilmont 77:869cf507173a 123
emilmont 77:869cf507173a 124 #define __HAL_UNLOCK(__HANDLE__) \
emilmont 77:869cf507173a 125 do{ \
emilmont 77:869cf507173a 126 (__HANDLE__)->Lock = HAL_UNLOCKED; \
emilmont 77:869cf507173a 127 }while (0)
emilmont 77:869cf507173a 128 #endif /* USE_RTOS */
emilmont 77:869cf507173a 129
emilmont 77:869cf507173a 130 #if defined ( __GNUC__ )
emilmont 77:869cf507173a 131 #ifndef __weak
emilmont 77:869cf507173a 132 #define __weak __attribute__((weak))
emilmont 77:869cf507173a 133 #endif /* __weak */
emilmont 77:869cf507173a 134 #ifndef __packed
emilmont 77:869cf507173a 135 #define __packed __attribute__((__packed__))
emilmont 77:869cf507173a 136 #endif /* __packed */
emilmont 77:869cf507173a 137 #endif /* __GNUC__ */
emilmont 77:869cf507173a 138
bogdanm 81:7d30d6019079 139
bogdanm 81:7d30d6019079 140 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
bogdanm 81:7d30d6019079 141 #if defined (__GNUC__) /* GNU Compiler */
bogdanm 81:7d30d6019079 142 #ifndef __ALIGN_END
bogdanm 81:7d30d6019079 143 #define __ALIGN_END __attribute__ ((aligned (4)))
bogdanm 81:7d30d6019079 144 #endif /* __ALIGN_END */
bogdanm 81:7d30d6019079 145 #ifndef __ALIGN_BEGIN
bogdanm 81:7d30d6019079 146 #define __ALIGN_BEGIN
bogdanm 81:7d30d6019079 147 #endif /* __ALIGN_BEGIN */
bogdanm 81:7d30d6019079 148 #else
bogdanm 81:7d30d6019079 149 #ifndef __ALIGN_END
bogdanm 81:7d30d6019079 150 #define __ALIGN_END
bogdanm 81:7d30d6019079 151 #endif /* __ALIGN_END */
bogdanm 81:7d30d6019079 152 #ifndef __ALIGN_BEGIN
bogdanm 81:7d30d6019079 153 #if defined (__CC_ARM) /* ARM Compiler */
bogdanm 81:7d30d6019079 154 #define __ALIGN_BEGIN __align(4)
bogdanm 81:7d30d6019079 155 #elif defined (__ICCARM__) /* IAR Compiler */
bogdanm 81:7d30d6019079 156 #define __ALIGN_BEGIN
bogdanm 81:7d30d6019079 157 #endif /* __CC_ARM */
bogdanm 81:7d30d6019079 158 #endif /* __ALIGN_BEGIN */
bogdanm 81:7d30d6019079 159 #endif /* __GNUC__ */
bogdanm 81:7d30d6019079 160
Kojto 90:cb3d968589d8 161
Kojto 90:cb3d968589d8 162 /**
Kojto 90:cb3d968589d8 163 * @brief __RAM_FUNC definition
Kojto 90:cb3d968589d8 164 */
Kojto 90:cb3d968589d8 165 #if defined ( __CC_ARM )
Kojto 90:cb3d968589d8 166 /* ARM Compiler
Kojto 90:cb3d968589d8 167 ------------
Kojto 90:cb3d968589d8 168 RAM functions are defined using the toolchain options.
Kojto 90:cb3d968589d8 169 Functions that are executed in RAM should reside in a separate source module.
Kojto 90:cb3d968589d8 170 Using the 'Options for File' dialog you can simply change the 'Code / Const'
Kojto 90:cb3d968589d8 171 area of a module to a memory space in physical RAM.
Kojto 90:cb3d968589d8 172 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
Kojto 90:cb3d968589d8 173 dialog.
Kojto 90:cb3d968589d8 174 */
Kojto 90:cb3d968589d8 175 #define __RAM_FUNC HAL_StatusTypeDef
Kojto 90:cb3d968589d8 176
Kojto 90:cb3d968589d8 177 #elif defined ( __ICCARM__ )
Kojto 90:cb3d968589d8 178 /* ICCARM Compiler
Kojto 90:cb3d968589d8 179 ---------------
Kojto 90:cb3d968589d8 180 RAM functions are defined using a specific toolchain keyword "__ramfunc".
Kojto 90:cb3d968589d8 181 */
Kojto 90:cb3d968589d8 182 #define __RAM_FUNC __ramfunc HAL_StatusTypeDef
Kojto 90:cb3d968589d8 183
Kojto 90:cb3d968589d8 184 #elif defined ( __GNUC__ )
Kojto 90:cb3d968589d8 185 /* GNU Compiler
Kojto 90:cb3d968589d8 186 ------------
Kojto 90:cb3d968589d8 187 RAM functions are defined using a specific toolchain attribute
Kojto 90:cb3d968589d8 188 "__attribute__((section(".RamFunc")))".
Kojto 90:cb3d968589d8 189 */
Kojto 90:cb3d968589d8 190 #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
Kojto 90:cb3d968589d8 191
Kojto 90:cb3d968589d8 192 #endif
Kojto 90:cb3d968589d8 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
Kojto 90:cb3d968589d8 210
emilmont 77:869cf507173a 211 #ifdef __cplusplus
emilmont 77:869cf507173a 212 }
emilmont 77:869cf507173a 213 #endif
emilmont 77:869cf507173a 214
emilmont 77:869cf507173a 215 #endif /* ___STM32F4xx_HAL_DEF */
emilmont 77:869cf507173a 216
emilmont 77:869cf507173a 217 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/