irq.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * U-boot - irq.h Interrupt related header file
  3. *
  4. * Copyright (c) 2005 blackfin.uclinux.org
  5. *
  6. * This file was based on
  7. * linux/arch/$(ARCH)/platform/$(PLATFORM)/irq.c
  8. *
  9. * Changed by HuTao Apr18, 2003
  10. *
  11. * Copyright was missing when I got the code so took from MIPS arch ...MaTed---
  12. * Copyright (C) 1994 by Waldorf GMBH, written by Ralf Baechle
  13. * Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001 by Ralf Baechle
  14. *
  15. * Adapted for BlackFin (ADI) by Ted Ma <mated@sympatico.ca>
  16. * Copyright (c) 2002 Arcturus Networks Inc. (www.arcturusnetworks.com)
  17. * Copyright (c) 2002 Lineo, Inc. <mattw@lineo.com>
  18. *
  19. * See file CREDITS for list of people who contributed to this
  20. * project.
  21. *
  22. * This program is free software; you can redistribute it and/or
  23. * modify it under the terms of the GNU General Public License as
  24. * published by the Free Software Foundation; either version 2 of
  25. * the License, or (at your option) any later version.
  26. *
  27. * This program is distributed in the hope that it will be useful,
  28. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. * GNU General Public License for more details.
  31. *
  32. * You should have received a copy of the GNU General Public License
  33. * along with this program; if not, write to the Free Software
  34. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35. * MA 02111-1307 USA
  36. */
  37. #ifndef _BLACKFIN_IRQ_H_
  38. #define _BLACKFIN_IRQ_H_
  39. #include <linux/config.h>
  40. #include <asm/hw_irq.h>
  41. /*
  42. * On the Blackfin, the interrupt structure allows remmapping of the hardware
  43. * levels.
  44. * - I'm going to assume that the H/W level is going to stay at the default
  45. * settings. If someone wants to go through and abstart this out, feel free
  46. * to mod the interrupt numbering scheme.
  47. * - I'm abstracting the interrupts so that uClinux does not know anything
  48. * about the H/W levels. If you want to change the H/W AND keep the abstracted
  49. * levels that uClinux sees, you should be able to do most of it here.
  50. * - I've left the "abstract" numbering sparce in case someone wants to pull the
  51. * interrupts apart (just the TX/RX for the various devices)
  52. */
  53. #define NR_IRQS SYS_IRQS
  54. /*
  55. * "Generic" interrupt sources
  56. */
  57. #define IRQ_SCHED_TIMER (8) /* interrupt source for scheduling timer */
  58. static __inline__ int irq_cannonicalize(int irq)
  59. {
  60. return irq;
  61. }
  62. /*
  63. * Machine specific interrupt sources.
  64. *
  65. * Adding an interrupt service routine for a source with this bit
  66. * set indicates a special machine specific interrupt source.
  67. * The machine specific files define these sources.
  68. *
  69. * The IRQ_MACHSPEC bit is now gone - the only thing it did was to
  70. * introduce unnecessary overhead.
  71. *
  72. * All interrupt handling is actually machine specific so it is better
  73. * to use function pointers, as used by the Sparc port, and select the
  74. * interrupt handling functions when initializing the kernel. This way
  75. * we save some unnecessary overhead at run-time.
  76. * 01/11/97 - Jes
  77. */
  78. extern void (*mach_enable_irq) (unsigned int);
  79. extern void (*mach_disable_irq) (unsigned int);
  80. extern int sys_request_irq(unsigned int,
  81. void (*)(int, void *, struct pt_regs *),
  82. unsigned long, const char *, void *);
  83. extern void sys_free_irq(unsigned int, void *);
  84. /*
  85. * various flags for request_irq() - the Amiga now uses the standard
  86. * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ
  87. * are your friends.
  88. */
  89. #define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
  90. #define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */
  91. #define IRQ_FLG_FAST (0x0004)
  92. #define IRQ_FLG_SLOW (0x0008)
  93. #define IRQ_FLG_STD (0x8000) /* internally used */
  94. /*
  95. * This structure is used to chain together the ISRs for a particular
  96. * interrupt source (if it supports chaining).
  97. */
  98. typedef struct irq_node {
  99. void (*handler) (int, void *, struct pt_regs *);
  100. unsigned long flags;
  101. void *dev_id;
  102. const char *devname;
  103. struct irq_node *next;
  104. } irq_node_t;
  105. /*
  106. * This structure has only 4 elements for speed reasons
  107. */
  108. typedef struct irq_handler {
  109. void (*handler) (int, void *, struct pt_regs *);
  110. unsigned long flags;
  111. void *dev_id;
  112. const char *devname;
  113. } irq_handler_t;
  114. /* count of spurious interrupts */
  115. extern volatile unsigned int num_spurious;
  116. /*
  117. * This function returns a new irq_node_t
  118. */
  119. extern irq_node_t *new_irq_node(void);
  120. /*
  121. * Some drivers want these entry points
  122. */
  123. #define enable_irq(x) (mach_enable_irq ? (*mach_enable_irq)(x) : 0)
  124. #define disable_irq(x) (mach_disable_irq ? (*mach_disable_irq)(x) : 0)
  125. #define enable_irq_nosync(x) enable_irq(x)
  126. #define disable_irq_nosync(x) disable_irq(x)
  127. #endif