1/* ********************************************************************* 2 * Broadcom Common Firmware Environment (CFE) 3 * 4 * IRQ related definitions File: cfe_irq.h 5 * 6 * This module describes a possible interface for dispatching 7 * to driver-supplied service routines. Dispatch can be based 8 * either on asynchronous interrupt events or on synchrnous 9 * polling of the interrupt status registers from the idle loop. 10 * 11 * The interface attempts to accomodate the concept of interrupt 12 * mapping as is common on high-integration parts with standard 13 * cores. The details are motivated by the bcm1250/MIPS 14 * architecture, where the mapping abstraction is somewhat violated 15 * by CP0 interrupts that do not go through the mapper. 16 * 17 * NOTE: An implementation of this interface was developed in 18 * connection with some specialized experiments in performance 19 * measurement. It is not currently suitable for general use. No 20 * implementation of the interface is part of the standard CFE 21 * distribution. To avoid unresolved external references to the 22 * functions declared here, do not set IPOLL in any of the device 23 * driver sources. 24 ********************************************************************* 25 * 26 * Copyright 2000,2001,2002,2003 27 * Broadcom Corporation. All rights reserved. 28 * 29 * This software is furnished under license and may be used and 30 * copied only in accordance with the following terms and 31 * conditions. Subject to these conditions, you may download, 32 * copy, install, use, modify and distribute modified or unmodified 33 * copies of this software in source and/or binary form. No title 34 * or ownership is transferred hereby. 35 * 36 * 1) Any source code used, modified or distributed must reproduce 37 * and retain this copyright notice and list of conditions 38 * as they appear in the source file. 39 * 40 * 2) No right is granted to use any trade name, trademark, or 41 * logo of Broadcom Corporation. The "Broadcom Corporation" 42 * name may not be used to endorse or promote products derived 43 * from this software without the prior written permission of 44 * Broadcom Corporation. 45 * 46 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR 47 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED 48 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 49 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT 50 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN 51 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, 52 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 53 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 54 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 55 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 56 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 57 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF 58 * THE POSSIBILITY OF SUCH DAMAGE. 59 ********************************************************************* */ 60 61/* ********************************************************************* 62 * Constants 63 ********************************************************************* */ 64 65#define CFE_IRQ_FLAGS_SHARED 0x1 66 67/* ********************************************************************* 68 * Structures 69 ********************************************************************* */ 70 71/* ********************************************************************* 72 * Functions 73 ********************************************************************* */ 74 75void cfe_irq_init(void); 76 77 78/* Functions that use interrupt mapping, i.e., the irq argument is the 79 interrupt number at the input to the mapper. */ 80 81void cfe_mask_irq(int cpu, unsigned int irq); 82void cfe_unmask_irq(int cpu, unsigned int irq); 83 84void cfe_enable_irq(unsigned int irq); 85void cfe_disable_irq(unsigned int irq); 86 87int cfe_request_irq(unsigned int irq, 88 void (*handler)(void *), void *arg, 89 unsigned long irqflags, int device); 90void cfe_free_irq(unsigned int irq, int device); 91 92/* pseudo-interrupts, by polling request lines and invoking handlers */ 93 94void cfe_irq_poll(void *); 95 96 97/* Functions that bypass interrupt mapping, i.e., the ip argument 98 is the interrupt number at the output of the mapper and/or the 99 input to the CPU. */ 100 101typedef void (* ip_handler_t)(int ip); 102 103void cfe_irq_setvector(int ip, ip_handler_t handler); 104 105/* enable/disable interrupts at the CPU level. */ 106 107void cfe_irq_enable(int mask); 108int cfe_irq_disable(void); 109