source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/asm/i8259.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 1.5 KB
RevLine 
[2]1/*
2 *      include/asm-mips/i8259.h
3 *
4 *      i8259A interrupt definitions.
5 *
6 *      Copyright (C) 2003  Maciej W. Rozycki
7 *      Copyright (C) 2003  Ralf Baechle <ralf@linux-mips.org>
8 *
9 *      This program is free software; you can redistribute it and/or
10 *      modify it under the terms of the GNU General Public License
11 *      as published by the Free Software Foundation; either version
12 *      2 of the License, or (at your option) any later version.
13 */
14#ifndef _ASM_I8259_H
15#define _ASM_I8259_H
16
17
18#include <asm/io.h>
19
20extern spinlock_t i8259A_lock;
21
22extern void init_i8259_irqs(void);
23
24/*
25 * Do the traditional i8259 interrupt polling thing.  This is for the few
26 * cases where no better interrupt acknowledge method is available and we
27 * absolutely must touch the i8259.
28 */
29static inline int i8259_irq(void)
30{
31        int irq;
32
33        spin_lock(&i8259A_lock);
34
35        /* Perform an interrupt acknowledge cycle on controller 1. */
36        outb(0x0C, 0x20);               /* prepare for poll */
37        irq = inb(0x20) & 7;
38        if (irq == 2) {
39                /*
40                 * Interrupt is cascaded so perform interrupt
41                 * acknowledge on controller 2.
42                 */
43                outb(0x0C, 0xA0);               /* prepare for poll */
44                irq = (inb(0xA0) & 7) + 8;
45        }
46
47        if (unlikely(irq == 7)) {
48                /*
49                 * This may be a spurious interrupt.
50                 *
51                 * Read the interrupt status register (ISR). If the most
52                 * significant bit is not set then there is no valid
53                 * interrupt.
54                 */
55                outb(0x0B, 0x20);               /* ISR register */
56                if(~inb(0x20) & 0x80)
57                        irq = -1;
58        }
59
60        spin_unlock(&i8259A_lock);
61
62        return irq;
63}
64
65#endif /* _ASM_I8259_H */
Note: See TracBrowser for help on using the repository browser.