1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2011 Andes Technology Corporation
4 * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
7 #ifndef __ASM_NDS_SYSTEM_H
8 #define __ASM_NDS_SYSTEM_H
11 * Interrupt configuring macros.
16 #define local_irq_enable() \
17 __asm__ __volatile__ ( \
19 "andi %0, %0, 0x1\n\t" \
25 #define local_irq_disable() \
28 __asm__ __volatile__ ( \
30 "andi %0, %0, 0x1\n\t" \
33 : "=r" (__tmp_dummy) \
37 #define local_irq_save(x) \
38 __asm__ __volatile__ ( \
40 "andi %0, %0, 0x1\n\t" \
46 #define local_save_flags(x) \
47 __asm__ __volatile__ ( \
49 "andi %0, %0, 0x1\n\t" \
55 #define irqs_enabled_from_flags(x) ((x) != 0x1f)
57 #define local_irq_restore(x) \
59 if (irqs_enabled_from_flags(x)) \
64 * Force strict CPU ordering.
66 #define nop() asm volatile ("nop;\n\t" : : )
67 #define mb() asm volatile ("" : : : "memory")
68 #define rmb() asm volatile ("" : : : "memory")
69 #define wmb() asm volatile ("" : : : "memory")
71 #endif /* __ASM_NDS_SYSTEM_H */