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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
mbed_critical.h
00001 /* 00002 * Copyright (c) 2015-2019, ARM Limited, All Rights Reserved 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00006 * not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef __MBED_UTIL_CRITICAL_H__ 00019 #define __MBED_UTIL_CRITICAL_H__ 00020 00021 #include <stdbool.h> 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /** \addtogroup platform-public-api */ 00028 /** @{*/ 00029 /** 00030 * \defgroup platform_critical critical section function 00031 * @{ 00032 */ 00033 00034 /** Determine the current interrupts enabled state 00035 * 00036 * This function can be called to determine whether or not interrupts are currently enabled. 00037 * @note 00038 * NOTE: 00039 * This function works for both cortex-A and cortex-M, although the underlying implementation 00040 * differs. 00041 * @return true if interrupts are enabled, false otherwise 00042 */ 00043 bool core_util_are_interrupts_enabled(void); 00044 00045 /** Determine if this code is executing from an interrupt 00046 * 00047 * This function can be called to determine if the code is running on interrupt context. 00048 * @note 00049 * NOTE: 00050 * This function works for both cortex-A and cortex-M, although the underlying implementation 00051 * differs. 00052 * @return true if in an isr, false otherwise 00053 */ 00054 bool core_util_is_isr_active(void); 00055 00056 /** Mark the start of a critical section 00057 * 00058 * This function should be called to mark the start of a critical section of code. 00059 * @note 00060 * NOTES: 00061 * 1) The use of this style of critical section is targetted at C based implementations. 00062 * 2) These critical sections can be nested. 00063 * 3) The interrupt enable state on entry to the first critical section (of a nested set, or single 00064 * section) will be preserved on exit from the section. 00065 * 4) This implementation will currently only work on code running in privileged mode. 00066 */ 00067 void core_util_critical_section_enter(void); 00068 00069 /** Mark the end of a critical section 00070 * 00071 * This function should be called to mark the end of a critical section of code. 00072 * @note 00073 * NOTES: 00074 * 1) The use of this style of critical section is targetted at C based implementations. 00075 * 2) These critical sections can be nested. 00076 * 3) The interrupt enable state on entry to the first critical section (of a nested set, or single 00077 * section) will be preserved on exit from the section. 00078 * 4) This implementation will currently only work on code running in privileged mode. 00079 */ 00080 void core_util_critical_section_exit(void); 00081 00082 /** 00083 * Determine if we are currently in a critical section 00084 * 00085 * @return true if in a critical section, false otherwise. 00086 */ 00087 bool core_util_in_critical_section(void); 00088 00089 /**@}*/ 00090 00091 /**@}*/ 00092 00093 #ifdef __cplusplus 00094 } // extern "C" 00095 #endif 00096 00097 #endif // __MBED_UTIL_CRITICAL_H__
Generated on Tue Jul 12 2022 13:54:33 by
