tdse-tp0_02-hw_sw_test

FIUBA - Electrónica - Taller de Sistemas Embebidos - Trabajo Práctico N°: 0 - Proyecto N°: 02
Index Commits Files Refs
Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h (7352B)
   1 /**
   2  ******************************************************************************
   3  * @file    stm32f1xx_hal_def.h
   4  * @author  MCD Application Team
   5  * @brief   This file contains HAL common defines, enumeration, macros and
   6  *          structures definitions.
   7  ******************************************************************************
   8  * @attention
   9  *
  10  * Copyright (c) 2017 STMicroelectronics.
  11  * All rights reserved.
  12  *
  13  * This software is licensed under terms that can be found in the LICENSE file
  14  * in the root directory of this software component.
  15  * If no LICENSE file comes with this software, it is provided AS-IS.
  16  *
  17  ******************************************************************************
  18  */
  19 
  20 /* Define to prevent recursive inclusion -------------------------------------*/
  21 #ifndef __STM32F1xx_HAL_DEF
  22 #define __STM32F1xx_HAL_DEF
  23 
  24 #ifdef __cplusplus
  25 extern "C" {
  26 #endif
  27 
  28 /* Includes ------------------------------------------------------------------*/
  29 #include "stm32f1xx.h"
  30 #include "Legacy/stm32_hal_legacy.h"
  31 #include <stddef.h>
  32 
  33 /* Exported types ------------------------------------------------------------*/
  34 
  35 /**
  36  * @brief  HAL Status structures definition
  37  */
  38 typedef enum {
  39     HAL_OK = 0x00U, HAL_ERROR = 0x01U, HAL_BUSY = 0x02U, HAL_TIMEOUT = 0x03U
  40 } HAL_StatusTypeDef;
  41 
  42 /**
  43  * @brief  HAL Lock structures definition
  44  */
  45 typedef enum {
  46     HAL_UNLOCKED = 0x00U, HAL_LOCKED = 0x01U
  47 } HAL_LockTypeDef;
  48 
  49 /* Exported macro ------------------------------------------------------------*/
  50 #define HAL_MAX_DELAY      0xFFFFFFFFU
  51 
  52 #define HAL_IS_BIT_SET(REG, BIT)         (((REG) & (BIT)) != 0U)
  53 #define HAL_IS_BIT_CLR(REG, BIT)         (((REG) & (BIT)) == 0U)
  54 
  55 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__)               \
  56                         do{                                                      \
  57                               (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
  58                               (__DMA_HANDLE__).Parent = (__HANDLE__);             \
  59                           } while(0U)
  60 
  61 #if !defined(UNUSED)
  62 #define UNUSED(X) (void)X      /* To avoid gcc/g++ warnings */
  63 #endif /* UNUSED */
  64 
  65 /** @brief Reset the Handle's State field.
  66  * @param __HANDLE__ specifies the Peripheral Handle.
  67  * @note  This macro can be used for the following purpose:
  68  *          - When the Handle is declared as local variable; before passing it as parameter
  69  *            to HAL_PPP_Init() for the first time, it is mandatory to use this macro
  70  *            to set to 0 the Handle's "State" field.
  71  *            Otherwise, "State" field may have any random value and the first time the function
  72  *            HAL_PPP_Init() is called, the low level hardware initialization will be missed
  73  *            (i.e. HAL_PPP_MspInit() will not be executed).
  74  *          - When there is a need to reconfigure the low level hardware: instead of calling
  75  *            HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
  76  *            In this later function, when the Handle's "State" field is set to 0, it will execute the function
  77  *            HAL_PPP_MspInit() which will reconfigure the low level hardware.
  78  * @retval None
  79  */
  80 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
  81 
  82 #if (USE_RTOS == 1U)
  83 /* Reserved for future use */
  84 #error "USE_RTOS should be 0 in the current HAL release"
  85 #else
  86 #define __HAL_LOCK(__HANDLE__)                                           \
  87                                 do{                                        \
  88                                     if((__HANDLE__)->Lock == HAL_LOCKED)   \
  89                                     {                                      \
  90                                        return HAL_BUSY;                    \
  91                                     }                                      \
  92                                     else                                   \
  93                                     {                                      \
  94                                        (__HANDLE__)->Lock = HAL_LOCKED;    \
  95                                     }                                      \
  96                                   }while (0U)
  97 
  98 #define __HAL_UNLOCK(__HANDLE__)                                          \
  99                                   do{                                       \
 100                                       (__HANDLE__)->Lock = HAL_UNLOCKED;    \
 101                                     }while (0U)
 102 #endif /* USE_RTOS */
 103 
 104 #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
 105 #ifndef __weak
 106 #define __weak  __attribute__((weak))
 107 #endif
 108 #ifndef __packed
 109 #define __packed  __attribute__((packed))
 110 #endif
 111 #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
 112 #ifndef __weak
 113 #define __weak   __attribute__((weak))
 114 #endif /* __weak */
 115 #ifndef __packed
 116 #define __packed __attribute__((__packed__))
 117 #endif /* __packed */
 118 #endif /* __GNUC__ */
 119 
 120 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
 121 #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
 122 #ifndef __ALIGN_BEGIN
 123 #define __ALIGN_BEGIN
 124 #endif
 125 #ifndef __ALIGN_END
 126 #define __ALIGN_END      __attribute__ ((aligned (4)))
 127 #endif
 128 #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
 129 #ifndef __ALIGN_END
 130 #define __ALIGN_END    __attribute__ ((aligned (4)))
 131 #endif /* __ALIGN_END */
 132 #ifndef __ALIGN_BEGIN
 133 #define __ALIGN_BEGIN
 134 #endif /* __ALIGN_BEGIN */
 135 #else
 136 #ifndef __ALIGN_END
 137 #define __ALIGN_END
 138 #endif /* __ALIGN_END */
 139 #ifndef __ALIGN_BEGIN
 140 #if defined   (__CC_ARM)      /* ARM Compiler V5*/
 141 #define __ALIGN_BEGIN    __align(4)
 142 #elif defined (__ICCARM__)    /* IAR Compiler */
 143 #define __ALIGN_BEGIN
 144 #endif /* __CC_ARM */
 145 #endif /* __ALIGN_BEGIN */
 146 #endif /* __GNUC__ */
 147 
 148 /**
 149  * @brief  __RAM_FUNC definition
 150  */
 151 #if defined ( __CC_ARM   ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
 152 /* ARM Compiler V4/V5 and V6
 153    --------------------------
 154    RAM functions are defined using the toolchain options.
 155    Functions that are executed in RAM should reside in a separate source module.
 156    Using the 'Options for File' dialog you can simply change the 'Code / Const'
 157    area of a module to a memory space in physical RAM.
 158    Available memory areas are declared in the 'Target' tab of the 'Options for Target'
 159    dialog.
 160 */
 161 #define __RAM_FUNC
 162 
 163 #elif defined ( __ICCARM__ )
 164 /* ICCARM Compiler
 165    ---------------
 166    RAM functions are defined using a specific toolchain keyword "__ramfunc".
 167 */
 168 #define __RAM_FUNC __ramfunc
 169 
 170 #elif defined   (  __GNUC__  )
 171 /* GNU Compiler
 172  ------------
 173  RAM functions are defined using a specific toolchain attribute
 174  "__attribute__((section(".RamFunc")))".
 175  */
 176 #define __RAM_FUNC __attribute__((section(".RamFunc")))
 177 
 178 #endif
 179 
 180 /**
 181  * @brief  __NOINLINE definition
 182  */
 183 #if defined ( __CC_ARM   ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined   (  __GNUC__  )
 184 /* ARM V4/V5 and V6 & GNU Compiler
 185  -------------------------------
 186  */
 187 #define __NOINLINE __attribute__ ( (noinline) )
 188 
 189 #elif defined ( __ICCARM__ )
 190 /* ICCARM Compiler
 191    ---------------
 192 */
 193 #define __NOINLINE _Pragma("optimize = no_inline")
 194 
 195 #endif
 196 
 197 #ifdef __cplusplus
 198 }
 199 #endif
 200 
 201 #endif /* ___STM32F1xx_HAL_DEF */
 202