/* Pilote pour le controleur d'interruptions Intel 8259A */ /* Copyright (C) 2008 Emmanuel Varoquaux This file is part of XOS. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include void pic_init() { /* sequence d'initialisation */ outbp(0x11, 0x20); /* 8259A-1 */ outbp(0x11, 0xa0); /* 8259A-2 */ outbp(0x20, 0x21); /* adresse de base des it du 8259A-1 (0x20) */ outbp(0x28, 0xa1); /* adresse de base des it du 8259A-2 (0x28) */ outbp(0x04, 0x21); /* 8259-1 est maitre */ outbp(0x02, 0xa1); /* 8259-2 est esclave */ /* 8086 mode */ outbp(0x01, 0x21); outbp(0x01, 0xa1); /* masquage des interruptions */ outbp(0xff, 0x21); outbp(0xff, 0xa1); } void pic_enable_irq(unsigned int irq) { if (irq < 8) outb(inbp(0x21) & ~(1 << irq), 0x21); else outb(inbp(0xa1) & ~(1 << (irq - 8)), 0xa1); } void pic_ack_master() { outb(0x20, 0x20); /* End Of Interrupt */ } void pic_ack_slave() { outb(0x20, 0xa0); /* End Of Interrupt */ }