2 * Copyright (C) 2011 Andes Technology Corporation
3 * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 #ifndef __ASM_NDS_SYSTEM_H
25 #define __ASM_NDS_SYSTEM_H
28 * Interrupt configuring macros.
33 #define local_irq_enable() \
34 __asm__ __volatile__ ( \
36 "andi %0, %0, 0x1\n\t" \
42 #define local_irq_disable() \
45 __asm__ __volatile__ ( \
47 "andi %0, %0, 0x1\n\t" \
50 : "=r" (__tmp_dummy) \
54 #define local_irq_save(x) \
55 __asm__ __volatile__ ( \
57 "andi %0, %0, 0x1\n\t" \
63 #define local_save_flags(x) \
64 __asm__ __volatile__ ( \
66 "andi %0, %0, 0x1\n\t" \
72 #define irqs_enabled_from_flags(x) ((x) != 0x1f)
74 #define local_irq_restore(x) \
76 if (irqs_enabled_from_flags(x)) \
81 * Force strict CPU ordering.
83 #define nop() asm volatile ("nop;\n\t" : : )
84 #define mb() asm volatile ("" : : : "memory")
85 #define rmb() asm volatile ("" : : : "memory")
86 #define wmb() asm volatile ("" : : : "memory")
88 #endif /* __ASM_NDS_SYSTEM_H */