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:
107:4f6c30876dfa
.

Who changed what in which revision?

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