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: cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more
interrupts.h
00001 /* 00002 * Copyright (c) 2013-2015, 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 #ifndef __UVISOR_API_INTERRUPTS_H__ 00018 #define __UVISOR_API_INTERRUPTS_H__ 00019 00020 #include "api/inc/virq_exports.h" 00021 #include "api/inc/uvisor_exports.h" 00022 #include "api/inc/api.h" 00023 #include <stdint.h> 00024 00025 UVISOR_EXTERN_C_BEGIN 00026 00027 static UVISOR_FORCEINLINE void vIRQ_SetVector(uint32_t irqn, uint32_t vector) 00028 { 00029 uvisor_api.irq_set_vector(irqn, vector); 00030 } 00031 00032 static UVISOR_FORCEINLINE uint32_t vIRQ_GetVector(uint32_t irqn) 00033 { 00034 return uvisor_api.irq_get_vector(irqn); 00035 } 00036 00037 static UVISOR_FORCEINLINE void vIRQ_EnableIRQ(uint32_t irqn) 00038 { 00039 uvisor_api.irq_enable(irqn); 00040 } 00041 00042 static UVISOR_FORCEINLINE void vIRQ_DisableIRQ(uint32_t irqn) 00043 { 00044 uvisor_api.irq_disable(irqn); 00045 } 00046 00047 static UVISOR_FORCEINLINE void vIRQ_ClearPendingIRQ(uint32_t irqn) 00048 { 00049 uvisor_api.irq_clear_pending(irqn); 00050 } 00051 00052 static UVISOR_FORCEINLINE void vIRQ_SetPendingIRQ(uint32_t irqn) 00053 { 00054 uvisor_api.irq_set_pending(irqn); 00055 } 00056 00057 static UVISOR_FORCEINLINE uint32_t vIRQ_GetPendingIRQ(uint32_t irqn) 00058 { 00059 return uvisor_api.irq_get_pending(irqn); 00060 } 00061 00062 static UVISOR_FORCEINLINE void vIRQ_SetPriority(uint32_t irqn, uint32_t priority) 00063 { 00064 uvisor_api.irq_set_priority(irqn, priority); 00065 } 00066 00067 static UVISOR_FORCEINLINE uint32_t vIRQ_GetPriority(uint32_t irqn) 00068 { 00069 return uvisor_api.irq_get_priority(irqn); 00070 } 00071 00072 static UVISOR_FORCEINLINE int vIRQ_GetLevel(void) 00073 { 00074 return uvisor_api.irq_get_level(); 00075 } 00076 00077 /** Disable all interrupts for the currently active box. 00078 * 00079 * Calling this function from a box only affects the interrupts of that box. 00080 * System interrupts and interrupts owned by other boxes are left untouched. 00081 * 00082 * Successive calls to this function increase an internal counter that is used 00083 * by uVisor to decide when to re-enable IRQs. The related call 00084 * ::vIRQ_EnableIRQ() decreases this counter. Only when the counter is 0 the 00085 * interrupts are re-enabled for that box. 00086 * 00087 * This guarantees that code that disables IRQs will not accidentally have them 00088 * re-enabled by a nested function that it calls before the expected call to 00089 * ::vIRQ_EnableAll(). Example: 00090 * 00091 * vIRQ_DisableAll(); counter = 1; IRQs are now disabled. 00092 * some_function(); counter = 2, then counter = 1; IRQs are still disabled. 00093 * vIRQ_EnableAll(); counter = 0; IRQs are now re-enabled. 00094 * 00095 * where some_function() also has a disable/enable pair. */ 00096 static UVISOR_FORCEINLINE void vIRQ_DisableAll(void) 00097 { 00098 uvisor_api.irq_disable_all(); 00099 } 00100 00101 /** Re-enable all interrupts that were previously disabled for the currently 00102 * active box. 00103 * 00104 * This function only re-enables interrupt if the uVisor internal counter is set 00105 * to 0, to make sure that nested disabling of IRQs is still effective. See 00106 * ::vIRQ_DisableAll for more information. */ 00107 static UVISOR_FORCEINLINE void vIRQ_EnableAll(void) 00108 { 00109 uvisor_api.irq_enable_all(); 00110 } 00111 00112 /** Reset the device. 00113 * @warning Currently only the debug box can reset the device. 00114 * @param reason[in] Reason for rebooting. Currently not used. 00115 */ 00116 static UVISOR_FORCEINLINE void vIRQ_SystemReset(TResetReason reason) 00117 { 00118 return uvisor_api.irq_system_reset(reason); 00119 } 00120 00121 UVISOR_EXTERN_C_END 00122 00123 #endif /* __UVISOR_API_INTERRUPTS_H__ */
Generated on Tue Jul 12 2022 13:02:56 by
