my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Feb 03 15:31:20 2015 +0000
Revision:
93:e188a91d3eaa
Parent:
92:4fc01daae5a5
Release 93 of the mbed library

Main changes:

- Renesas RZ_A1H bugfixes - i2c, ticker
- new targets - Nucleo F303RE, Nucleo F070RB, BLE SMURFS,
Dragonfly 411RE,
- BusXXX - is connected method, plus operators addition
- LPC8xx - I2c fixes
- timestamp_t reverted to uint32_t
- RTX - fixes regarding stack (alignment, magic word)

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
Kojto 93:e188a91d3eaa 5 * @version V1.2.0
Kojto 93:e188a91d3eaa 6 * @date 11-December-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 ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 73 #ifndef NULL
Kojto 93:e188a91d3eaa 74 #define NULL 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
Kojto 93:e188a91d3eaa 88 #define UNUSED(x) ((void)(x))
Kojto 93:e188a91d3eaa 89
bogdanm 92:4fc01daae5a5 90 /** @brief Reset the Handle's State field.
bogdanm 92:4fc01daae5a5 91 * @param __HANDLE__: specifies the Peripheral Handle.
bogdanm 92:4fc01daae5a5 92 * @note This macro can be used for the following purpose:
bogdanm 92:4fc01daae5a5 93 * - When the Handle is declared as local variable; before passing it as parameter
bogdanm 92:4fc01daae5a5 94 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
bogdanm 92:4fc01daae5a5 95 * to set to 0 the Handle's "State" field.
bogdanm 92:4fc01daae5a5 96 * Otherwise, "State" field may have any random value and the first time the function
bogdanm 92:4fc01daae5a5 97 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
bogdanm 92:4fc01daae5a5 98 * (i.e. HAL_PPP_MspInit() will not be executed).
bogdanm 92:4fc01daae5a5 99 * - When there is a need to reconfigure the low level hardware: instead of calling
bogdanm 92:4fc01daae5a5 100 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
bogdanm 92:4fc01daae5a5 101 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
bogdanm 92:4fc01daae5a5 102 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
bogdanm 92:4fc01daae5a5 103 * @retval None
bogdanm 92:4fc01daae5a5 104 */
bogdanm 92:4fc01daae5a5 105 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
bogdanm 92:4fc01daae5a5 106
bogdanm 85:024bf7f99721 107 #if (USE_RTOS == 1)
bogdanm 85:024bf7f99721 108 #error " USE_RTOS should be 0 in the current HAL release "
bogdanm 85:024bf7f99721 109 #else
bogdanm 85:024bf7f99721 110 #define __HAL_LOCK(__HANDLE__) \
bogdanm 85:024bf7f99721 111 do{ \
bogdanm 85:024bf7f99721 112 if((__HANDLE__)->Lock == HAL_LOCKED) \
bogdanm 85:024bf7f99721 113 { \
bogdanm 85:024bf7f99721 114 return HAL_BUSY; \
bogdanm 85:024bf7f99721 115 } \
bogdanm 85:024bf7f99721 116 else \
bogdanm 85:024bf7f99721 117 { \
bogdanm 85:024bf7f99721 118 (__HANDLE__)->Lock = HAL_LOCKED; \
bogdanm 85:024bf7f99721 119 } \
bogdanm 85:024bf7f99721 120 }while (0)
bogdanm 85:024bf7f99721 121
bogdanm 85:024bf7f99721 122 #define __HAL_UNLOCK(__HANDLE__) \
bogdanm 85:024bf7f99721 123 do{ \
bogdanm 85:024bf7f99721 124 (__HANDLE__)->Lock = HAL_UNLOCKED; \
bogdanm 85:024bf7f99721 125 }while (0)
bogdanm 85:024bf7f99721 126 #endif /* USE_RTOS */
bogdanm 85:024bf7f99721 127
bogdanm 85:024bf7f99721 128 #if defined ( __GNUC__ )
bogdanm 85:024bf7f99721 129 #ifndef __weak
bogdanm 85:024bf7f99721 130 #define __weak __attribute__((weak))
bogdanm 85:024bf7f99721 131 #endif /* __weak */
bogdanm 85:024bf7f99721 132 #ifndef __packed
bogdanm 85:024bf7f99721 133 #define __packed __attribute__((__packed__))
bogdanm 85:024bf7f99721 134 #endif /* __packed */
bogdanm 85:024bf7f99721 135 #endif /* __GNUC__ */
bogdanm 85:024bf7f99721 136
bogdanm 85:024bf7f99721 137
bogdanm 85:024bf7f99721 138 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
bogdanm 85:024bf7f99721 139 #if defined (__GNUC__) /* GNU Compiler */
bogdanm 85:024bf7f99721 140 #ifndef __ALIGN_END
bogdanm 85:024bf7f99721 141 #define __ALIGN_END __attribute__ ((aligned (4)))
bogdanm 85:024bf7f99721 142 #endif /* __ALIGN_END */
bogdanm 85:024bf7f99721 143 #ifndef __ALIGN_BEGIN
bogdanm 85:024bf7f99721 144 #define __ALIGN_BEGIN
bogdanm 85:024bf7f99721 145 #endif /* __ALIGN_BEGIN */
bogdanm 85:024bf7f99721 146 #else
bogdanm 85:024bf7f99721 147 #ifndef __ALIGN_END
bogdanm 85:024bf7f99721 148 #define __ALIGN_END
bogdanm 85:024bf7f99721 149 #endif /* __ALIGN_END */
bogdanm 85:024bf7f99721 150 #ifndef __ALIGN_BEGIN
bogdanm 85:024bf7f99721 151 #if defined (__CC_ARM) /* ARM Compiler */
bogdanm 85:024bf7f99721 152 #define __ALIGN_BEGIN __align(4)
bogdanm 85:024bf7f99721 153 #elif defined (__ICCARM__) /* IAR Compiler */
bogdanm 85:024bf7f99721 154 #define __ALIGN_BEGIN
bogdanm 85:024bf7f99721 155 #endif /* __CC_ARM */
bogdanm 85:024bf7f99721 156 #endif /* __ALIGN_BEGIN */
bogdanm 85:024bf7f99721 157 #endif /* __GNUC__ */
bogdanm 85:024bf7f99721 158
Kojto 93:e188a91d3eaa 159 /**
Kojto 93:e188a91d3eaa 160 * @brief __NOINLINE definition
Kojto 93:e188a91d3eaa 161 */
Kojto 93:e188a91d3eaa 162 #if defined ( __CC_ARM ) || defined ( __GNUC__ )
Kojto 93:e188a91d3eaa 163 /* ARM & GNUCompiler
Kojto 93:e188a91d3eaa 164 ----------------
Kojto 93:e188a91d3eaa 165 */
Kojto 93:e188a91d3eaa 166 #define __NOINLINE __attribute__ ( (noinline) )
Kojto 93:e188a91d3eaa 167
Kojto 93:e188a91d3eaa 168 #elif defined ( __ICCARM__ )
Kojto 93:e188a91d3eaa 169 /* ICCARM Compiler
Kojto 93:e188a91d3eaa 170 ---------------
Kojto 93:e188a91d3eaa 171 */
Kojto 93:e188a91d3eaa 172 #define __NOINLINE _Pragma("optimize = no_inline")
Kojto 93:e188a91d3eaa 173
Kojto 93:e188a91d3eaa 174 #endif
Kojto 93:e188a91d3eaa 175
bogdanm 85:024bf7f99721 176 #ifdef __cplusplus
bogdanm 85:024bf7f99721 177 }
bogdanm 85:024bf7f99721 178 #endif
bogdanm 85:024bf7f99721 179
bogdanm 85:024bf7f99721 180 #endif /* ___STM32F0xx_HAL_DEF */
bogdanm 85:024bf7f99721 181
bogdanm 85:024bf7f99721 182 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 183