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:
Kojto
Date:
Tue Mar 15 14:34:00 2016 +0000
Revision:
116:c0f6e94411f5
Release 116 of the mbed library

Changes:
- new targets - NUCLEO_L073RZ
- fixes to IOTSS BEID platform
- LPC824, LPC1549 and LPC11U68 - fix PWMOut SCT bugs
- STM32F7 - Cube driver
- STM32F4 - add RTC LSI macro, defined as 0
- STM32F3 - fix multiple ADC clock initialization
- retarget - binary mode fix for GCC

Who changed what in which revision?

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