1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /*
- * irq.h
- *
- * Copyright (C) 2013 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef _IRQ_H_
- #define _IRQ_H_
- #include <common.h>
- #include <interrupt.h>
- #define IRQ_INT_BASE 0x20
- #define MAX_IRQ_COUNT 16
- #define PRIMARY_IRQ_INT IRQ_INT_BASE
- #define SECONDARY_IRQ_INT (IRQ_INT_BASE + 8)
- #define PRIMARY_PIC_CMD 0x20
- #define SECONDARY_PIC_CMD 0xA0
- #define PRIMARY_PIC_DATA 0x21
- #define SECONDARY_PIC_DATA 0xA1
- #define PRIMARY_PIC_CASCADE_IRQ 2
- #define SECONDARY_PIC_CASCADE_IRQ 1
- #define PIC_8086_MODE 0x01
- typedef void (*irq_handler_proc_t)(registers_t *regs, byte_t irq_num);
- typedef struct
- {
- list_entry_t list;
- irq_handler_proc_t procedure;
- bool_t exclusive;
- } irq_handler_t;
- dword_t register_irq_handler(byte_t irq_num, irq_handler_proc_t handler_proc, bool_t exclusive);
- dword_t unregister_irq_handler(byte_t irq_num, irq_handler_proc_t handler_proc);
- byte_t alloc_irq();
- void free_irq(byte_t number);
- void irq_init();
- #endif
|