2014-03-17 17:59:06 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Freie Universität Berlin
|
|
|
|
*
|
2014-08-23 15:43:13 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2014-03-17 17:59:06 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup core_arch
|
|
|
|
* @{
|
|
|
|
*
|
2015-05-22 07:34:41 +02:00
|
|
|
* @file
|
2014-03-17 17:59:06 +01:00
|
|
|
* @brief Interrupt handling interface for globally en- and disabling interrupts
|
|
|
|
*
|
|
|
|
* This file acts as a wrapper between the kernels interrupt interface and the architecture
|
|
|
|
* dependent implementation of the interfaces.
|
|
|
|
*
|
2014-10-30 14:34:11 +01:00
|
|
|
* @note All functions in this module have to be implemented in a way that it
|
|
|
|
* is safe to call them from within the context of an ISR.
|
|
|
|
*
|
2014-03-17 17:59:06 +01:00
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
*/
|
|
|
|
|
2015-03-26 17:07:04 +01:00
|
|
|
#ifndef IRQ_ARCH_H
|
|
|
|
#define IRQ_ARCH_H
|
2014-03-17 17:59:06 +01:00
|
|
|
|
2014-10-09 01:18:16 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-03-17 17:59:06 +01:00
|
|
|
/**
|
|
|
|
* @name Define mapping between kernel internal and arch interfaces
|
2014-06-10 18:07:41 +02:00
|
|
|
*
|
|
|
|
* This mapping is done for compatibility of existing platforms,
|
2014-03-17 17:59:06 +01:00
|
|
|
* new platforms should always use the *_arch_* interfaces.
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#ifdef COREIF_NG
|
|
|
|
#define enableIRQ irq_arch_enable
|
|
|
|
#define disableIRQ irq_arch_disable
|
|
|
|
#define restoreIRQ irq_arch_restore
|
|
|
|
#define inISR irq_arch_in
|
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Globally enable maskable interrupt sources
|
2014-06-10 18:07:41 +02:00
|
|
|
*
|
2014-03-17 17:59:06 +01:00
|
|
|
* @return the IRQ state after enabling interrupts
|
|
|
|
*/
|
2014-06-10 18:07:41 +02:00
|
|
|
unsigned int irq_arch_enable(void);
|
2014-03-17 17:59:06 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Globally disable all maskable interrupt sources
|
|
|
|
*
|
|
|
|
* @return the IRQ state before disabling interrupts
|
|
|
|
*/
|
|
|
|
unsigned int irq_arch_disable(void);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Restore a previously recorded IRQ state
|
|
|
|
*
|
|
|
|
* @param[in] state the state to set the IRQ flags to
|
|
|
|
*/
|
|
|
|
void irq_arch_restore(unsigned int state);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief See if the current context is inside an ISR
|
|
|
|
*
|
|
|
|
* @return 1 if currently in interrupt context, 0 otherwise
|
|
|
|
*/
|
|
|
|
int irq_arch_in(void);
|
|
|
|
|
2014-10-09 01:18:16 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2014-03-17 17:59:06 +01:00
|
|
|
|
2015-03-26 17:07:04 +01:00
|
|
|
#endif /* IRQ_ARCH_H */
|
2014-03-17 17:59:06 +01:00
|
|
|
/** @} */
|