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