meh
Fork of mbed by
TARGET_NUCLEO_F401RE/stm32f4xx_hal_def.h@85:024bf7f99721, 2014-06-11 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Jun 11 15:14:05 2014 +0100
- Revision:
- 85:024bf7f99721
- Parent:
- 81:7d30d6019079
- Child:
- 90:cb3d968589d8
Release 85 of the mbed library
Main changes:
- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F
There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 77:869cf507173a | 1 | /** |
emilmont | 77:869cf507173a | 2 | ****************************************************************************** |
emilmont | 77:869cf507173a | 3 | * @file stm32f4xx_hal_def.h |
emilmont | 77:869cf507173a | 4 | * @author MCD Application Team |
bogdanm | 85:024bf7f99721 | 5 | * @version V1.1.0RC2 |
bogdanm | 85:024bf7f99721 | 6 | * @date 14-May-2014 |
emilmont | 77:869cf507173a | 7 | * @brief This file contains HAL common defines, enumeration, macros and |
emilmont | 77:869cf507173a | 8 | * structures definitions. |
emilmont | 77:869cf507173a | 9 | ****************************************************************************** |
emilmont | 77:869cf507173a | 10 | * @attention |
emilmont | 77:869cf507173a | 11 | * |
emilmont | 77:869cf507173a | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
emilmont | 77:869cf507173a | 13 | * |
emilmont | 77:869cf507173a | 14 | * Redistribution and use in source and binary forms, with or without modification, |
emilmont | 77:869cf507173a | 15 | * are permitted provided that the following conditions are met: |
emilmont | 77:869cf507173a | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
emilmont | 77:869cf507173a | 17 | * this list of conditions and the following disclaimer. |
emilmont | 77:869cf507173a | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
emilmont | 77:869cf507173a | 19 | * this list of conditions and the following disclaimer in the documentation |
emilmont | 77:869cf507173a | 20 | * and/or other materials provided with the distribution. |
emilmont | 77:869cf507173a | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
emilmont | 77:869cf507173a | 22 | * may be used to endorse or promote products derived from this software |
emilmont | 77:869cf507173a | 23 | * without specific prior written permission. |
emilmont | 77:869cf507173a | 24 | * |
emilmont | 77:869cf507173a | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
emilmont | 77:869cf507173a | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
emilmont | 77:869cf507173a | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
emilmont | 77:869cf507173a | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
emilmont | 77:869cf507173a | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
emilmont | 77:869cf507173a | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
emilmont | 77:869cf507173a | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
emilmont | 77:869cf507173a | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
emilmont | 77:869cf507173a | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
emilmont | 77:869cf507173a | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
emilmont | 77:869cf507173a | 35 | * |
emilmont | 77:869cf507173a | 36 | ****************************************************************************** |
emilmont | 77:869cf507173a | 37 | */ |
emilmont | 77:869cf507173a | 38 | |
emilmont | 77:869cf507173a | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
emilmont | 77:869cf507173a | 40 | #ifndef __STM32F4xx_HAL_DEF |
emilmont | 77:869cf507173a | 41 | #define __STM32F4xx_HAL_DEF |
emilmont | 77:869cf507173a | 42 | |
emilmont | 77:869cf507173a | 43 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 44 | extern "C" { |
emilmont | 77:869cf507173a | 45 | #endif |
emilmont | 77:869cf507173a | 46 | |
emilmont | 77:869cf507173a | 47 | /* Includes ------------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 48 | #include "stm32f4xx.h" |
emilmont | 77:869cf507173a | 49 | |
emilmont | 77:869cf507173a | 50 | /* Exported types ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 51 | |
emilmont | 77:869cf507173a | 52 | /** |
emilmont | 77:869cf507173a | 53 | * @brief HAL Status structures definition |
emilmont | 77:869cf507173a | 54 | */ |
emilmont | 77:869cf507173a | 55 | typedef enum |
emilmont | 77:869cf507173a | 56 | { |
emilmont | 77:869cf507173a | 57 | HAL_OK = 0x00, |
emilmont | 77:869cf507173a | 58 | HAL_ERROR = 0x01, |
emilmont | 77:869cf507173a | 59 | HAL_BUSY = 0x02, |
emilmont | 77:869cf507173a | 60 | HAL_TIMEOUT = 0x03 |
emilmont | 77:869cf507173a | 61 | } HAL_StatusTypeDef; |
emilmont | 77:869cf507173a | 62 | |
emilmont | 77:869cf507173a | 63 | /** |
emilmont | 77:869cf507173a | 64 | * @brief HAL Lock structures definition |
emilmont | 77:869cf507173a | 65 | */ |
emilmont | 77:869cf507173a | 66 | typedef enum |
emilmont | 77:869cf507173a | 67 | { |
emilmont | 77:869cf507173a | 68 | HAL_UNLOCKED = 0x00, |
emilmont | 77:869cf507173a | 69 | HAL_LOCKED = 0x01 |
emilmont | 77:869cf507173a | 70 | } HAL_LockTypeDef; |
emilmont | 77:869cf507173a | 71 | |
emilmont | 77:869cf507173a | 72 | /* Exported macro ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 73 | #ifndef NULL |
emilmont | 77:869cf507173a | 74 | #define NULL (void *) 0 |
emilmont | 77:869cf507173a | 75 | #endif |
emilmont | 77:869cf507173a | 76 | |
emilmont | 77:869cf507173a | 77 | #define HAL_MAX_DELAY 0xFFFFFFFF |
emilmont | 77:869cf507173a | 78 | |
emilmont | 77:869cf507173a | 79 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) |
emilmont | 77:869cf507173a | 80 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) |
emilmont | 77:869cf507173a | 81 | |
bogdanm | 85:024bf7f99721 | 82 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ |
emilmont | 77:869cf507173a | 83 | do{ \ |
bogdanm | 85:024bf7f99721 | 84 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ |
bogdanm | 85:024bf7f99721 | 85 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ |
emilmont | 77:869cf507173a | 86 | } while(0) |
emilmont | 77:869cf507173a | 87 | |
emilmont | 77:869cf507173a | 88 | #if (USE_RTOS == 1) |
emilmont | 77:869cf507173a | 89 | /* Reserved for future use */ |
emilmont | 77:869cf507173a | 90 | #else |
emilmont | 77:869cf507173a | 91 | #define __HAL_LOCK(__HANDLE__) \ |
emilmont | 77:869cf507173a | 92 | do{ \ |
emilmont | 77:869cf507173a | 93 | if((__HANDLE__)->Lock == HAL_LOCKED) \ |
emilmont | 77:869cf507173a | 94 | { \ |
emilmont | 77:869cf507173a | 95 | return HAL_BUSY; \ |
emilmont | 77:869cf507173a | 96 | } \ |
emilmont | 77:869cf507173a | 97 | else \ |
emilmont | 77:869cf507173a | 98 | { \ |
emilmont | 77:869cf507173a | 99 | (__HANDLE__)->Lock = HAL_LOCKED; \ |
emilmont | 77:869cf507173a | 100 | } \ |
emilmont | 77:869cf507173a | 101 | }while (0) |
emilmont | 77:869cf507173a | 102 | |
emilmont | 77:869cf507173a | 103 | #define __HAL_UNLOCK(__HANDLE__) \ |
emilmont | 77:869cf507173a | 104 | do{ \ |
emilmont | 77:869cf507173a | 105 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ |
emilmont | 77:869cf507173a | 106 | }while (0) |
emilmont | 77:869cf507173a | 107 | #endif /* USE_RTOS */ |
emilmont | 77:869cf507173a | 108 | |
emilmont | 77:869cf507173a | 109 | #if defined ( __GNUC__ ) |
emilmont | 77:869cf507173a | 110 | #ifndef __weak |
emilmont | 77:869cf507173a | 111 | #define __weak __attribute__((weak)) |
emilmont | 77:869cf507173a | 112 | #endif /* __weak */ |
emilmont | 77:869cf507173a | 113 | #ifndef __packed |
emilmont | 77:869cf507173a | 114 | #define __packed __attribute__((__packed__)) |
emilmont | 77:869cf507173a | 115 | #endif /* __packed */ |
emilmont | 77:869cf507173a | 116 | #endif /* __GNUC__ */ |
emilmont | 77:869cf507173a | 117 | |
bogdanm | 81:7d30d6019079 | 118 | |
bogdanm | 81:7d30d6019079 | 119 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ |
bogdanm | 81:7d30d6019079 | 120 | #if defined (__GNUC__) /* GNU Compiler */ |
bogdanm | 81:7d30d6019079 | 121 | #ifndef __ALIGN_END |
bogdanm | 81:7d30d6019079 | 122 | #define __ALIGN_END __attribute__ ((aligned (4))) |
bogdanm | 81:7d30d6019079 | 123 | #endif /* __ALIGN_END */ |
bogdanm | 81:7d30d6019079 | 124 | #ifndef __ALIGN_BEGIN |
bogdanm | 81:7d30d6019079 | 125 | #define __ALIGN_BEGIN |
bogdanm | 81:7d30d6019079 | 126 | #endif /* __ALIGN_BEGIN */ |
bogdanm | 81:7d30d6019079 | 127 | #else |
bogdanm | 81:7d30d6019079 | 128 | #ifndef __ALIGN_END |
bogdanm | 81:7d30d6019079 | 129 | #define __ALIGN_END |
bogdanm | 81:7d30d6019079 | 130 | #endif /* __ALIGN_END */ |
bogdanm | 81:7d30d6019079 | 131 | #ifndef __ALIGN_BEGIN |
bogdanm | 81:7d30d6019079 | 132 | #if defined (__CC_ARM) /* ARM Compiler */ |
bogdanm | 81:7d30d6019079 | 133 | #define __ALIGN_BEGIN __align(4) |
bogdanm | 81:7d30d6019079 | 134 | #elif defined (__ICCARM__) /* IAR Compiler */ |
bogdanm | 81:7d30d6019079 | 135 | #define __ALIGN_BEGIN |
bogdanm | 81:7d30d6019079 | 136 | #elif defined (__TASKING__) /* TASKING Compiler */ |
bogdanm | 81:7d30d6019079 | 137 | #define __ALIGN_BEGIN __align(4) |
bogdanm | 81:7d30d6019079 | 138 | #endif /* __CC_ARM */ |
bogdanm | 81:7d30d6019079 | 139 | #endif /* __ALIGN_BEGIN */ |
bogdanm | 81:7d30d6019079 | 140 | #endif /* __GNUC__ */ |
bogdanm | 81:7d30d6019079 | 141 | |
emilmont | 77:869cf507173a | 142 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 143 | } |
emilmont | 77:869cf507173a | 144 | #endif |
emilmont | 77:869cf507173a | 145 | |
emilmont | 77:869cf507173a | 146 | #endif /* ___STM32F4xx_HAL_DEF */ |
emilmont | 77:869cf507173a | 147 | |
emilmont | 77:869cf507173a | 148 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |