irq.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2013 Freie Universität Berlin
3  * SPDX-FileCopyrightText: 2019 Freie Universität Berlin
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #ifndef IRQ_H
8 #define IRQ_H
9 
23 #include <stdbool.h>
24 #include "cpu_conf.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #ifdef IRQ_API_INLINED
31 # define MAYBE_INLINE static inline __attribute__((always_inline))
32 #else
33 # define MAYBE_INLINE
34 #endif /* IRQ_API_INLINED */
35 
36 #ifndef IRQ_API_INLINED
46 MAYBE_INLINE unsigned irq_disable(void);
47 
62 MAYBE_INLINE unsigned irq_enable(void);
63 
72 MAYBE_INLINE void irq_restore(unsigned state);
73 
83 MAYBE_INLINE bool irq_is_enabled(void);
84 
89 MAYBE_INLINE bool irq_is_in(void);
90 
91 #else
92 # include "irq_arch.h" /* IWYU pragma: export */
93 #endif /* IRQ_API_INLINED */
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
100 #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.