aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ubicom32/files/arch/ubicom32/include/asm/irqflags.h
blob: f40906e5a79887bd34431a2153e444e3e6e37515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * arch/ubicom32/include/asm/irqflags.h
 *   Raw implementation of local IRQ functions.
 *
 * (C) Copyright 2009, Ubicom, Inc.
 *
 * This file is part of the Ubicom32 Linux Kernel Port.
 *
 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, either version 2 of the
 * License, or (at your option) any later version.
 *
 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 * the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the Ubicom32 Linux Kernel Port.  If not,
 * see <http://www.gnu.org/licenses/>.
 *
 * Ubicom32 implementation derived from (with many thanks):
 *   arch/m68knommu
 *   arch/blackfin
 *   arch/parisc
 */
#ifndef _ASM_UBICOM32_IRQFLAGS_H
#define _ASM_UBICOM32_IRQFLAGS_H

#include <linux/thread_info.h>
#include <asm/ubicom32-common.h>
#if defined(CONFIG_SMP)
#include <asm/smp.h>
#endif
#include <asm/ldsr.h>

#if defined(CONFIG_PREEMPT)
#error Not supported by Ubicom32 irq handling, yet!
#endif

/*
 * raw_local_irq_enable()
 *	Enable interrupts for this thread.
 */
static inline void raw_local_irq_enable(void)
{
	ldsr_local_irq_enable();
}

/*
 * raw_local_irq_disable()
 *	Disable interrupts for this thread.
 */
static inline void raw_local_irq_disable(void)
{
	ldsr_local_irq_disable();
}

/*
 * raw_local_save_flags()
 *	Get the current IRQ state.
 */
#define raw_local_save_flags(flags) 		\
do {						\
	(flags) = ldsr_local_irq_is_disabled();	\
} while (0)

/*
 * raw_local_irq_save()
 *	Save the current interrupt state and disable interrupts.
 */
#define raw_local_irq_save(flags)		\
do {						\
	(flags) = ldsr_local_irq_save();	\
} while (0)

/*
 * raw_local_irq_restore()
 *	Restore the IRQ state back to flags.
 */
static inline void raw_local_irq_restore(unsigned long flags)
{
	ldsr_local_irq_restore(flags);
}

/*
 * raw_irqs_disabled_flags()
 *	Return true if the flags indicate that IRQ(s) are disabled.
 */
static inline int raw_irqs_disabled_flags(unsigned long flags)
{
	return (flags);
}

#endif /* _ASM_UBICOM32_IRQFLAGS_H */