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 mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
110:165afa46840b
.

Who changed what in which revision?

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