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.
 
 
 
 
 
 

199 lines
6.9 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l1xx_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 __STM32L1xx_HAL_DEF
  22. #define __STM32L1xx_HAL_DEF
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "stm32l1xx.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 UNUSED(X) (void)X /* To avoid gcc/g++ warnings */
  51. #define HAL_MAX_DELAY 0xFFFFFFFFU
  52. #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT))
  53. #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U)
  54. #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
  55. do{ \
  56. (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
  57. (__DMA_HANDLE_).Parent = (__HANDLE__); \
  58. } while(0)
  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 == 1)
  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 (0)
  90. #define __HAL_UNLOCK(__HANDLE__) \
  91. do{ \
  92. (__HANDLE__)->Lock = HAL_UNLOCKED; \
  93. }while (0)
  94. #endif /* USE_RTOS */
  95. #if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
  96. #ifndef __weak
  97. #define __weak __attribute__((weak))
  98. #endif /* __weak */
  99. #ifndef __packed
  100. #define __packed __attribute__((__packed__))
  101. #endif /* __packed */
  102. #endif /* __GNUC__ */
  103. /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
  104. #if defined (__GNUC__) && !defined (__CC_ARM) /* GNU Compiler */
  105. #ifndef __ALIGN_END
  106. #define __ALIGN_END __attribute__ ((aligned (4)))
  107. #endif /* __ALIGN_END */
  108. #ifndef __ALIGN_BEGIN
  109. #define __ALIGN_BEGIN
  110. #endif /* __ALIGN_BEGIN */
  111. #else
  112. #ifndef __ALIGN_END
  113. #define __ALIGN_END
  114. #endif /* __ALIGN_END */
  115. #ifndef __ALIGN_BEGIN
  116. #if defined (__CC_ARM) /* ARM Compiler */
  117. #define __ALIGN_BEGIN __align(4)
  118. #elif defined (__ICCARM__) /* IAR Compiler */
  119. #define __ALIGN_BEGIN
  120. #endif /* __CC_ARM */
  121. #endif /* __ALIGN_BEGIN */
  122. #endif /* __GNUC__ */
  123. /**
  124. * @brief __RAM_FUNC definition
  125. */
  126. #if defined ( __CC_ARM )
  127. /* ARM Compiler
  128. ------------
  129. RAM functions are defined using the toolchain options.
  130. Functions that are executed in RAM should reside in a separate source module.
  131. Using the 'Options for File' dialog you can simply change the 'Code / Const'
  132. area of a module to a memory space in physical RAM.
  133. Available memory areas are declared in the 'Target' tab of the 'Options for Target'
  134. dialog.
  135. */
  136. #define __RAM_FUNC
  137. #elif defined ( __ICCARM__ )
  138. /* ICCARM Compiler
  139. ---------------
  140. RAM functions are defined using a specific toolchain keyword "__ramfunc".
  141. */
  142. #define __RAM_FUNC __ramfunc
  143. #elif defined ( __GNUC__ )
  144. /* GNU Compiler
  145. ------------
  146. RAM functions are defined using a specific toolchain attribute
  147. "__attribute__((section(".RamFunc")))".
  148. */
  149. #define __RAM_FUNC __attribute__((section(".RamFunc")))
  150. #endif
  151. /**
  152. * @brief __NOINLINE definition
  153. */
  154. #if defined ( __CC_ARM ) || defined ( __GNUC__ )
  155. /* ARM & GNUCompiler
  156. ----------------
  157. */
  158. #define __NOINLINE __attribute__ ( (noinline) )
  159. #elif defined ( __ICCARM__ )
  160. /* ICCARM Compiler
  161. ---------------
  162. */
  163. #define __NOINLINE _Pragma("optimize = no_inline")
  164. #endif
  165. #ifdef __cplusplus
  166. }
  167. #endif
  168. #endif /* ___STM32L1xx_HAL_DEF */
  169. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/