Macros
Defines
Peripheral Driver » HAL Driver » HAL DEFINE

## Macros
#define | HAL_NEVER_TIMEOUT (0xFFFFFFFFU)
| HAL never timeout definition. More...
#define | HAL_MAX_DELAY (40000U)
| HAL max delay definition. Unit is millisecond. 40000ms is the max delay time in 96MHz system clock. More...
#define | HAL_TIMEOUT_GET_TICK() (DWT->CYCCNT)
| Timeout module get current tick. More...
#define | HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
| Check whether the bits of register are set. More...
#define | HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
| Check whether the bits of register are clear. More...
#define | __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_)
| Link DMA handle and peripheral handle. More...
#define | __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = 0U)
| Reset the Handle's State field. More...
#define | __HAL_LOCK(__HANDLE__)
| Lock peripheral handle. More...
#define | __HAL_UNLOCK(__HANDLE__)
| Unlock peripheral handle. More...
#define | __ALIGN_END

## Detailed Description

## Macro Definition Documentation

## ◆ __ALIGN_END

#define __ALIGN_END

ALIGN END

Definition at line 201 of file hal_def.h.

## ◆ __HAL_LINKDMA

#define __HAL_LINKDMA | ( |  | __HANDLE__,
|  |  | __PPP_DMA_FIELD_,
|  |  | __DMA_HANDLE_
| ) |  |

Value:
do{ \
(__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
(__DMA_HANDLE_).p_parent = (__HANDLE__); \
} while(0U)

Link DMA handle and peripheral handle.

Parameters

  __HANDLE__ | specifies the peripheral handle.
  __PPP_DMA_FIELD_ | specifies the DMA pointer in struction of peripheral handle.
  __DMA_HANDLE_ | specifies the DMA handle.

Return values

  None |

Definition at line 126 of file hal_def.h.

## ◆ __HAL_LOCK

#define __HAL_LOCK | ( |  | __HANDLE__ | ) |

Value:
do{ \
if((__HANDLE__)->lock == HAL_LOCKED) \
{ \
return HAL_BUSY; \
} \
else \
{ \
(__HANDLE__)->lock = HAL_LOCKED; \
} \
}while (0U)

Lock peripheral handle.

Parameters

  __HANDLE__ | specifies the peripheral handle.

Return values

  HAL_BUSY | If handle is locked.

Definition at line 157 of file hal_def.h.

## ◆ __HAL_RESET_HANDLE_STATE

#define __HAL_RESET_HANDLE_STATE | ( |  | __HANDLE__ | ) | ((__HANDLE__)->state = 0U)

Reset the Handle's State field.

Parameters

  __HANDLE__ | specifies the Peripheral Handle.

Note
  This macro can be used for the following purposes:
  - When the Handle is declared as local variable; before passing it as parameter to hal_ppp_init() for the first time, it is mandatory to use this macro to set the Handle's "State" field to 0. Otherwise, "State" field may have any random value and the first time the function hal_ppp_init() is called, the low level hardware initialization will be missed (i.e. hal_ppp_msp_init() will not be executed).
  - When there is a need to reconfigure the low level hardware: instead of calling hal_ppp_deinit() then hal_ppp_init(), user can make a call to this macro then hal_ppp_init(). In this later function, when the Handle's "State" field is set to 0, it will execute the function hal_ppp_msp_init which will reconfigure the low level hardware.

Return values

  None |

Definition at line 147 of file hal_def.h.

## ◆ __HAL_UNLOCK

#define __HAL_UNLOCK | ( |  | __HANDLE__ | ) |

Value:
do{ \
(__HANDLE__)->lock = HAL_UNLOCKED; \
}while (0U)

Unlock peripheral handle.

Parameters

  __HANDLE__ | specifies the peripheral handle.

Return values

  None |

Definition at line 174 of file hal_def.h.

## ◆ HAL_IS_BIT_CLR

#define HAL_IS_BIT_CLR | ( |  | REG,
|  |  | BIT
| ) |  | (((REG) & (BIT)) == RESET)

Check whether the bits of register are clear.

Parameters

  REG | specifies the register.
  BIT | specifies the bits will be checked.

Return values

  SET | (BIT is clear) or RESET (BIT is not clear)

Definition at line 117 of file hal_def.h.

## ◆ HAL_IS_BIT_SET

#define HAL_IS_BIT_SET | ( |  | REG,
|  |  | BIT
| ) |  | (((REG) & (BIT)) != RESET)

Check whether the bits of register are set.

Parameters

  REG | specifies the register.
  BIT | specifies the bits will be checked.

Return values

  SET | (BIT is set) or RESET (BIT is not set)

Definition at line 110 of file hal_def.h.

## ◆ HAL_MAX_DELAY

#define HAL_MAX_DELAY (40000U)

HAL max delay definition. Unit is millisecond. 40000ms is the max delay time in 96MHz system clock.

Definition at line 95 of file hal_def.h.

## ◆ HAL_NEVER_TIMEOUT

#define HAL_NEVER_TIMEOUT (0xFFFFFFFFU)

HAL never timeout definition.

Definition at line 89 of file hal_def.h.

## ◆ HAL_TIMEOUT_GET_TICK

#define HAL_TIMEOUT_GET_TICK | ( |  | ) | (DWT->CYCCNT)

Timeout module get current tick.

Return values

  Current | tick

Definition at line 102 of file hal_def.h.

HAL_BUSY
@ HAL_BUSY
Definition: gr_common.h:143
HAL_UNLOCKED
@ HAL_UNLOCKED
Definition: hal_def.h:75
HAL_LOCKED
@ HAL_LOCKED
Definition: hal_def.h:76