Mbed for VNG board

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Nov 07 15:45:07 2014 +0000
Revision:
394:83f921546702
Parent:
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L152RE/stm32l1xx_hal_def.h@354:e67efb2aab0e
Synchronized with git revision aab52cb7ec5a665869e507dd988bbfd55b7e087e

Full URL: https://github.com/mbedmicro/mbed/commit/aab52cb7ec5a665869e507dd988bbfd55b7e087e/

Tests: Fix cpputest testrunner

Who changed what in which revision?

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