1 /***************************************************************************//**
\r
3 * @brief Interrupt enable/disable unit API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
33 #ifndef __SILICON_LABS_EM_INT_H__
\r
34 #define __SILICON_LABS_EM_INT_H__
\r
36 #include "em_device.h"
\r
38 extern uint32_t INT_LockCnt;
\r
44 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
\r
46 #define UINT32_MAX ((uint32_t)(0xFFFFFFFF))
\r
50 /***************************************************************************//**
\r
51 * @addtogroup EM_Library
\r
53 ******************************************************************************/
\r
55 /***************************************************************************//**
\r
58 ******************************************************************************/
\r
60 /***************************************************************************//**
\r
62 * Disable interrupts.
\r
65 * Disable interrupts and increment lock level counter.
\r
68 * The resulting interrupt disable nesting level.
\r
70 ******************************************************************************/
\r
71 __STATIC_INLINE uint32_t INT_Disable(void)
\r
74 if (INT_LockCnt < UINT32_MAX)
\r
82 /***************************************************************************//**
\r
84 * Enable interrupts.
\r
87 * The resulting interrupt disable nesting level.
\r
90 * Decrement interrupt lock level counter and enable interrupts if counter
\r
93 ******************************************************************************/
\r
94 __STATIC_INLINE uint32_t INT_Enable(void)
\r
98 if (INT_LockCnt > 0)
\r
101 retVal = INT_LockCnt;
\r
114 /** @} (end addtogroup INT) */
\r
115 /** @} (end addtogroup EM_Library) */
\r
121 #endif /* __SILICON_LABS_EM_INT_H__ */
\r