Linux Audio

Check our new training course

Loading...
v6.2
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2/*
 3 * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 4 */
 5#ifndef _ASM_IRQFLAGS_H
 6#define _ASM_IRQFLAGS_H
 7
 8#include <asm/registers.h>
 9
10static inline unsigned long arch_local_save_flags(void)
11{
12	return RDCTL(CTL_FSTATUS);
13}
14
15/*
16 * This will restore ALL status register flags, not only the interrupt
17 * mask flag.
18 */
19static inline void arch_local_irq_restore(unsigned long flags)
20{
21	WRCTL(CTL_FSTATUS, flags);
22}
23
24static inline void arch_local_irq_disable(void)
25{
26	unsigned long flags;
27
28	flags = arch_local_save_flags();
29	arch_local_irq_restore(flags & ~STATUS_PIE);
30}
31
32static inline void arch_local_irq_enable(void)
33{
34	unsigned long flags;
35
36	flags = arch_local_save_flags();
37	arch_local_irq_restore(flags | STATUS_PIE);
38}
39
40static inline int arch_irqs_disabled_flags(unsigned long flags)
41{
42	return (flags & STATUS_PIE) == 0;
43}
44
45static inline int arch_irqs_disabled(void)
46{
47	return arch_irqs_disabled_flags(arch_local_save_flags());
48}
49
50static inline unsigned long arch_local_irq_save(void)
51{
52	unsigned long flags;
53
54	flags = arch_local_save_flags();
55	arch_local_irq_restore(flags & ~STATUS_PIE);
56	return flags;
57}
58
59#endif /* _ASM_IRQFLAGS_H */
v4.6
 
 1/*
 2 * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
 3 *
 4 * This program is free software; you can redistribute it and/or modify
 5 * it under the terms of the GNU General Public License as published by
 6 * the Free Software Foundation; either version 2 of the License, or
 7 * (at your option) any later version.
 8 *
 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18#ifndef _ASM_IRQFLAGS_H
19#define _ASM_IRQFLAGS_H
20
21#include <asm/registers.h>
22
23static inline unsigned long arch_local_save_flags(void)
24{
25	return RDCTL(CTL_STATUS);
26}
27
28/*
29 * This will restore ALL status register flags, not only the interrupt
30 * mask flag.
31 */
32static inline void arch_local_irq_restore(unsigned long flags)
33{
34	WRCTL(CTL_STATUS, flags);
35}
36
37static inline void arch_local_irq_disable(void)
38{
39	unsigned long flags;
40
41	flags = arch_local_save_flags();
42	arch_local_irq_restore(flags & ~STATUS_PIE);
43}
44
45static inline void arch_local_irq_enable(void)
46{
47	unsigned long flags;
48
49	flags = arch_local_save_flags();
50	arch_local_irq_restore(flags | STATUS_PIE);
51}
52
53static inline int arch_irqs_disabled_flags(unsigned long flags)
54{
55	return (flags & STATUS_PIE) == 0;
56}
57
58static inline int arch_irqs_disabled(void)
59{
60	return arch_irqs_disabled_flags(arch_local_save_flags());
61}
62
63static inline unsigned long arch_local_irq_save(void)
64{
65	unsigned long flags;
66
67	flags = arch_local_save_flags();
68	arch_local_irq_restore(flags & ~STATUS_PIE);
69	return flags;
70}
71
72#endif /* _ASM_IRQFLAGS_H */