irq.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * linux/include/asm-arm/mach/irq.h
  3. *
  4. * Copyright (C) 1995-2000 Russell King.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_ARM_MACH_IRQ_H
  11. #define __ASM_ARM_MACH_IRQ_H
  12. struct irqdesc;
  13. struct pt_regs;
  14. struct seq_file;
  15. typedef void (*irq_handler_t)(unsigned int, struct irqdesc *, struct pt_regs *);
  16. typedef void (*irq_control_t)(unsigned int);
  17. struct irqchip {
  18. /*
  19. * Acknowledge the IRQ.
  20. * If this is a level-based IRQ, then it is expected to mask the IRQ
  21. * as well.
  22. */
  23. void (*ack)(unsigned int);
  24. /*
  25. * Mask the IRQ in hardware.
  26. */
  27. void (*mask)(unsigned int);
  28. /*
  29. * Unmask the IRQ in hardware.
  30. */
  31. void (*unmask)(unsigned int);
  32. /*
  33. * Ask the hardware to re-trigger the IRQ.
  34. * Note: This method _must_ _not_ call the interrupt handler.
  35. * If you are unable to retrigger the interrupt, do not
  36. * provide a function, or if you do, return non-zero.
  37. */
  38. int (*retrigger)(unsigned int);
  39. /*
  40. * Set the type of the IRQ.
  41. */
  42. int (*set_type)(unsigned int, unsigned int);
  43. /*
  44. * Set wakeup-enable on the selected IRQ
  45. */
  46. int (*set_wake)(unsigned int, unsigned int);
  47. #ifdef CONFIG_SMP
  48. /*
  49. * Route an interrupt to a CPU
  50. */
  51. void (*set_cpu)(struct irqdesc *desc, unsigned int irq, unsigned int cpu);
  52. #endif
  53. };
  54. struct irqdesc {
  55. irq_handler_t handle;
  56. struct irqchip *chip;
  57. struct irqaction *action;
  58. struct list_head pend;
  59. void __iomem *base;
  60. void *data;
  61. unsigned int disable_depth;
  62. unsigned int triggered: 1; /* IRQ has occurred */
  63. unsigned int running : 1; /* IRQ is running */
  64. unsigned int pending : 1; /* IRQ is pending */
  65. unsigned int probing : 1; /* IRQ in use for a probe */
  66. unsigned int probe_ok : 1; /* IRQ can be used for probe */
  67. unsigned int valid : 1; /* IRQ claimable */
  68. unsigned int noautoenable : 1; /* don't automatically enable IRQ */
  69. unsigned int unused :25;
  70. unsigned int irqs_unhandled;
  71. struct proc_dir_entry *procdir;
  72. #ifdef CONFIG_SMP
  73. cpumask_t affinity;
  74. unsigned int cpu;
  75. #endif
  76. /*
  77. * IRQ lock detection
  78. */
  79. unsigned int lck_cnt;
  80. unsigned int lck_pc;
  81. unsigned int lck_jif;
  82. };
  83. extern struct irqdesc irq_desc[];
  84. /*
  85. * Helpful inline function for calling irq descriptor handlers.
  86. */
  87. static inline void desc_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
  88. {
  89. desc->handle(irq, desc, regs);
  90. }
  91. /*
  92. * This is internal. Do not use it.
  93. */
  94. extern void (*init_arch_irq)(void);
  95. extern void init_FIQ(void);
  96. extern int show_fiq_list(struct seq_file *, void *);
  97. void __set_irq_handler(unsigned int irq, irq_handler_t, int);
  98. /*
  99. * External stuff.
  100. */
  101. #define set_irq_handler(irq,handler) __set_irq_handler(irq,handler,0)
  102. #define set_irq_chained_handler(irq,handler) __set_irq_handler(irq,handler,1)
  103. #define set_irq_data(irq,d) do { irq_desc[irq].data = d; } while (0)
  104. #define set_irq_chipdata(irq,d) do { irq_desc[irq].base = d; } while (0)
  105. #define get_irq_chipdata(irq) (irq_desc[irq].base)
  106. void set_irq_chip(unsigned int irq, struct irqchip *);
  107. void set_irq_flags(unsigned int irq, unsigned int flags);
  108. #define IRQF_VALID (1 << 0)
  109. #define IRQF_PROBE (1 << 1)
  110. #define IRQF_NOAUTOEN (1 << 2)
  111. /*
  112. * Built-in IRQ handlers.
  113. */
  114. void do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
  115. void do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
  116. void do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
  117. void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
  118. void dummy_mask_unmask_irq(unsigned int irq);
  119. #endif