Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
100:cbbeb26dbd92
.

Who changed what in which revision?

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