|
PatchworkOS
|
Interrupt Request handling. More...
Data Structures | |
| struct | irq_callback_t |
| Structure to hold an IRQ callback and its data. More... | |
| struct | irq_handler_t |
| Structure to hold all callbacks for an IRQ. More... | |
Macros | |
| #define | IRQ_MAX_CALLBACK 16 |
| Maximum amount of callbacks per IRQ. | |
Typedefs | |
| typedef void(* | irq_callback_func_t) (irq_t irq, void *data) |
| Callback function type for IRQs. | |
Enumerations | |
| enum | irq_t { IRQ_PIT = 0x0 , IRQ_PS2_FIRST_DEVICE = 0x1 , IRQ_CASCADE = 0x2 , IRQ_COM2 = 0x3 , IRQ_COM1 = 0x4 , IRQ_LPT2 = 0x5 , IRQ_FLOPPY = 0x6 , IRQ_LPT1 = 0x7 , IRQ_CMOS = 0x8 , IRQ_FREE1 = 0x9 , IRQ_FREE2 = 0xA , IRQ_FREE3 = 0xB , IRQ_PS2_SECOND_DEVICE = 0xC , IRQ_FPU = 0xD , IRQ_PRIMARY_ATA_HARD_DRIVE = 0xE , IRQ_SECONDARY_ATA_HARD_DRIVE = 0xF , IRQ_AMOUNT = 0x10 } |
| IRQ numbers. More... | |
Functions | |
| void | irq_dispatch (interrupt_frame_t *frame) |
| Dispatch an IRQ. | |
| void | irq_install (irq_t irq, irq_callback_func_t func, void *data) |
| Install an IRQ handler. | |
| void | irq_uninstall (irq_t irq, irq_callback_func_t func) |
| Uninstall an IRQ handler. | |
Interrupt Request handling.
| #define IRQ_MAX_CALLBACK 16 |
| enum irq_t |
| void irq_dispatch | ( | interrupt_frame_t * | frame | ) |
Dispatch an IRQ.
This function is called from interrupt_handler() when an IRQ is received. It will call all registered callbacks for the IRQ.
| frame | The interrupt frame of the IRQ. |
Definition at line 13 of file irq.c.
References irq_handler_t::callbackAmount, irq_handler_t::callbacks, irq_callback_t::data, EXTERNAL_INTERRUPT_BASE, irq_callback_t::func, handlers, lapic_eoi(), lock, LOG_WARN, NULL, RWLOCK_READ_SCOPE, and interrupt_frame_t::vector.
Referenced by interrupt_handler().
| void irq_install | ( | irq_t | irq, |
| irq_callback_func_t | func, | ||
| void * | data | ||
| ) |
Install an IRQ handler.
Installs the provided callback function to be called when the specified IRQ is received. The data pointer will be passed to the callback when it is called.
If the interrupt has not yet been redirected the ioapic will be set to redirect the vector.
| irq | The IRQ number to install the handler for. |
| func | The callback function to call when the IRQ is received. |
| data | The data pointer to pass to the callback function. |
Definition at line 39 of file irq.c.
References irq_handler_t::callbackAmount, irq_handler_t::callbacks, irq_callback_t::data, data, EXTERNAL_INTERRUPT_BASE, irq_callback_t::func, handlers, IOAPIC_DELIVERY_NORMAL, IOAPIC_POLARITY_HIGH, ioapic_set_redirect(), IOAPIC_TRIGGER_EDGE, IRQ_MAX_CALLBACK, lock, LOG_INFO, NULL, panic(), irq_handler_t::redirected, RWLOCK_WRITE_SCOPE, and smp_self_unsafe().
Referenced by ps2_kbd_init(), and ps2_mouse_init().
| void irq_uninstall | ( | irq_t | irq, |
| irq_callback_func_t | func | ||
| ) |
Uninstall an IRQ handler.
Uninstalls the provided callback function from the specified IRQ. If the function is not found, nothing happens.
| irq | The IRQ number to uninstall the handler from. |
| func | The callback function to uninstall. |
Definition at line 63 of file irq.c.
References irq_handler_t::callbackAmount, irq_handler_t::callbacks, irq_callback_t::data, irq_callback_t::func, handlers, IRQ_MAX_CALLBACK, lock, LOG_INFO, NULL, and RWLOCK_WRITE_SCOPE.