Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed by
TARGET_NUCLEO_F072RB/stm32f0xx_hal_def.h@122:f9eeca106725, 2016-07-07 (annotated)
- Committer:
- Kojto
- Date:
- Thu Jul 07 14:34:11 2016 +0100
- Revision:
- 122:f9eeca106725
- Parent:
- 108:34e6b704fe68
Release 122 of the mbed library
Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition
Who changed what in which revision?
| User | Revision | Line number | New 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 |
| Kojto | 122:f9eeca106725 | 5 | * @version V1.4.0 |
| Kojto | 122:f9eeca106725 | 6 | * @date 27-May-2016 |
| 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 | * |
| Kojto | 122:f9eeca106725 | 12 | * <h2><center>© COPYRIGHT(c) 2016 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" |
| Kojto | 108:34e6b704fe68 | 49 | #include "stm32_hal_legacy.h" |
| Kojto | 108:34e6b704fe68 | 50 | #include <stdio.h> |
| bogdanm | 85:024bf7f99721 | 51 | |
| bogdanm | 85:024bf7f99721 | 52 | /* Exported types ------------------------------------------------------------*/ |
| bogdanm | 85:024bf7f99721 | 53 | |
| bogdanm | 85:024bf7f99721 | 54 | /** |
| bogdanm | 85:024bf7f99721 | 55 | * @brief HAL Status structures definition |
| bogdanm | 85:024bf7f99721 | 56 | */ |
| bogdanm | 85:024bf7f99721 | 57 | typedef enum |
| bogdanm | 85:024bf7f99721 | 58 | { |
| bogdanm | 85:024bf7f99721 | 59 | HAL_OK = 0x00, |
| bogdanm | 85:024bf7f99721 | 60 | HAL_ERROR = 0x01, |
| bogdanm | 85:024bf7f99721 | 61 | HAL_BUSY = 0x02, |
| bogdanm | 85:024bf7f99721 | 62 | HAL_TIMEOUT = 0x03 |
| bogdanm | 85:024bf7f99721 | 63 | } HAL_StatusTypeDef; |
| bogdanm | 85:024bf7f99721 | 64 | |
| bogdanm | 85:024bf7f99721 | 65 | /** |
| bogdanm | 85:024bf7f99721 | 66 | * @brief HAL Lock structures definition |
| bogdanm | 85:024bf7f99721 | 67 | */ |
| bogdanm | 85:024bf7f99721 | 68 | typedef enum |
| bogdanm | 85:024bf7f99721 | 69 | { |
| bogdanm | 85:024bf7f99721 | 70 | HAL_UNLOCKED = 0x00, |
| bogdanm | 85:024bf7f99721 | 71 | HAL_LOCKED = 0x01 |
| bogdanm | 85:024bf7f99721 | 72 | } HAL_LockTypeDef; |
| bogdanm | 85:024bf7f99721 | 73 | |
| bogdanm | 85:024bf7f99721 | 74 | /* Exported macro ------------------------------------------------------------*/ |
| bogdanm | 85:024bf7f99721 | 75 | |
| Kojto | 122:f9eeca106725 | 76 | #define HAL_MAX_DELAY 0xFFFFFFFFU |
| bogdanm | 85:024bf7f99721 | 77 | |
| bogdanm | 85:024bf7f99721 | 78 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) |
| bogdanm | 85:024bf7f99721 | 79 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) |
| bogdanm | 85:024bf7f99721 | 80 | |
| bogdanm | 85:024bf7f99721 | 81 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \ |
| bogdanm | 85:024bf7f99721 | 82 | do{ \ |
| bogdanm | 85:024bf7f99721 | 83 | (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \ |
| bogdanm | 85:024bf7f99721 | 84 | (__DMA_HANDLE_).Parent = (__HANDLE__); \ |
| bogdanm | 85:024bf7f99721 | 85 | } while(0) |
| bogdanm | 85:024bf7f99721 | 86 | |
| Kojto | 93:e188a91d3eaa | 87 | #define UNUSED(x) ((void)(x)) |
| Kojto | 93:e188a91d3eaa | 88 | |
| bogdanm | 92:4fc01daae5a5 | 89 | /** @brief Reset the Handle's State field. |
| bogdanm | 92:4fc01daae5a5 | 90 | * @param __HANDLE__: specifies the Peripheral Handle. |
| bogdanm | 92:4fc01daae5a5 | 91 | * @note This macro can be used for the following purpose: |
| bogdanm | 92:4fc01daae5a5 | 92 | * - When the Handle is declared as local variable; before passing it as parameter |
| bogdanm | 92:4fc01daae5a5 | 93 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro |
| bogdanm | 92:4fc01daae5a5 | 94 | * to set to 0 the Handle's "State" field. |
| bogdanm | 92:4fc01daae5a5 | 95 | * Otherwise, "State" field may have any random value and the first time the function |
| bogdanm | 92:4fc01daae5a5 | 96 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed |
| bogdanm | 92:4fc01daae5a5 | 97 | * (i.e. HAL_PPP_MspInit() will not be executed). |
| bogdanm | 92:4fc01daae5a5 | 98 | * - When there is a need to reconfigure the low level hardware: instead of calling |
| bogdanm | 92:4fc01daae5a5 | 99 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). |
| bogdanm | 92:4fc01daae5a5 | 100 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function |
| bogdanm | 92:4fc01daae5a5 | 101 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. |
| bogdanm | 92:4fc01daae5a5 | 102 | * @retval None |
| bogdanm | 92:4fc01daae5a5 | 103 | */ |
| bogdanm | 92:4fc01daae5a5 | 104 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0) |
| bogdanm | 92:4fc01daae5a5 | 105 | |
| bogdanm | 85:024bf7f99721 | 106 | #if (USE_RTOS == 1) |
| bogdanm | 85:024bf7f99721 | 107 | #error " USE_RTOS should be 0 in the current HAL release " |
| bogdanm | 85:024bf7f99721 | 108 | #else |
| bogdanm | 85:024bf7f99721 | 109 | #define __HAL_LOCK(__HANDLE__) \ |
| bogdanm | 85:024bf7f99721 | 110 | do{ \ |
| bogdanm | 85:024bf7f99721 | 111 | if((__HANDLE__)->Lock == HAL_LOCKED) \ |
| bogdanm | 85:024bf7f99721 | 112 | { \ |
| bogdanm | 85:024bf7f99721 | 113 | return HAL_BUSY; \ |
| bogdanm | 85:024bf7f99721 | 114 | } \ |
| bogdanm | 85:024bf7f99721 | 115 | else \ |
| bogdanm | 85:024bf7f99721 | 116 | { \ |
| bogdanm | 85:024bf7f99721 | 117 | (__HANDLE__)->Lock = HAL_LOCKED; \ |
| bogdanm | 85:024bf7f99721 | 118 | } \ |
| bogdanm | 85:024bf7f99721 | 119 | }while (0) |
| bogdanm | 85:024bf7f99721 | 120 | |
| bogdanm | 85:024bf7f99721 | 121 | #define __HAL_UNLOCK(__HANDLE__) \ |
| bogdanm | 85:024bf7f99721 | 122 | do{ \ |
| bogdanm | 85:024bf7f99721 | 123 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ |
| bogdanm | 85:024bf7f99721 | 124 | }while (0) |
| bogdanm | 85:024bf7f99721 | 125 | #endif /* USE_RTOS */ |
| bogdanm | 85:024bf7f99721 | 126 | |
| bogdanm | 85:024bf7f99721 | 127 | #if defined ( __GNUC__ ) |
| bogdanm | 85:024bf7f99721 | 128 | #ifndef __weak |
| bogdanm | 85:024bf7f99721 | 129 | #define __weak __attribute__((weak)) |
| bogdanm | 85:024bf7f99721 | 130 | #endif /* __weak */ |
| bogdanm | 85:024bf7f99721 | 131 | #ifndef __packed |
| bogdanm | 85:024bf7f99721 | 132 | #define __packed __attribute__((__packed__)) |
| bogdanm | 85:024bf7f99721 | 133 | #endif /* __packed */ |
| bogdanm | 85:024bf7f99721 | 134 | #endif /* __GNUC__ */ |
| bogdanm | 85:024bf7f99721 | 135 | |
| bogdanm | 85:024bf7f99721 | 136 | |
| bogdanm | 85:024bf7f99721 | 137 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ |
| bogdanm | 85:024bf7f99721 | 138 | #if defined (__GNUC__) /* GNU Compiler */ |
| bogdanm | 85:024bf7f99721 | 139 | #ifndef __ALIGN_END |
| bogdanm | 85:024bf7f99721 | 140 | #define __ALIGN_END __attribute__ ((aligned (4))) |
| bogdanm | 85:024bf7f99721 | 141 | #endif /* __ALIGN_END */ |
| bogdanm | 85:024bf7f99721 | 142 | #ifndef __ALIGN_BEGIN |
| bogdanm | 85:024bf7f99721 | 143 | #define __ALIGN_BEGIN |
| bogdanm | 85:024bf7f99721 | 144 | #endif /* __ALIGN_BEGIN */ |
| bogdanm | 85:024bf7f99721 | 145 | #else |
| bogdanm | 85:024bf7f99721 | 146 | #ifndef __ALIGN_END |
| bogdanm | 85:024bf7f99721 | 147 | #define __ALIGN_END |
| bogdanm | 85:024bf7f99721 | 148 | #endif /* __ALIGN_END */ |
| bogdanm | 85:024bf7f99721 | 149 | #ifndef __ALIGN_BEGIN |
| bogdanm | 85:024bf7f99721 | 150 | #if defined (__CC_ARM) /* ARM Compiler */ |
| bogdanm | 85:024bf7f99721 | 151 | #define __ALIGN_BEGIN __align(4) |
| bogdanm | 85:024bf7f99721 | 152 | #elif defined (__ICCARM__) /* IAR Compiler */ |
| bogdanm | 85:024bf7f99721 | 153 | #define __ALIGN_BEGIN |
| bogdanm | 85:024bf7f99721 | 154 | #endif /* __CC_ARM */ |
| bogdanm | 85:024bf7f99721 | 155 | #endif /* __ALIGN_BEGIN */ |
| bogdanm | 85:024bf7f99721 | 156 | #endif /* __GNUC__ */ |
| bogdanm | 85:024bf7f99721 | 157 | |
| Kojto | 93:e188a91d3eaa | 158 | /** |
| Kojto | 93:e188a91d3eaa | 159 | * @brief __NOINLINE definition |
| Kojto | 93:e188a91d3eaa | 160 | */ |
| Kojto | 93:e188a91d3eaa | 161 | #if defined ( __CC_ARM ) || defined ( __GNUC__ ) |
| Kojto | 93:e188a91d3eaa | 162 | /* ARM & GNUCompiler |
| Kojto | 93:e188a91d3eaa | 163 | ---------------- |
| Kojto | 93:e188a91d3eaa | 164 | */ |
| Kojto | 93:e188a91d3eaa | 165 | #define __NOINLINE __attribute__ ( (noinline) ) |
| Kojto | 93:e188a91d3eaa | 166 | |
| Kojto | 93:e188a91d3eaa | 167 | #elif defined ( __ICCARM__ ) |
| Kojto | 93:e188a91d3eaa | 168 | /* ICCARM Compiler |
| Kojto | 93:e188a91d3eaa | 169 | --------------- |
| Kojto | 93:e188a91d3eaa | 170 | */ |
| Kojto | 93:e188a91d3eaa | 171 | #define __NOINLINE _Pragma("optimize = no_inline") |
| Kojto | 93:e188a91d3eaa | 172 | |
| Kojto | 93:e188a91d3eaa | 173 | #endif |
| Kojto | 93:e188a91d3eaa | 174 | |
| bogdanm | 85:024bf7f99721 | 175 | #ifdef __cplusplus |
| bogdanm | 85:024bf7f99721 | 176 | } |
| bogdanm | 85:024bf7f99721 | 177 | #endif |
| bogdanm | 85:024bf7f99721 | 178 | |
| bogdanm | 85:024bf7f99721 | 179 | #endif /* ___STM32F0xx_HAL_DEF */ |
| bogdanm | 85:024bf7f99721 | 180 | |
| bogdanm | 85:024bf7f99721 | 181 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
| bogdanm | 92:4fc01daae5a5 | 182 |
