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:
99:dbbf35b96557
.

Who changed what in which revision?

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