EFM32 Giant Gecko Software Documentation  efm32gg-doc-4.2.1
em_int.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __SILICON_LABS_EM_INT_H__
34 #define __SILICON_LABS_EM_INT_H__
35 
36 #include "em_device.h"
37 
38 extern uint32_t INT_LockCnt;
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
45 #ifndef UINT32_MAX
46 #define UINT32_MAX ((uint32_t)(0xFFFFFFFF))
47 #endif
48 
50 /***************************************************************************/
55 /***************************************************************************/
60 /***************************************************************************/
71 __STATIC_INLINE uint32_t INT_Disable(void)
72 {
73  __disable_irq();
74  if (INT_LockCnt < UINT32_MAX)
75  {
76  INT_LockCnt++;
77  }
78 
79  return INT_LockCnt;
80 }
81 
82 /***************************************************************************/
94 __STATIC_INLINE uint32_t INT_Enable(void)
95 {
96  uint32_t retVal;
97 
98  if (INT_LockCnt > 0)
99  {
100  INT_LockCnt--;
101  retVal = INT_LockCnt;
102  if (retVal == 0)
103  {
104  __enable_irq();
105  }
106  return retVal;
107  }
108  else
109  {
110  return 0;
111  }
112 }
113 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif /* __SILICON_LABS_EM_INT_H__ */
__STATIC_INLINE uint32_t INT_Enable(void)
Enable interrupts.
Definition: em_int.h:94
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
uint32_t INT_LockCnt
Definition: em_int.c:70
__STATIC_INLINE uint32_t INT_Disable(void)
Disable interrupts.
Definition: em_int.h:71