Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed by
TARGET_EFM32LG_STK3600/TARGET_Silicon_Labs/TARGET_EFM32/emlib/inc/em_int.h@135:fce8a9387ed1, 2017-01-17 (annotated)
- Committer:
- kaoshen
- Date:
- Tue Jan 17 23:27:32 2017 +0000
- Revision:
- 135:fce8a9387ed1
- Parent:
- 128:9bcdf88f62b0
333 ADS1115 ADC1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 98:8ab26030e058 | 1 | /***************************************************************************//** |
Kojto | 98:8ab26030e058 | 2 | * @file em_int.h |
Kojto | 98:8ab26030e058 | 3 | * @brief Interrupt enable/disable unit API |
<> | 128:9bcdf88f62b0 | 4 | * @version 5.0.0 |
Kojto | 98:8ab26030e058 | 5 | ******************************************************************************* |
Kojto | 98:8ab26030e058 | 6 | * @section License |
<> | 128:9bcdf88f62b0 | 7 | * <b>Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com</b> |
Kojto | 98:8ab26030e058 | 8 | ******************************************************************************* |
Kojto | 98:8ab26030e058 | 9 | * |
Kojto | 98:8ab26030e058 | 10 | * Permission is granted to anyone to use this software for any purpose, |
Kojto | 98:8ab26030e058 | 11 | * including commercial applications, and to alter it and redistribute it |
Kojto | 98:8ab26030e058 | 12 | * freely, subject to the following restrictions: |
Kojto | 98:8ab26030e058 | 13 | * |
Kojto | 98:8ab26030e058 | 14 | * 1. The origin of this software must not be misrepresented; you must not |
Kojto | 98:8ab26030e058 | 15 | * claim that you wrote the original software. |
Kojto | 98:8ab26030e058 | 16 | * 2. Altered source versions must be plainly marked as such, and must not be |
Kojto | 98:8ab26030e058 | 17 | * misrepresented as being the original software. |
Kojto | 98:8ab26030e058 | 18 | * 3. This notice may not be removed or altered from any source distribution. |
Kojto | 98:8ab26030e058 | 19 | * |
Kojto | 98:8ab26030e058 | 20 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
Kojto | 98:8ab26030e058 | 21 | * obligation to support this Software. Silicon Labs is providing the |
Kojto | 98:8ab26030e058 | 22 | * Software "AS IS", with no express or implied warranties of any kind, |
Kojto | 98:8ab26030e058 | 23 | * including, but not limited to, any implied warranties of merchantability |
Kojto | 98:8ab26030e058 | 24 | * or fitness for any particular purpose or warranties against infringement |
Kojto | 98:8ab26030e058 | 25 | * of any proprietary rights of a third party. |
Kojto | 98:8ab26030e058 | 26 | * |
Kojto | 98:8ab26030e058 | 27 | * Silicon Labs will not be liable for any consequential, incidental, or |
Kojto | 98:8ab26030e058 | 28 | * special damages, or any other relief, or for any claim by any third party, |
Kojto | 98:8ab26030e058 | 29 | * arising from your use of this Software. |
Kojto | 98:8ab26030e058 | 30 | * |
Kojto | 98:8ab26030e058 | 31 | ******************************************************************************/ |
Kojto | 98:8ab26030e058 | 32 | |
<> | 128:9bcdf88f62b0 | 33 | #ifndef EM_INT_H |
<> | 128:9bcdf88f62b0 | 34 | #define EM_INT_H |
Kojto | 98:8ab26030e058 | 35 | |
Kojto | 98:8ab26030e058 | 36 | #include "em_device.h" |
Kojto | 98:8ab26030e058 | 37 | |
Kojto | 98:8ab26030e058 | 38 | extern uint32_t INT_LockCnt; |
Kojto | 98:8ab26030e058 | 39 | |
Kojto | 98:8ab26030e058 | 40 | #ifdef __cplusplus |
Kojto | 98:8ab26030e058 | 41 | extern "C" { |
Kojto | 98:8ab26030e058 | 42 | #endif |
Kojto | 98:8ab26030e058 | 43 | |
Kojto | 98:8ab26030e058 | 44 | /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */ |
Kojto | 98:8ab26030e058 | 45 | #ifndef UINT32_MAX |
Kojto | 98:8ab26030e058 | 46 | #define UINT32_MAX ((uint32_t)(0xFFFFFFFF)) |
Kojto | 98:8ab26030e058 | 47 | #endif |
<> | 128:9bcdf88f62b0 | 48 | |
<> | 128:9bcdf88f62b0 | 49 | #warning "The INT module is deprecated and marked for removal in a later release. Please use the new CORE module instead. See \"Porting from em_int\" in the CORE documentation for instructions." |
<> | 128:9bcdf88f62b0 | 50 | |
Kojto | 98:8ab26030e058 | 51 | /** @endcond */ |
Kojto | 98:8ab26030e058 | 52 | |
Kojto | 98:8ab26030e058 | 53 | /***************************************************************************//** |
<> | 128:9bcdf88f62b0 | 54 | * @addtogroup emlib |
Kojto | 98:8ab26030e058 | 55 | * @{ |
Kojto | 98:8ab26030e058 | 56 | ******************************************************************************/ |
Kojto | 98:8ab26030e058 | 57 | |
Kojto | 98:8ab26030e058 | 58 | /***************************************************************************//** |
Kojto | 98:8ab26030e058 | 59 | * @addtogroup INT |
Kojto | 98:8ab26030e058 | 60 | * @{ |
Kojto | 98:8ab26030e058 | 61 | ******************************************************************************/ |
Kojto | 98:8ab26030e058 | 62 | |
Kojto | 98:8ab26030e058 | 63 | /***************************************************************************//** |
Kojto | 98:8ab26030e058 | 64 | * @brief |
Kojto | 98:8ab26030e058 | 65 | * Disable interrupts. |
Kojto | 98:8ab26030e058 | 66 | * |
<> | 128:9bcdf88f62b0 | 67 | * @deprecated |
<> | 128:9bcdf88f62b0 | 68 | * This function is deprecated and marked for removal in a later release. |
<> | 128:9bcdf88f62b0 | 69 | * Please use the new CORE module instead. |
<> | 128:9bcdf88f62b0 | 70 | * |
Kojto | 98:8ab26030e058 | 71 | * @details |
Kojto | 98:8ab26030e058 | 72 | * Disable interrupts and increment lock level counter. |
Kojto | 98:8ab26030e058 | 73 | * |
Kojto | 98:8ab26030e058 | 74 | * @return |
Kojto | 113:f141b2784e32 | 75 | * The resulting interrupt disable nesting level. |
Kojto | 98:8ab26030e058 | 76 | * |
Kojto | 98:8ab26030e058 | 77 | ******************************************************************************/ |
Kojto | 98:8ab26030e058 | 78 | __STATIC_INLINE uint32_t INT_Disable(void) |
Kojto | 98:8ab26030e058 | 79 | { |
Kojto | 98:8ab26030e058 | 80 | __disable_irq(); |
Kojto | 98:8ab26030e058 | 81 | if (INT_LockCnt < UINT32_MAX) |
Kojto | 98:8ab26030e058 | 82 | { |
Kojto | 98:8ab26030e058 | 83 | INT_LockCnt++; |
Kojto | 98:8ab26030e058 | 84 | } |
Kojto | 98:8ab26030e058 | 85 | |
Kojto | 98:8ab26030e058 | 86 | return INT_LockCnt; |
Kojto | 98:8ab26030e058 | 87 | } |
Kojto | 98:8ab26030e058 | 88 | |
Kojto | 98:8ab26030e058 | 89 | /***************************************************************************//** |
Kojto | 98:8ab26030e058 | 90 | * @brief |
Kojto | 98:8ab26030e058 | 91 | * Enable interrupts. |
Kojto | 98:8ab26030e058 | 92 | * |
<> | 128:9bcdf88f62b0 | 93 | * @deprecated |
<> | 128:9bcdf88f62b0 | 94 | * This function is deprecated and marked for removal in a later release. |
<> | 128:9bcdf88f62b0 | 95 | * Please use the new CORE module instead. |
<> | 128:9bcdf88f62b0 | 96 | * |
Kojto | 98:8ab26030e058 | 97 | * @return |
Kojto | 113:f141b2784e32 | 98 | * The resulting interrupt disable nesting level. |
Kojto | 98:8ab26030e058 | 99 | * |
Kojto | 98:8ab26030e058 | 100 | * @details |
Kojto | 98:8ab26030e058 | 101 | * Decrement interrupt lock level counter and enable interrupts if counter |
Kojto | 98:8ab26030e058 | 102 | * reached zero. |
Kojto | 98:8ab26030e058 | 103 | * |
Kojto | 98:8ab26030e058 | 104 | ******************************************************************************/ |
Kojto | 98:8ab26030e058 | 105 | __STATIC_INLINE uint32_t INT_Enable(void) |
Kojto | 98:8ab26030e058 | 106 | { |
Kojto | 98:8ab26030e058 | 107 | uint32_t retVal; |
Kojto | 98:8ab26030e058 | 108 | |
Kojto | 98:8ab26030e058 | 109 | if (INT_LockCnt > 0) |
Kojto | 98:8ab26030e058 | 110 | { |
Kojto | 98:8ab26030e058 | 111 | INT_LockCnt--; |
Kojto | 98:8ab26030e058 | 112 | retVal = INT_LockCnt; |
Kojto | 98:8ab26030e058 | 113 | if (retVal == 0) |
Kojto | 98:8ab26030e058 | 114 | { |
Kojto | 98:8ab26030e058 | 115 | __enable_irq(); |
Kojto | 98:8ab26030e058 | 116 | } |
Kojto | 98:8ab26030e058 | 117 | return retVal; |
Kojto | 98:8ab26030e058 | 118 | } |
Kojto | 98:8ab26030e058 | 119 | else |
Kojto | 98:8ab26030e058 | 120 | { |
Kojto | 98:8ab26030e058 | 121 | return 0; |
Kojto | 98:8ab26030e058 | 122 | } |
Kojto | 98:8ab26030e058 | 123 | } |
Kojto | 98:8ab26030e058 | 124 | |
Kojto | 98:8ab26030e058 | 125 | /** @} (end addtogroup INT) */ |
<> | 128:9bcdf88f62b0 | 126 | /** @} (end addtogroup emlib) */ |
Kojto | 98:8ab26030e058 | 127 | |
Kojto | 98:8ab26030e058 | 128 | #ifdef __cplusplus |
Kojto | 98:8ab26030e058 | 129 | } |
Kojto | 98:8ab26030e058 | 130 | #endif |
Kojto | 98:8ab26030e058 | 131 | |
<> | 128:9bcdf88f62b0 | 132 | #endif /* EM_INT_H */ |