em_int.h
Go to the documentation of this file.00001
00034 #ifndef __SILICON_LABS_EM_INT_H_
00035 #define __SILICON_LABS_EM_INT_H_
00036
00037 #include "em_device.h"
00038
00039 extern uint32_t INT_LockCnt;
00040
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044
00046 #ifndef UINT32_MAX
00047 #define UINT32_MAX ((uint32_t)(0xFFFFFFFF))
00048 #endif
00049
00051
00056
00061
00072 __STATIC_INLINE uint32_t INT_Disable(void)
00073 {
00074 __disable_irq();
00075 if (INT_LockCnt < UINT32_MAX)
00076 {
00077 INT_LockCnt++;
00078 }
00079
00080 return INT_LockCnt;
00081 }
00082
00083
00095 __STATIC_INLINE uint32_t INT_Enable(void)
00096 {
00097 uint32_t retVal;
00098
00099 if (INT_LockCnt > 0)
00100 {
00101 INT_LockCnt--;
00102 retVal = INT_LockCnt;
00103 if (retVal == 0)
00104 {
00105 __enable_irq();
00106 }
00107 return retVal;
00108 }
00109 else
00110 {
00111 return 0;
00112 }
00113 }
00114
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121
00122 #endif