gr55xx_hal_def.h
Go to the documentation of this file.
1 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_DEF__
53 #define __GR55xx_HAL_DEF__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx.h"
61 #include <stdio.h>
62 
63 /* Exported types ------------------------------------------------------------*/
69 typedef enum
70 {
71  HAL_OK = 0x00U,
72  HAL_ERROR = 0x01U,
73  HAL_BUSY = 0x02U,
74  HAL_TIMEOUT = 0x03
76 
80 typedef enum
81 {
82  HAL_UNLOCKED = 0x00U,
83  HAL_LOCKED = 0x01
92 /* Exported macro ------------------------------------------------------------*/
96 #define HAL_MAX_DELAY (0xFFFFFFFFU)
97 
104 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
105 
111 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
112 
120 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
121  do{ \
122  (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
123  (__DMA_HANDLE_).p_parent = (__HANDLE__); \
124  } while(0U)
125 
141 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = 0U)
142 
143 #if (USE_RTOS == 1U)
144 #error " USE_RTOS should be 0 in the current HAL release "
145 #else
146 
151 #define __HAL_LOCK(__HANDLE__) \
152  do{ \
153  if((__HANDLE__)->lock == HAL_LOCKED) \
154  { \
155  return HAL_BUSY; \
156  } \
157  else \
158  { \
159  (__HANDLE__)->lock = HAL_LOCKED; \
160  } \
161  }while (0U)
162 
168 #define __HAL_UNLOCK(__HANDLE__) \
169  do{ \
170  (__HANDLE__)->lock = HAL_UNLOCKED; \
171  }while (0U)
172 #endif /* USE_RTOS */
173 
174 
175 #if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
176 #ifndef __weak
177 #define __weak __attribute__((weak))
178 #endif /* __weak */
179 #ifndef __packed
180 #define __packed __attribute__((__packed__))
181 #endif /* __packed */
182 #endif /* __GNUC__ */
183 
184 
185 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
186 #if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
187 #ifndef __ALIGN_END
188 #define __ALIGN_END __attribute__((aligned(4)))
189 #endif /* __ALIGN_END */
190 #ifndef __ALIGN_BEGIN
191 #define __ALIGN_BEGIN
192 #endif /* __ALIGN_BEGIN */
193 #else
194 #ifndef __ALIGN_END
195 #define __ALIGN_END
196 #endif /* __ALIGN_END */
197 #ifndef __ALIGN_BEGIN
198 #if defined(__CC_ARM) /* ARM Compiler */
199 #define __ALIGN_BEGIN __align(4)
200 #elif defined(__ICCARM__) /* IAR Compiler */
201 #define __ALIGN_BEGIN
202 #endif /* __CC_ARM */
203 #endif /* __ALIGN_BEGIN */
204 #endif /* __GNUC__ */
205 
209 #if defined(__CC_ARM) || defined(__GNUC__)
210 /* ARM & GNUCompiler
211  ----------------
212 */
213 #define __NOINLINE __attribute__((noinline))
214 
215 #elif defined(__ICCARM__)
216 /* ICCARM Compiler
217  ---------------
218 */
219 #define __NOINLINE _Pragma("optimize = no_inline")
220 
221 #endif
222 
225 #ifdef __cplusplus
226 }
227 #endif
228 
229 #endif /* ___GR55xx_HAL_DEF__ */
230 
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
HAL_OK
@ HAL_OK
Definition: gr55xx_hal_def.h:71
HAL_ERROR
@ HAL_ERROR
Definition: gr55xx_hal_def.h:72
HAL_BUSY
@ HAL_BUSY
Definition: gr55xx_hal_def.h:73
HAL_UNLOCKED
@ HAL_UNLOCKED
Definition: gr55xx_hal_def.h:82
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
HAL_TIMEOUT
@ HAL_TIMEOUT
Definition: gr55xx_hal_def.h:74
HAL_LOCKED
@ HAL_LOCKED
Definition: gr55xx_hal_def.h:83