meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon May 19 18:14:09 2014 +0100
Revision:
84:0b3ab51c8877
Child:
92:4fc01daae5a5
Release 84 of the mbed library

Main changes:

- added LPC11U68 to the official build
- Bug fixes and new features for ST Nucleo boards
- I2C fixes for Freescale targets
- Added nRF51822 exporters

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 84:0b3ab51c8877 5 * @version V1.0.0
bogdanm 84:0b3ab51c8877 6 * @date 22-April-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 84:0b3ab51c8877 73 #ifndef NULL
bogdanm 84:0b3ab51c8877 74 #define 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 84:0b3ab51c8877 88 #if (USE_RTOS == 1)
bogdanm 84:0b3ab51c8877 89
bogdanm 84:0b3ab51c8877 90 #else
bogdanm 84:0b3ab51c8877 91 #define __HAL_LOCK(__HANDLE__) \
bogdanm 84:0b3ab51c8877 92 do{ \
bogdanm 84:0b3ab51c8877 93 if((__HANDLE__)->Lock == HAL_LOCKED) \
bogdanm 84:0b3ab51c8877 94 { \
bogdanm 84:0b3ab51c8877 95 return HAL_BUSY; \
bogdanm 84:0b3ab51c8877 96 } \
bogdanm 84:0b3ab51c8877 97 else \
bogdanm 84:0b3ab51c8877 98 { \
bogdanm 84:0b3ab51c8877 99 (__HANDLE__)->Lock = HAL_LOCKED; \
bogdanm 84:0b3ab51c8877 100 } \
bogdanm 84:0b3ab51c8877 101 }while (0)
bogdanm 84:0b3ab51c8877 102
bogdanm 84:0b3ab51c8877 103 #define __HAL_UNLOCK(__HANDLE__) \
bogdanm 84:0b3ab51c8877 104 do{ \
bogdanm 84:0b3ab51c8877 105 (__HANDLE__)->Lock = HAL_UNLOCKED; \
bogdanm 84:0b3ab51c8877 106 }while (0)
bogdanm 84:0b3ab51c8877 107 #endif /* USE_RTOS */
bogdanm 84:0b3ab51c8877 108
bogdanm 84:0b3ab51c8877 109 #if defined ( __GNUC__ )
bogdanm 84:0b3ab51c8877 110 #ifndef __weak
bogdanm 84:0b3ab51c8877 111 #define __weak __attribute__((weak))
bogdanm 84:0b3ab51c8877 112 #endif /* __weak */
bogdanm 84:0b3ab51c8877 113 #ifndef __packed
bogdanm 84:0b3ab51c8877 114 #define __packed __attribute__((__packed__))
bogdanm 84:0b3ab51c8877 115 #endif /* __packed */
bogdanm 84:0b3ab51c8877 116 #endif /* __GNUC__ */
bogdanm 84:0b3ab51c8877 117
bogdanm 84:0b3ab51c8877 118
bogdanm 84:0b3ab51c8877 119 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
bogdanm 84:0b3ab51c8877 120 #if defined (__GNUC__) /* GNU Compiler */
bogdanm 84:0b3ab51c8877 121 #ifndef __ALIGN_END
bogdanm 84:0b3ab51c8877 122 #define __ALIGN_END __attribute__ ((aligned (4)))
bogdanm 84:0b3ab51c8877 123 #endif /* __ALIGN_END */
bogdanm 84:0b3ab51c8877 124 #ifndef __ALIGN_BEGIN
bogdanm 84:0b3ab51c8877 125 #define __ALIGN_BEGIN
bogdanm 84:0b3ab51c8877 126 #endif /* __ALIGN_BEGIN */
bogdanm 84:0b3ab51c8877 127 #else
bogdanm 84:0b3ab51c8877 128 #ifndef __ALIGN_END
bogdanm 84:0b3ab51c8877 129 #define __ALIGN_END
bogdanm 84:0b3ab51c8877 130 #endif /* __ALIGN_END */
bogdanm 84:0b3ab51c8877 131 #ifndef __ALIGN_BEGIN
bogdanm 84:0b3ab51c8877 132 #if defined (__CC_ARM) /* ARM Compiler */
bogdanm 84:0b3ab51c8877 133 #define __ALIGN_BEGIN __align(4)
bogdanm 84:0b3ab51c8877 134 #elif defined (__ICCARM__) /* IAR Compiler */
bogdanm 84:0b3ab51c8877 135 #define __ALIGN_BEGIN
bogdanm 84:0b3ab51c8877 136 #elif defined (__TASKING__) /* TASKING Compiler */
bogdanm 84:0b3ab51c8877 137 #define __ALIGN_BEGIN __align(4)
bogdanm 84:0b3ab51c8877 138 #endif /* __CC_ARM */
bogdanm 84:0b3ab51c8877 139 #endif /* __ALIGN_BEGIN */
bogdanm 84:0b3ab51c8877 140 #endif /* __GNUC__ */
bogdanm 84:0b3ab51c8877 141
bogdanm 84:0b3ab51c8877 142 /**
bogdanm 84:0b3ab51c8877 143 * @brief __RAM_FUNC definition
bogdanm 84:0b3ab51c8877 144 */
bogdanm 84:0b3ab51c8877 145 #if defined ( __CC_ARM )
bogdanm 84:0b3ab51c8877 146 /* ARM Compiler
bogdanm 84:0b3ab51c8877 147 ------------
bogdanm 84:0b3ab51c8877 148 RAM functions are defined using the toolchain options.
bogdanm 84:0b3ab51c8877 149 Functions that are executed in RAM should reside in a separate source module.
bogdanm 84:0b3ab51c8877 150 Using the 'Options for File' dialog you can simply change the 'Code / Const'
bogdanm 84:0b3ab51c8877 151 area of a module to a memory space in physical RAM.
bogdanm 84:0b3ab51c8877 152 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
bogdanm 84:0b3ab51c8877 153 dialog.
bogdanm 84:0b3ab51c8877 154 */
bogdanm 84:0b3ab51c8877 155 #define __RAM_FUNC HAL_StatusTypeDef
bogdanm 84:0b3ab51c8877 156
bogdanm 84:0b3ab51c8877 157 #elif defined ( __ICCARM__ )
bogdanm 84:0b3ab51c8877 158 /* ICCARM Compiler
bogdanm 84:0b3ab51c8877 159 ---------------
bogdanm 84:0b3ab51c8877 160 RAM functions are defined using a specific toolchain keyword "__ramfunc".
bogdanm 84:0b3ab51c8877 161 */
bogdanm 84:0b3ab51c8877 162 #define __RAM_FUNC __ramfunc HAL_StatusTypeDef
bogdanm 84:0b3ab51c8877 163
bogdanm 84:0b3ab51c8877 164 #elif defined ( __GNUC__ )
bogdanm 84:0b3ab51c8877 165 /* GNU Compiler
bogdanm 84:0b3ab51c8877 166 ------------
bogdanm 84:0b3ab51c8877 167 RAM functions are defined using a specific toolchain attribute
bogdanm 84:0b3ab51c8877 168 "__attribute__((section(".RamFunc")))".
bogdanm 84:0b3ab51c8877 169 */
bogdanm 84:0b3ab51c8877 170 #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
bogdanm 84:0b3ab51c8877 171
bogdanm 84:0b3ab51c8877 172 #endif
bogdanm 84:0b3ab51c8877 173
bogdanm 84:0b3ab51c8877 174 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 175 }
bogdanm 84:0b3ab51c8877 176 #endif
bogdanm 84:0b3ab51c8877 177
bogdanm 84:0b3ab51c8877 178 #endif /* ___STM32L0xx_HAL_DEF */
bogdanm 84:0b3ab51c8877 179
bogdanm 84:0b3ab51c8877 180 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/