meh

Fork of mbed by mbed official

Committer:
ricardobtez
Date:
Tue Apr 05 23:51:21 2016 +0000
Revision:
118:16969dd821af
Parent:
92:4fc01daae5a5
Child:
93:e188a91d3eaa
dgdgr

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx_hal_def.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
bogdanm 92:4fc01daae5a5 5 * @version V1.1.0
bogdanm 92:4fc01daae5a5 6 * @date 03-Oct-2014
bogdanm 85:024bf7f99721 7 * @brief This file contains HAL common defines, enumeration, macros and
bogdanm 85:024bf7f99721 8 * structures definitions.
bogdanm 85:024bf7f99721 9 ******************************************************************************
bogdanm 85:024bf7f99721 10 * @attention
bogdanm 85:024bf7f99721 11 *
bogdanm 85:024bf7f99721 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 13 *
bogdanm 85:024bf7f99721 14 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 15 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 16 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 17 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 19 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 20 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 22 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 23 * without specific prior written permission.
bogdanm 85:024bf7f99721 24 *
bogdanm 85:024bf7f99721 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 35 *
bogdanm 85:024bf7f99721 36 ******************************************************************************
bogdanm 85:024bf7f99721 37 */
bogdanm 85:024bf7f99721 38
bogdanm 85:024bf7f99721 39 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 85:024bf7f99721 40 #ifndef __STM32F0xx_HAL_DEF
bogdanm 85:024bf7f99721 41 #define __STM32F0xx_HAL_DEF
bogdanm 85:024bf7f99721 42
bogdanm 85:024bf7f99721 43 #ifdef __cplusplus
bogdanm 85:024bf7f99721 44 extern "C" {
bogdanm 85:024bf7f99721 45 #endif
bogdanm 85:024bf7f99721 46
bogdanm 85:024bf7f99721 47 /* Includes ------------------------------------------------------------------*/
bogdanm 85:024bf7f99721 48 #include "stm32f0xx.h"
bogdanm 85:024bf7f99721 49
bogdanm 85:024bf7f99721 50 /* Exported types ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 51
bogdanm 85:024bf7f99721 52 /**
bogdanm 85:024bf7f99721 53 * @brief HAL Status structures definition
bogdanm 85:024bf7f99721 54 */
bogdanm 85:024bf7f99721 55 typedef enum
bogdanm 85:024bf7f99721 56 {
bogdanm 85:024bf7f99721 57 HAL_OK = 0x00,
bogdanm 85:024bf7f99721 58 HAL_ERROR = 0x01,
bogdanm 85:024bf7f99721 59 HAL_BUSY = 0x02,
bogdanm 85:024bf7f99721 60 HAL_TIMEOUT = 0x03
bogdanm 85:024bf7f99721 61 } HAL_StatusTypeDef;
bogdanm 85:024bf7f99721 62
bogdanm 85:024bf7f99721 63 /**
bogdanm 85:024bf7f99721 64 * @brief HAL Lock structures definition
bogdanm 85:024bf7f99721 65 */
bogdanm 85:024bf7f99721 66 typedef enum
bogdanm 85:024bf7f99721 67 {
bogdanm 85:024bf7f99721 68 HAL_UNLOCKED = 0x00,
bogdanm 85:024bf7f99721 69 HAL_LOCKED = 0x01
bogdanm 85:024bf7f99721 70 } HAL_LockTypeDef;
bogdanm 85:024bf7f99721 71
bogdanm 85:024bf7f99721 72 /* Exported macro ------------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 73 #ifndef HAL_NULL
bogdanm 92:4fc01daae5a5 74 #define HAL_NULL (void *) 0
bogdanm 85:024bf7f99721 75 #endif
bogdanm 85:024bf7f99721 76
bogdanm 85:024bf7f99721 77 #define HAL_MAX_DELAY 0xFFFFFFFF
bogdanm 85:024bf7f99721 78
bogdanm 85:024bf7f99721 79 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
bogdanm 85:024bf7f99721 80 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
bogdanm 85:024bf7f99721 81
bogdanm 85:024bf7f99721 82 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
bogdanm 85:024bf7f99721 83 do{ \
bogdanm 85:024bf7f99721 84 (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
bogdanm 85:024bf7f99721 85 (__DMA_HANDLE_).Parent = (__HANDLE__); \
bogdanm 85:024bf7f99721 86 } while(0)
bogdanm 85:024bf7f99721 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 85:024bf7f99721 105 #if (USE_RTOS == 1)
bogdanm 85:024bf7f99721 106 #error " USE_RTOS should be 0 in the current HAL release "
bogdanm 85:024bf7f99721 107 #else
bogdanm 85:024bf7f99721 108 #define __HAL_LOCK(__HANDLE__) \
bogdanm 85:024bf7f99721 109 do{ \
bogdanm 85:024bf7f99721 110 if((__HANDLE__)->Lock == HAL_LOCKED) \
bogdanm 85:024bf7f99721 111 { \
bogdanm 85:024bf7f99721 112 return HAL_BUSY; \
bogdanm 85:024bf7f99721 113 } \
bogdanm 85:024bf7f99721 114 else \
bogdanm 85:024bf7f99721 115 { \
bogdanm 85:024bf7f99721 116 (__HANDLE__)->Lock = HAL_LOCKED; \
bogdanm 85:024bf7f99721 117 } \
bogdanm 85:024bf7f99721 118 }while (0)
bogdanm 85:024bf7f99721 119
bogdanm 85:024bf7f99721 120 #define __HAL_UNLOCK(__HANDLE__) \
bogdanm 85:024bf7f99721 121 do{ \
bogdanm 85:024bf7f99721 122 (__HANDLE__)->Lock = HAL_UNLOCKED; \
bogdanm 85:024bf7f99721 123 }while (0)
bogdanm 85:024bf7f99721 124 #endif /* USE_RTOS */
bogdanm 85:024bf7f99721 125
bogdanm 85:024bf7f99721 126 #if defined ( __GNUC__ )
bogdanm 85:024bf7f99721 127 #ifndef __weak
bogdanm 85:024bf7f99721 128 #define __weak __attribute__((weak))
bogdanm 85:024bf7f99721 129 #endif /* __weak */
bogdanm 85:024bf7f99721 130 #ifndef __packed
bogdanm 85:024bf7f99721 131 #define __packed __attribute__((__packed__))
bogdanm 85:024bf7f99721 132 #endif /* __packed */
bogdanm 85:024bf7f99721 133 #endif /* __GNUC__ */
bogdanm 85:024bf7f99721 134
bogdanm 85:024bf7f99721 135
bogdanm 85:024bf7f99721 136 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
bogdanm 85:024bf7f99721 137 #if defined (__GNUC__) /* GNU Compiler */
bogdanm 85:024bf7f99721 138 #ifndef __ALIGN_END
bogdanm 85:024bf7f99721 139 #define __ALIGN_END __attribute__ ((aligned (4)))
bogdanm 85:024bf7f99721 140 #endif /* __ALIGN_END */
bogdanm 85:024bf7f99721 141 #ifndef __ALIGN_BEGIN
bogdanm 85:024bf7f99721 142 #define __ALIGN_BEGIN
bogdanm 85:024bf7f99721 143 #endif /* __ALIGN_BEGIN */
bogdanm 85:024bf7f99721 144 #else
bogdanm 85:024bf7f99721 145 #ifndef __ALIGN_END
bogdanm 85:024bf7f99721 146 #define __ALIGN_END
bogdanm 85:024bf7f99721 147 #endif /* __ALIGN_END */
bogdanm 85:024bf7f99721 148 #ifndef __ALIGN_BEGIN
bogdanm 85:024bf7f99721 149 #if defined (__CC_ARM) /* ARM Compiler */
bogdanm 85:024bf7f99721 150 #define __ALIGN_BEGIN __align(4)
bogdanm 85:024bf7f99721 151 #elif defined (__ICCARM__) /* IAR Compiler */
bogdanm 85:024bf7f99721 152 #define __ALIGN_BEGIN
bogdanm 85:024bf7f99721 153 #endif /* __CC_ARM */
bogdanm 85:024bf7f99721 154 #endif /* __ALIGN_BEGIN */
bogdanm 85:024bf7f99721 155 #endif /* __GNUC__ */
bogdanm 85:024bf7f99721 156
bogdanm 85:024bf7f99721 157 #ifdef __cplusplus
bogdanm 85:024bf7f99721 158 }
bogdanm 85:024bf7f99721 159 #endif
bogdanm 85:024bf7f99721 160
bogdanm 85:024bf7f99721 161 #endif /* ___STM32F0xx_HAL_DEF */
bogdanm 85:024bf7f99721 162
bogdanm 85:024bf7f99721 163 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 164