]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/SiLabs_Source/emlib/em_int.c
Replace Gecko Simplicity Studio project that had multiple build configurations with...
[freertos] / FreeRTOS / Demo / CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio / SiLabs_Source / emlib / em_int.c
1 /**************************************************************************//**\r
2  * @file em_int.c\r
3  * @brief Interrupt enable/disable unit API\r
4  * @version 4.2.1\r
5  ******************************************************************************\r
6  * @section License\r
7  * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>\r
8  *******************************************************************************\r
9  *\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
13  *\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
19  *\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
26  *\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
30  *\r
31  ******************************************************************************/\r
32 \r
33 #include <stdint.h>\r
34 #include "em_int.h"\r
35 \r
36 /***************************************************************************//**\r
37  * @addtogroup EM_Library\r
38  * @{\r
39  ******************************************************************************/\r
40 \r
41 /***************************************************************************//**\r
42  * @addtogroup INT\r
43  * @brief Safe nesting of interrupt disable/enable API\r
44  * @{\r
45  * @details\r
46  *  This module contains functions to safely disable and enable interrupts\r
47  *  at CPU level. INT_Disable() disables interrupts globally and increments a lock\r
48  *  level counter (counting semaphore). INT_Enable() decrements the lock level \r
49  *  counter and enable interrupts if the counter reaches zero.\r
50  *\r
51  *  These functions would normally be used to secure critical regions, and \r
52  *  to make sure that a critical section that calls into another critical \r
53  *  section does not unintentionally terminate the callee critical section.\r
54  *\r
55  *  These functions should also be used inside interrupt handlers:\r
56  *  @verbatim\r
57  *  void SysTick_Handler(void)\r
58  *  {\r
59  *    INT_Disable();\r
60  *      .\r
61  *      .\r
62  *      .\r
63  *    INT_Enable();\r
64  *  }\r
65  * @endverbatim\r
66  ******************************************************************************/\r
67 \r
68 /** Interrupt lock level counter. Set to zero initially as we normally enter\r
69  * main with interrupts enabled  */\r
70 uint32_t INT_LockCnt = 0;\r
71 \r
72 /** @} (end addtogroup INT) */\r
73 /** @} (end addtogroup EM_Library) */\r