irq.h
上传用户:szlgq88
上传日期:2009-04-28
资源大小:48287k
文件大小:4k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  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 *chipdata;
  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. struct proc_dir_entry *procdir;
  71. #ifdef CONFIG_SMP
  72. cpumask_t affinity;
  73. unsigned int cpu;
  74. #endif
  75. /*
  76.  * IRQ lock detection
  77.  */
  78. unsigned int lck_cnt;
  79. unsigned int lck_pc;
  80. unsigned int lck_jif;
  81. };
  82. extern struct irqdesc irq_desc[];
  83. /*
  84.  * Helpful inline function for calling irq descriptor handlers.
  85.  */
  86. static inline void desc_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
  87. {
  88. desc->handle(irq, desc, regs);
  89. }
  90. /*
  91.  * This is internal.  Do not use it.
  92.  */
  93. extern void (*init_arch_irq)(void);
  94. extern void init_FIQ(void);
  95. extern int show_fiq_list(struct seq_file *, void *);
  96. void __set_irq_handler(unsigned int irq, irq_handler_t, int);
  97. /*
  98.  * External stuff.
  99.  */
  100. #define set_irq_handler(irq,handler) __set_irq_handler(irq,handler,0)
  101. #define set_irq_chained_handler(irq,handler) __set_irq_handler(irq,handler,1)
  102. #define set_irq_data(irq,d) do { irq_desc[irq].data = d; } while (0)
  103. #define set_irq_chipdata(irq,d) do { irq_desc[irq].chipdata = d; } while (0)
  104. #define get_irq_chipdata(irq) (irq_desc[irq].chipdata)
  105. void set_irq_chip(unsigned int irq, struct irqchip *);
  106. void set_irq_flags(unsigned int irq, unsigned int flags);
  107. #define IRQF_VALID (1 << 0)
  108. #define IRQF_PROBE (1 << 1)
  109. #define IRQF_NOAUTOEN (1 << 2)
  110. /*
  111.  * Built-in IRQ handlers.
  112.  */
  113. void do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
  114. void do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
  115. void do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
  116. void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
  117. void dummy_mask_unmask_irq(unsigned int irq);
  118. #endif