1*3245ecabSrafal /* $NetBSD: irqhandler.h,v 1.9 2008/06/13 13:24:10 rafal Exp $ */ 2c98cd6c0Sichiro 3c98cd6c0Sichiro /* 4c98cd6c0Sichiro * Copyright (c) 1994-1996 Mark Brinicombe. 5c98cd6c0Sichiro * Copyright (c) 1994 Brini. 6c98cd6c0Sichiro * All rights reserved. 7c98cd6c0Sichiro * 8c98cd6c0Sichiro * This code is derived from software written for Brini by Mark Brinicombe 9c98cd6c0Sichiro * 10c98cd6c0Sichiro * Redistribution and use in source and binary forms, with or without 11c98cd6c0Sichiro * modification, are permitted provided that the following conditions 12c98cd6c0Sichiro * are met: 13c98cd6c0Sichiro * 1. Redistributions of source code must retain the above copyright 14c98cd6c0Sichiro * notice, this list of conditions and the following disclaimer. 15c98cd6c0Sichiro * 2. Redistributions in binary form must reproduce the above copyright 16c98cd6c0Sichiro * notice, this list of conditions and the following disclaimer in the 17c98cd6c0Sichiro * documentation and/or other materials provided with the distribution. 18c98cd6c0Sichiro * 3. All advertising materials mentioning features or use of this software 19c98cd6c0Sichiro * must display the following acknowledgement: 20c98cd6c0Sichiro * This product includes software developed by Mark Brinicombe 21c98cd6c0Sichiro * for the NetBSD Project. 22c98cd6c0Sichiro * 4. The name of the company nor the name of the author may be used to 23c98cd6c0Sichiro * endorse or promote products derived from this software without specific 24c98cd6c0Sichiro * prior written permission. 25c98cd6c0Sichiro * 26c98cd6c0Sichiro * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 27c98cd6c0Sichiro * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28c98cd6c0Sichiro * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 29c98cd6c0Sichiro * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 30c98cd6c0Sichiro * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31c98cd6c0Sichiro * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32c98cd6c0Sichiro * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33c98cd6c0Sichiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34c98cd6c0Sichiro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35c98cd6c0Sichiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36c98cd6c0Sichiro * SUCH DAMAGE. 37c98cd6c0Sichiro * 38c98cd6c0Sichiro * IRQ related stuff (defines + structures) 39c98cd6c0Sichiro * 40c98cd6c0Sichiro * Created : 30/09/94 41c98cd6c0Sichiro */ 42c98cd6c0Sichiro 43fd61423fStoshii #ifndef _HPCARM_IRQHANDLER_H_ 44fd61423fStoshii #define _HPCARM_IRQHANDLER_H_ 45c98cd6c0Sichiro 46c98cd6c0Sichiro #ifndef _LOCORE 47c98cd6c0Sichiro #include <sys/types.h> 48c98cd6c0Sichiro #endif /* _LOCORE */ 49c98cd6c0Sichiro 50c98cd6c0Sichiro /* Define the IRQ bits */ 51c98cd6c0Sichiro 52c98cd6c0Sichiro #define IRQ_VSYNC IRQ_FLYBACK /* Aliased */ 53c98cd6c0Sichiro #define IRQ_NETSLOT IRQ_EXTENDED 54c98cd6c0Sichiro 55c98cd6c0Sichiro #define IRQ_INSTRUCT -1 56c98cd6c0Sichiro /* XXX ICU_LEN is used for the same purpose. Either one should be nuked */ 57c98cd6c0Sichiro #define NIRQS 0x20 58c98cd6c0Sichiro 59c98cd6c0Sichiro #include <machine/intr.h> 60c98cd6c0Sichiro 61c98cd6c0Sichiro #ifndef _LOCORE 62c98cd6c0Sichiro typedef struct irqhandler { 63f2afca50Speter int (*ih_func)(void *); /* handler function */ 64c98cd6c0Sichiro void *ih_arg; /* Argument to handler */ 65c98cd6c0Sichiro int ih_level; /* Interrupt level */ 66c98cd6c0Sichiro int ih_count; /* Interrupt number (for accounting) */ 67c98cd6c0Sichiro int ih_irq; /* Interrupt register pin */ 68c98cd6c0Sichiro const char *ih_name; /* Name of interrupt (for vmstat -i) */ 69c98cd6c0Sichiro u_int ih_flags; /* Interrupt flags */ 70c98cd6c0Sichiro u_int ih_maskaddr; /* mask address for expansion cards */ 71c98cd6c0Sichiro u_int ih_maskbits; /* interrupt bit for expansion cards */ 72c98cd6c0Sichiro struct irqhandler *ih_next; /* next handler */ 73c98cd6c0Sichiro } irqhandler_t; 74c98cd6c0Sichiro 75c98cd6c0Sichiro #ifdef _KERNEL 76*3245ecabSrafal extern u_int irqmasks[NIPL]; 77c98cd6c0Sichiro extern irqhandler_t *irqhandlers[NIRQS]; 78c98cd6c0Sichiro 79f2afca50Speter void irq_init(void); 80f2afca50Speter void irq_setmasks(void); 81f2afca50Speter void disable_irq(int); 82f2afca50Speter void enable_irq(int); 83c98cd6c0Sichiro #endif /* _KERNEL */ 84c98cd6c0Sichiro #endif /* _LOCORE */ 85c98cd6c0Sichiro 86c98cd6c0Sichiro #define IRQ_FLAG_ACTIVE 0x00000001 /* This is the active handler in list */ 87c98cd6c0Sichiro 88fd61423fStoshii #endif /* _HPCARM_IRQHANDLER_H_ */ 89c98cd6c0Sichiro 90c98cd6c0Sichiro /* End of irqhandler.h */ 91