Macros
HAL Exported Constants
Peripheral Driver » HAL Driver » HAL » Defines

## Macros
#define | CO_MAX(a, b) ((a) > (b) ? (a) : (b))
| compare if a > b More...
#define | BLE_INT_DISABLE()
| Disable BLE_IRQn and BLESLP_IRQn. More...
#define | BLE_INT_RESTORE()
| Restore BLE_IRQn and BLESLP_IRQn. More...
#define | GLOBAL_INT_DISABLE()
| Disable interrupts globally in the system. This macro must be used in conjunction with the GLOBAL_INT_RESTORE macro since this last one will close the brace that the current macro opens. This means that both macros must be located at the same scope level. More...
#define | GLOBAL_INT_RESTORE()
| Restore external interrupts(Exception Type: 16~255) from the previous disable. More...
#define | LOCAL_INT_DISABLE(IRQn_Type)
| Disable external interrupts with a priority lower than IRQn_Type in the system. This macro must be used in conjunction with the LOCAL_INT_RESTORE macro since this last one will close the brace that the current macro opens. This means that both macros must be located at the same scope level. More...
#define | LOCAL_INT_RESTORE()
| Restore external interrupts(apart from the BLE) from the previous disable. More...
#define | CHECK_IS_ON_FPGA() (AON->FPGA_CTRL & AON_REG_FPGA_CTRL_EXIST)
| Check if the program is running on the FPGA platform.
#define | SYSTICK_RELOAD_VALUE (SysTick->LOAD)
#define | SYSTICK_CURRENT_VALUE (SysTick->VAL)

## Detailed Description

## Macro Definition Documentation

## ◆ BLE_INT_DISABLE

#define BLE_INT_DISABLE | ( |  | ) |

Value:
do { \
volatile uint32_t __ble_l_irq_rest = __get_PRIMASK(); \
volatile bool __ble_int_status = NVIC_GetEnableIRQ(BLE_IRQn) || NVIC_GetEnableIRQ(BLESLP_IRQn); \
__set_PRIMASK(1); \
if (__ble_int_status) \
{ \
NVIC_DisableIRQ(BLE_IRQn); \
NVIC_DisableIRQ(BLESLP_IRQn); \
} \
__set_PRIMASK(__ble_l_irq_rest);

Disable BLE_IRQn and BLESLP_IRQn.

See also
  BLE_INT_DISABLE

## ◆ BLE_INT_RESTORE

#define BLE_INT_RESTORE | ( |  | ) |

Value:
__ble_l_irq_rest = __get_PRIMASK(); \
__set_PRIMASK(1); \
if (__ble_int_status) \
{ \
NVIC_EnableIRQ(BLE_IRQn); \
NVIC_EnableIRQ(BLESLP_IRQn); \
} \
__set_PRIMASK(__ble_l_irq_rest); \
} while(0)

Restore BLE_IRQn and BLESLP_IRQn.

See also
  BLE_INT_RESTORE

## ◆ CO_MAX

#define CO_MAX | ( |  | a,
|  |  | b
| ) |  | ((a) > (b) ? (a) : (b))

compare if a > b

See also
  CO_MAX

## ◆ GLOBAL_INT_DISABLE

#define GLOBAL_INT_DISABLE | ( |  | ) |

Value:
do { \
volatile uint32_t __nvic_iser0 = 0xFFFFFFFF; \
volatile uint32_t __nvic_iser1 = 0xFFFFFFFF; \
volatile uint32_t __ret_pri = __get_PRIMASK(); \
__set_PRIMASK(1); \
if( (NVIC->ICER[0] != 0xFFFFFFFF) || (NVIC->ICER[1] != 0xFFFFFFFF) ) \
{ \
__nvic_iser0 = NVIC->ISER[0]; \
__nvic_iser1 = NVIC->ISER[1]; \
NVIC->ICER[0] = 0xFFFFFFFF; \
NVIC->ICER[1] = 0xFFFFFFFF; \
} \
__set_PRIMASK(__ret_pri); \
__DSB(); \
__ISB(); \

Disable interrupts globally in the system. This macro must be used in conjunction with the GLOBAL_INT_RESTORE macro since this last one will close the brace that the current macro opens. This means that both macros must be located at the same scope level.

## ◆ GLOBAL_INT_RESTORE

#define GLOBAL_INT_RESTORE | ( |  | ) |

Value:
__ret_pri = __get_PRIMASK(); \
__set_PRIMASK(1); \
if( (__nvic_iser0 != 0xFFFFFFFF) || (__nvic_iser1 != 0xFFFFFFFF) ) \
{ \
NVIC->ISER[0] = __nvic_iser0; \
NVIC->ISER[1] = __nvic_iser1; \
} \
__set_PRIMASK(__ret_pri); \
} while(0)

Restore external interrupts(Exception Type: 16~255) from the previous disable.

See also
  GLOBAL_INT_RESTORE

## ◆ LOCAL_INT_DISABLE

#define LOCAL_INT_DISABLE | ( |  | IRQn_Type | ) |

Value:
do { \
uint32_t __l_irq_rest = __get_BASEPRI(); \
__set_BASEPRI(NVIC_GetPriority(IRQn_Type) + \
(1 << (NVIC_GetPriorityGrouping() + 1))); \

Disable external interrupts with a priority lower than IRQn_Type in the system. This macro must be used in conjunction with the LOCAL_INT_RESTORE macro since this last one will close the brace that the current macro opens. This means that both macros must be located at the same scope level.

## ◆ LOCAL_INT_RESTORE

#define LOCAL_INT_RESTORE | ( |  | ) |

Value:
__set_BASEPRI(__l_irq_rest); \
} while(0)

Restore external interrupts(apart from the BLE) from the previous disable.

See also
  EXP_BLE_INT_RESTORE

## ◆ SYSTICK_CURRENT_VALUE

#define SYSTICK_CURRENT_VALUE (SysTick->VAL)

SysTick Current value.

## ◆ SYSTICK_RELOAD_VALUE

#define SYSTICK_RELOAD_VALUE (SysTick->LOAD)

SysTick Reload value.