meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
84:0b3ab51c8877
Child:
96:487b796308b0
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

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