joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers interrupts.h Source File

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/uvisor_exports.h"
00021 #include <stdint.h>
00022 
00023 UVISOR_EXTERN void vIRQ_SetVector(uint32_t irqn, uint32_t vector);
00024 UVISOR_EXTERN uint32_t vIRQ_GetVector(uint32_t irqn);
00025 UVISOR_EXTERN void vIRQ_EnableIRQ(uint32_t irqn);
00026 UVISOR_EXTERN void vIRQ_DisableIRQ(uint32_t irqn);
00027 UVISOR_EXTERN void vIRQ_ClearPendingIRQ(uint32_t irqn);
00028 UVISOR_EXTERN void vIRQ_SetPendingIRQ(uint32_t irqn);
00029 UVISOR_EXTERN uint32_t vIRQ_GetPendingIRQ(uint32_t irqn);
00030 UVISOR_EXTERN void vIRQ_SetPriority(uint32_t irqn, uint32_t priority);
00031 UVISOR_EXTERN uint32_t vIRQ_GetPriority(uint32_t irqn);
00032 UVISOR_EXTERN int vIRQ_GetLevel(void);
00033 
00034 /** Disable all interrupts for the currently active box.
00035  *
00036  * Calling this function from a box only affects the interrupts of that box.
00037  * System interrupts and interrupts owned by other boxes are left untouched.
00038  *
00039  * Successive calls to this function increase an internal counter that is used
00040  * by uVisor to decide when to re-enable IRQs. The related call
00041  * ::vIRQ_EnableIRQ() decreases this counter. Only when the counter is 0 the
00042  * interrupts are re-enabled for that box.
00043  *
00044  * This guarantees that code that disables IRQs will not accidentally have them
00045  * re-enabled by a nested function that it calls before the expected call to
00046  * ::vIRQ_EnableAll(). Example:
00047  *
00048  * vIRQ_DisableAll();  counter = 1; IRQs are now disabled.
00049  * some_function();    counter = 2, then counter = 1; IRQs are still disabled.
00050  * vIRQ_EnableAll();   counter = 0; IRQs are now re-enabled.
00051  *
00052  * where some_function() also has a disable/enable pair. */
00053 UVISOR_EXTERN void vIRQ_DisableAll(void);
00054 
00055 /** Re-enable all interrupts that were previously disabled for the currently
00056  *  active box.
00057  *
00058  * This function only re-enables interrupt if the uVisor internal counter is set
00059  * to 0, to make sure that nested disabling of IRQs is still effective. See
00060  * ::vIRQ_DisableAll for more information. */
00061 UVISOR_EXTERN void vIRQ_EnableAll(void);
00062 
00063 #endif /* __UVISOR_API_INTERRUPTS_H__ */