mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Fri Aug 12 13:04:35 2016 +0200
Revision:
123:b0220dba8be7
Release 123 of the mbed library

Changes:
- new targets: nucleo_f207zg, beetle, nrf51_dk, hexiwear,
nuvoton nuc472, vk rz a1h
- ST - fix timer interrupt handler, sleep api fix
- NXP - lpc15xx us ticker fix
- Nordic - analogin fixes, LF clock init addition, enable i2c async

Who changed what in which revision?

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