2013-11-27 16:28:31 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Freie Universität Berlin
|
2010-09-22 15:10:42 +02:00
|
|
|
*
|
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.
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-11-27 16:28:31 +01:00
|
|
|
* @defgroup core_irq IRQ Handling
|
|
|
|
* @ingroup core
|
|
|
|
* @brief Provides an API to control interrupt processing
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file irq.h
|
2010-09-22 15:10:42 +02:00
|
|
|
* @brief IRQ driver interface
|
|
|
|
*
|
2013-02-27 20:22:19 +01:00
|
|
|
* @author Freie Universität Berlin, Computer Systems & Telematics
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
|
2013-11-27 16:28:31 +01:00
|
|
|
#ifndef IRQ_H_
|
|
|
|
#define IRQ_H_
|
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
#include <stdbool.h>
|
2014-03-17 17:59:06 +01:00
|
|
|
#include "arch/irq_arch.h"
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This function sets the IRQ disable bit in the status register
|
2013-02-27 20:22:19 +01:00
|
|
|
*
|
|
|
|
* @note This function should be used in favour of dINT().
|
|
|
|
*
|
2014-04-06 17:26:51 +02:00
|
|
|
* @return Previous value of status register. The return value should not
|
|
|
|
* interpreted as a boolean value. The actual value is only
|
|
|
|
* significant for restoreIRQ().
|
|
|
|
*
|
|
|
|
* @see restoreIRQ
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
unsigned disableIRQ(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This function clears the IRQ disable bit in the status register
|
2014-04-06 17:26:51 +02:00
|
|
|
*
|
|
|
|
* @note This function should be used in favour of eINT().
|
|
|
|
*
|
|
|
|
* @return Previous value of status register. The return value should not
|
|
|
|
* interpreted as a boolean value. The actual value is only
|
|
|
|
* significant for restoreIRQ().
|
2010-09-22 15:10:42 +02:00
|
|
|
*
|
|
|
|
* @see restoreIRQ
|
|
|
|
*/
|
|
|
|
unsigned enableIRQ(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This function restores the IRQ disable bit in the status register
|
|
|
|
* to the value contained within passed state
|
2014-04-06 17:26:51 +02:00
|
|
|
*
|
|
|
|
* @param[in] state state to restore
|
2010-09-22 15:10:42 +02:00
|
|
|
*
|
2013-02-27 20:22:19 +01:00
|
|
|
* @note This function should be used in favour of eINT().
|
|
|
|
*
|
2014-04-06 17:26:51 +02:00
|
|
|
* @see enableIRQ
|
2010-09-22 15:10:42 +02:00
|
|
|
* @see disableIRQ
|
|
|
|
*/
|
|
|
|
void restoreIRQ(unsigned state);
|
|
|
|
|
|
|
|
/**
|
2014-02-15 18:49:27 +01:00
|
|
|
* @brief Check whether called from interrupt service routine
|
|
|
|
* @return true, if in interrupt service routine, false if not
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
int inISR(void);
|
|
|
|
|
|
|
|
#endif /* IRQ_H_ */
|
2014-04-06 17:26:51 +02:00
|
|
|
/** @} */
|