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:
Wed Jan 13 09:48:29 2016 +0000
Revision:
112:6f327212ef96
Release 112 of the mbed library

Changes:
- new platforms - STM32 B96B F446, MOTE_L152RC
- nrf51 - fix serial init bug (character sent)
- stm all devices - fix RTC clocking in the init
- stm f0 - SystemInit clock fix, for SetVector()
- RawSerial - fix for microlib (vsnprintf with size 0)

Who changed what in which revision?

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