irqflags.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef __ASM_GENERIC_IRQFLAGS_H
  2. #define __ASM_GENERIC_IRQFLAGS_H
  3. /*
  4. * All architectures should implement at least the first two functions,
  5. * usually inline assembly will be the best way.
  6. */
  7. #ifndef ARCH_IRQ_DISABLED
  8. #define ARCH_IRQ_DISABLED 0
  9. #define ARCH_IRQ_ENABLED 1
  10. #endif
  11. /* read interrupt enabled status */
  12. #ifndef arch_local_save_flags
  13. unsigned long arch_local_save_flags(void);
  14. #endif
  15. /* set interrupt enabled status */
  16. #ifndef arch_local_irq_restore
  17. void arch_local_irq_restore(unsigned long flags);
  18. #endif
  19. /* get status and disable interrupts */
  20. #ifndef arch_local_irq_save
  21. static inline unsigned long arch_local_irq_save(void)
  22. {
  23. unsigned long flags;
  24. flags = arch_local_save_flags();
  25. arch_local_irq_restore(ARCH_IRQ_DISABLED);
  26. return flags;
  27. }
  28. #endif
  29. /* test flags */
  30. #ifndef arch_irqs_disabled_flags
  31. static inline int arch_irqs_disabled_flags(unsigned long flags)
  32. {
  33. return flags == ARCH_IRQ_DISABLED;
  34. }
  35. #endif
  36. /* unconditionally enable interrupts */
  37. #ifndef arch_local_irq_enable
  38. static inline void arch_local_irq_enable(void)
  39. {
  40. arch_local_irq_restore(ARCH_IRQ_ENABLED);
  41. }
  42. #endif
  43. /* unconditionally disable interrupts */
  44. #ifndef arch_local_irq_disable
  45. static inline void arch_local_irq_disable(void)
  46. {
  47. arch_local_irq_restore(ARCH_IRQ_DISABLED);
  48. }
  49. #endif
  50. /* test hardware interrupt enable bit */
  51. #ifndef arch_irqs_disabled
  52. static inline int arch_irqs_disabled(void)
  53. {
  54. return arch_irqs_disabled_flags(arch_local_save_flags());
  55. }
  56. #endif
  57. #endif /* __ASM_GENERIC_IRQFLAGS_H */