root/arch/nios2/include/asm/irqflags.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. arch_local_save_flags
  2. arch_local_irq_restore
  3. arch_local_irq_disable
  4. arch_local_irq_enable
  5. arch_irqs_disabled_flags
  6. arch_irqs_disabled
  7. arch_local_irq_save

   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 
  10 static inline unsigned long arch_local_save_flags(void)
  11 {
  12         return RDCTL(CTL_STATUS);
  13 }
  14 
  15 /*
  16  * This will restore ALL status register flags, not only the interrupt
  17  * mask flag.
  18  */
  19 static inline void arch_local_irq_restore(unsigned long flags)
  20 {
  21         WRCTL(CTL_STATUS, flags);
  22 }
  23 
  24 static 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 
  32 static 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 
  40 static inline int arch_irqs_disabled_flags(unsigned long flags)
  41 {
  42         return (flags & STATUS_PIE) == 0;
  43 }
  44 
  45 static inline int arch_irqs_disabled(void)
  46 {
  47         return arch_irqs_disabled_flags(arch_local_save_flags());
  48 }
  49 
  50 static 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 */

/* [<][>][^][v][top][bottom][index][help] */