63 lines
911 B
C
63 lines
911 B
C
#pragma once
|
|
|
|
#include <lcrash/types.h>
|
|
|
|
/**
|
|
* A specific IRQ gate
|
|
* \internal
|
|
*/
|
|
struct IrqHandlerGate;
|
|
|
|
/**
|
|
* A hook called on an interrupt
|
|
*/
|
|
struct IrqHandlerHook {
|
|
/// Higher priority values called first
|
|
u32 Priority;
|
|
|
|
/**
|
|
* The hook itself.
|
|
*
|
|
* \return 1 to cancel uncalled hooks
|
|
* 0 on success
|
|
* -1 on failure
|
|
*/
|
|
s32 (*HookCall)();
|
|
|
|
/**
|
|
* Next hook
|
|
* \internal
|
|
*/
|
|
struct IrqHandlerHook* Next;
|
|
|
|
/**
|
|
* Attached gate
|
|
* \internal
|
|
*/
|
|
struct IrqHandlerGate* Gate;
|
|
};
|
|
|
|
/**
|
|
* Initialize the IRQ handler
|
|
*
|
|
* \return 0 on success
|
|
*/
|
|
s32 IrqHandlerInitialize();
|
|
|
|
/**
|
|
* Hook an interrupt
|
|
*
|
|
* \return 0 on success
|
|
*/
|
|
s32 IrqHandlerAttach(u8 Gate, struct IrqHandlerHook* Hook);
|
|
|
|
/**
|
|
* Remove a hook
|
|
*
|
|
* \return 0 on success
|
|
*/
|
|
s32 IrqHandlerDetach(struct IrqHandlerHook* Hook);
|
|
|
|
void IrqHandlerDisableInterrupts();
|
|
void IrqHandlerEnableInterrupts();
|