irq.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013,2019 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef IRQ_H
23 #define IRQ_H
24 
25 #include <stdbool.h>
26 #include "cpu_conf.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #ifdef IRQ_API_INLINED
33 #define MAYBE_INLINE static inline __attribute__((always_inline))
34 #else
35 #define MAYBE_INLINE
36 #endif /* IRQ_API_INLINED */
37 
38 #ifndef IRQ_API_INLINED
48 MAYBE_INLINE unsigned irq_disable(void);
49 
64 MAYBE_INLINE unsigned irq_enable(void);
65 
74 MAYBE_INLINE void irq_restore(unsigned state);
75 
85 MAYBE_INLINE bool irq_is_enabled(void);
86 
91 MAYBE_INLINE bool irq_is_in(void);
92 
93 #else
94 #include "irq_arch.h" /* IWYU pragma: export */
95 #endif /* IRQ_API_INLINED */
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* IRQ_H */
MAYBE_INLINE void irq_restore(unsigned state)
This function restores the IRQ disable bit in the status register to the value contained within passe...
MAYBE_INLINE unsigned irq_disable(void)
This function sets the IRQ disable bit in the status register.
MAYBE_INLINE bool irq_is_enabled(void)
Test if IRQs are currently enabled.
MAYBE_INLINE unsigned irq_enable(void)
This function clears the IRQ disable bit in the status register.
MAYBE_INLINE bool irq_is_in(void)
Check whether called from interrupt service routine.