cevt-r4k.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2008 Kevin D. Kissell
  7. */
  8. /*
  9. * Definitions used for common event timer implementation
  10. * for MIPS 4K-type processors and their MIPS MT variants.
  11. * Avoids unsightly extern declarations in C files.
  12. */
  13. #ifndef __ASM_CEVT_R4K_H
  14. #define __ASM_CEVT_R4K_H
  15. DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
  16. void mips_event_handler(struct clock_event_device *dev);
  17. int c0_compare_int_usable(void);
  18. void mips_set_clock_mode(enum clock_event_mode, struct clock_event_device *);
  19. irqreturn_t c0_compare_interrupt(int, void *);
  20. extern struct irqaction c0_compare_irqaction;
  21. extern int cp0_timer_irq_installed;
  22. /*
  23. * Possibly handle a performance counter interrupt.
  24. * Return true if the timer interrupt should not be checked
  25. */
  26. static inline int handle_perf_irq(int r2)
  27. {
  28. /*
  29. * The performance counter overflow interrupt may be shared with the
  30. * timer interrupt (cp0_perfcount_irq < 0). If it is and a
  31. * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
  32. * and we can't reliably determine if a counter interrupt has also
  33. * happened (!r2) then don't check for a timer interrupt.
  34. */
  35. return (cp0_perfcount_irq < 0) &&
  36. perf_irq() == IRQ_HANDLED &&
  37. !r2;
  38. }
  39. #endif /* __ASM_CEVT_R4K_H */