Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

211 lines
7.4 KiB

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