Home | History | Annotate | Line # | Download | only in include
irqhandler.h revision 1.2.2.2
      1  1.2.2.2  thorpej /*	$NetBSD: irqhandler.h,v 1.2.2.2 2002/01/10 19:36:19 thorpej Exp $	*/
      2  1.2.2.2  thorpej 
      3  1.2.2.2  thorpej /*
      4  1.2.2.2  thorpej  * Copyright (c) 1994-1996 Mark Brinicombe.
      5  1.2.2.2  thorpej  * Copyright (c) 1994 Brini.
      6  1.2.2.2  thorpej  * All rights reserved.
      7  1.2.2.2  thorpej  *
      8  1.2.2.2  thorpej  * This code is derived from software written for Brini by Mark Brinicombe
      9  1.2.2.2  thorpej  *
     10  1.2.2.2  thorpej  * Redistribution and use in source and binary forms, with or without
     11  1.2.2.2  thorpej  * modification, are permitted provided that the following conditions
     12  1.2.2.2  thorpej  * are met:
     13  1.2.2.2  thorpej  * 1. Redistributions of source code must retain the above copyright
     14  1.2.2.2  thorpej  *    notice, this list of conditions and the following disclaimer.
     15  1.2.2.2  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.2.2.2  thorpej  *    notice, this list of conditions and the following disclaimer in the
     17  1.2.2.2  thorpej  *    documentation and/or other materials provided with the distribution.
     18  1.2.2.2  thorpej  * 3. All advertising materials mentioning features or use of this software
     19  1.2.2.2  thorpej  *    must display the following acknowledgement:
     20  1.2.2.2  thorpej  *	This product includes software developed by Mark Brinicombe
     21  1.2.2.2  thorpej  *	for the NetBSD Project.
     22  1.2.2.2  thorpej  * 4. The name of the company nor the name of the author may be used to
     23  1.2.2.2  thorpej  *    endorse or promote products derived from this software without specific
     24  1.2.2.2  thorpej  *    prior written permission.
     25  1.2.2.2  thorpej  *
     26  1.2.2.2  thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     27  1.2.2.2  thorpej  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     28  1.2.2.2  thorpej  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     29  1.2.2.2  thorpej  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     30  1.2.2.2  thorpej  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     31  1.2.2.2  thorpej  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     32  1.2.2.2  thorpej  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33  1.2.2.2  thorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34  1.2.2.2  thorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35  1.2.2.2  thorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36  1.2.2.2  thorpej  * SUCH DAMAGE.
     37  1.2.2.2  thorpej  *
     38  1.2.2.2  thorpej  * IRQ related stuff (defines + structures)
     39  1.2.2.2  thorpej  *
     40  1.2.2.2  thorpej  * Created      : 30/09/94
     41  1.2.2.2  thorpej  */
     42  1.2.2.2  thorpej 
     43  1.2.2.2  thorpej #ifndef _ARM32_IRQHANDLER_H_
     44  1.2.2.2  thorpej #define _ARM32_IRQHANDLER_H_
     45  1.2.2.2  thorpej 
     46  1.2.2.2  thorpej #if defined(_KERNEL_OPT)
     47  1.2.2.2  thorpej #include "iomd.h"
     48  1.2.2.2  thorpej #endif
     49  1.2.2.2  thorpej 
     50  1.2.2.2  thorpej #ifndef _LOCORE
     51  1.2.2.2  thorpej #include <sys/types.h>
     52  1.2.2.2  thorpej #endif /* _LOCORE */
     53  1.2.2.2  thorpej 
     54  1.2.2.2  thorpej /* Define the IRQ bits */
     55  1.2.2.2  thorpej 
     56  1.2.2.2  thorpej /*
     57  1.2.2.2  thorpej  * XXX this is really getting rather horrible.
     58  1.2.2.2  thorpej  * Shortly to be replaced with system specific interrupt tables and handling
     59  1.2.2.2  thorpej  */
     60  1.2.2.2  thorpej 
     61  1.2.2.2  thorpej #if NIOMD > 0
     62  1.2.2.2  thorpej 
     63  1.2.2.2  thorpej /* Only for ARM7500 : */
     64  1.2.2.2  thorpej 
     65  1.2.2.2  thorpej /*#define IRQ_PRINTER	0x00*/
     66  1.2.2.2  thorpej /*#define IRQ_RESERVED0	0x01*/
     67  1.2.2.2  thorpej #define IRQ_BUTTON	0x02
     68  1.2.2.2  thorpej #define IRQ_FLYBACK	0x03
     69  1.2.2.2  thorpej #define IRQ_POR		0x04
     70  1.2.2.2  thorpej #define IRQ_TIMER0	0x05
     71  1.2.2.2  thorpej #define IRQ_TIMER1 	0x06
     72  1.2.2.2  thorpej 
     73  1.2.2.2  thorpej #define IRQ_DREQ3	0x08
     74  1.2.2.2  thorpej /*#define IRQ_HD1	0x09*/
     75  1.2.2.2  thorpej /*#define IRQ_HD	IRQ_HD1*/
     76  1.2.2.2  thorpej #define IRQ_DREQ2	0x0A
     77  1.2.2.2  thorpej /*#define IRQ_FLOPPY	0x0C*/
     78  1.2.2.2  thorpej /*#define IRQ_SERIAL	0x0D*/
     79  1.2.2.2  thorpej #define IRQ_KBDTX	0x0E
     80  1.2.2.2  thorpej #define IRQ_KBDRX	0x0F
     81  1.2.2.2  thorpej 
     82  1.2.2.2  thorpej #define IRQ_IRQ3	0x10
     83  1.2.2.2  thorpej #define IRQ_IRQ4	0x11
     84  1.2.2.2  thorpej #define IRQ_IRQ5	0x12
     85  1.2.2.2  thorpej #define IRQ_IRQ6	0x13
     86  1.2.2.2  thorpej #define IRQ_IRQ7	0x14
     87  1.2.2.2  thorpej #define IRQ_IRQ9	0x15
     88  1.2.2.2  thorpej #define IRQ_IRQ10	0x16
     89  1.2.2.2  thorpej #define IRQ_IRQ11	0x17
     90  1.2.2.2  thorpej 
     91  1.2.2.2  thorpej #define IRQ_MSDRX	0x18
     92  1.2.2.2  thorpej #define IRQ_MSDTX	0x19
     93  1.2.2.2  thorpej #define IRQ_ATOD	0x1A
     94  1.2.2.2  thorpej #define IRQ_CLOCK	0x1B
     95  1.2.2.2  thorpej #define IRQ_PANIC	0x1C
     96  1.2.2.2  thorpej /*#define IRQ_RESERVED2	0x1D*/
     97  1.2.2.2  thorpej /*#define IRQ_RESERVED3	0x1E*/
     98  1.2.2.2  thorpej 
     99  1.2.2.2  thorpej 
    100  1.2.2.2  thorpej /*
    101  1.2.2.2  thorpej  * Note that Sound DMA IRQ is on the 31st vector.
    102  1.2.2.2  thorpej  * It's not part of the IRQD.
    103  1.2.2.2  thorpej  */
    104  1.2.2.2  thorpej #define IRQ_SDMA	0x1F
    105  1.2.2.2  thorpej 
    106  1.2.2.2  thorpej /* Several interrupts are different between the A7000 and RC7500 */
    107  1.2.2.2  thorpej #ifdef RC7500
    108  1.2.2.2  thorpej 
    109  1.2.2.2  thorpej #define IRQ_FIQDOWN	0x07
    110  1.2.2.2  thorpej #define IRQ_ETHERNET	0x0B
    111  1.2.2.2  thorpej #define IRQ_HD2		IRQ_IRQ11
    112  1.2.2.2  thorpej 
    113  1.2.2.2  thorpej #else	/* RC7500 */
    114  1.2.2.2  thorpej 
    115  1.2.2.2  thorpej /*#define IRQ_RESERVED1	0x07 */
    116  1.2.2.2  thorpej #define IRQ_EXTENDED	0x0B
    117  1.2.2.2  thorpej #define IRQ_PODULE	0x0D
    118  1.2.2.2  thorpej 
    119  1.2.2.2  thorpej #endif	/* RC7500 */
    120  1.2.2.2  thorpej 
    121  1.2.2.2  thorpej 
    122  1.2.2.2  thorpej 
    123  1.2.2.2  thorpej 
    124  1.2.2.2  thorpej /* for non ARM7500 machines : */
    125  1.2.2.2  thorpej 
    126  1.2.2.2  thorpej /*#define IRQ_PRINTER	0x00*/
    127  1.2.2.2  thorpej /*#define IRQ_RESERVED0	0x01*/
    128  1.2.2.2  thorpej /*#define IRQ_FLOPPYIDX	0x02*/
    129  1.2.2.2  thorpej #define IRQ_FLYBACK	0x03
    130  1.2.2.2  thorpej #define IRQ_POR		0x04
    131  1.2.2.2  thorpej #define IRQ_TIMER0	0x05
    132  1.2.2.2  thorpej #define IRQ_TIMER1	0x06
    133  1.2.2.2  thorpej /*#define IRQ_RESERVED1	0x07*/
    134  1.2.2.2  thorpej 
    135  1.2.2.2  thorpej /*#define IRQ_RESERVED2	0x08*/
    136  1.2.2.2  thorpej /*#define IRQ_HD	0x09*/
    137  1.2.2.2  thorpej /*#define IRQ_SERIAL	0x0A*/
    138  1.2.2.2  thorpej #define IRQ_EXTENDED	0x0B
    139  1.2.2.2  thorpej /*#define IRQ_FLOPPY	0x0C*/
    140  1.2.2.2  thorpej #define IRQ_PODULE	0x0D
    141  1.2.2.2  thorpej #define IRQ_KBDTX	0x0E
    142  1.2.2.2  thorpej #define IRQ_KBDRX	0x0F
    143  1.2.2.2  thorpej 
    144  1.2.2.2  thorpej #define IRQ_DMACH0	0x10
    145  1.2.2.2  thorpej #define IRQ_DMACH1	0x11
    146  1.2.2.2  thorpej #define IRQ_DMACH2	0x12
    147  1.2.2.2  thorpej #define IRQ_DMACH3	0x13
    148  1.2.2.2  thorpej #define IRQ_DMASCH0	0x14
    149  1.2.2.2  thorpej #define IRQ_DMASCH1	0x15
    150  1.2.2.2  thorpej /*#define IRQ_RESERVED3	0x16*/
    151  1.2.2.2  thorpej /*#define IRQ_RESERVED4	0x17*/
    152  1.2.2.2  thorpej 
    153  1.2.2.2  thorpej 
    154  1.2.2.2  thorpej 
    155  1.2.2.2  thorpej #endif	/* NIOMD > 0 */
    156  1.2.2.2  thorpej 
    157  1.2.2.2  thorpej #define IRQ_VSYNC	IRQ_FLYBACK	/* Aliased */
    158  1.2.2.2  thorpej #define IRQ_NETSLOT	IRQ_EXTENDED
    159  1.2.2.2  thorpej 
    160  1.2.2.2  thorpej #define IRQ_INSTRUCT	-1
    161  1.2.2.2  thorpej #define NIRQS		0x20
    162  1.2.2.2  thorpej 
    163  1.2.2.2  thorpej #include <machine/intr.h>
    164  1.2.2.2  thorpej 
    165  1.2.2.2  thorpej #ifndef _LOCORE
    166  1.2.2.2  thorpej typedef struct irqhandler {
    167  1.2.2.2  thorpej 	int (*ih_func) __P((void *arg));/* handler function */
    168  1.2.2.2  thorpej 	void *ih_arg;			/* Argument to handler */
    169  1.2.2.2  thorpej 	int ih_level;			/* Interrupt level */
    170  1.2.2.2  thorpej 	int ih_num;			/* Interrupt number (for accounting) */
    171  1.2.2.2  thorpej 	const char *ih_name;		/* Name of interrupt (for vmstat -i) */
    172  1.2.2.2  thorpej 	u_int ih_flags;			/* Interrupt flags */
    173  1.2.2.2  thorpej 	u_int ih_maskaddr;		/* mask address for expansion cards */
    174  1.2.2.2  thorpej 	u_int ih_maskbits;		/* interrupt bit for expansion cards */
    175  1.2.2.2  thorpej 	struct irqhandler *ih_next;	/* next handler */
    176  1.2.2.2  thorpej } irqhandler_t;
    177  1.2.2.2  thorpej 
    178  1.2.2.2  thorpej #ifdef _KERNEL
    179  1.2.2.2  thorpej extern u_int irqmasks[IPL_LEVELS];
    180  1.2.2.2  thorpej extern irqhandler_t *irqhandlers[NIRQS];
    181  1.2.2.2  thorpej 
    182  1.2.2.2  thorpej void irq_init __P((void));
    183  1.2.2.2  thorpej int irq_claim __P((int, irqhandler_t *));
    184  1.2.2.2  thorpej int irq_release __P((int, irqhandler_t *));
    185  1.2.2.2  thorpej void *intr_claim __P((int irq, int level, const char *name, int (*func) __P((void *)), void *arg));
    186  1.2.2.2  thorpej int intr_release __P((void *ih));
    187  1.2.2.2  thorpej void irq_setmasks __P((void));
    188  1.2.2.2  thorpej void disable_irq __P((int));
    189  1.2.2.2  thorpej void enable_irq __P((int));
    190  1.2.2.2  thorpej #endif	/* _KERNEL */
    191  1.2.2.2  thorpej #endif	/* _LOCORE */
    192  1.2.2.2  thorpej 
    193  1.2.2.2  thorpej #define IRQ_FLAG_ACTIVE 0x00000001	/* This is the active handler in list */
    194  1.2.2.2  thorpej 
    195  1.2.2.2  thorpej #endif	/* _ARM32_IRQHANDLER_H_ */
    196  1.2.2.2  thorpej 
    197  1.2.2.2  thorpej /* End of irqhandler.h */
    198