irq.h 819 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* IRQ functions
  2. *
  3. * (C) Copyright 2007
  4. * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #ifndef __SPARC_IRQ_H__
  9. #define __SPARC_IRQ_H__
  10. #include <asm/psr.h>
  11. /* Set SPARC Processor Interrupt Level */
  12. static inline void set_pil(unsigned int level)
  13. {
  14. unsigned int psr = get_psr();
  15. put_psr((psr & ~PSR_PIL) | ((level & 0xf) << PSR_PIL_OFS));
  16. }
  17. /* Get SPARC Processor Interrupt Level */
  18. static inline unsigned int get_pil(void)
  19. {
  20. unsigned int psr = get_psr();
  21. return (psr & PSR_PIL) >> PSR_PIL_OFS;
  22. }
  23. /* Disables interrupts and return current PIL value */
  24. extern int intLock(void);
  25. /* Sets the PIL to oldLevel */
  26. extern void intUnlock(int oldLevel);
  27. /* Return non-zero if interrupts are currently enabled */
  28. extern int interrupt_is_enabled(void);
  29. #endif