diff options
Diffstat (limited to 'kernel/inc/hal.h')
| -rw-r--r-- | kernel/inc/hal.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/kernel/inc/hal.h b/kernel/inc/hal.h new file mode 100644 index 0000000..9a52a4e --- /dev/null +++ b/kernel/inc/hal.h @@ -0,0 +1,104 @@ +//+---------------------------------------------------------------------------- +// +// File: hal.h +// +// Module: +// +// Synopsis: +// +// Created: sgasch 5 Jul 2003 +// +//+---------------------------------------------------------------------------- +#ifndef HAL_H +#define HAL_H + +// +// Video/CRT driver +// +#define BLACK (0) +#define BLUE (1) +#define GREEN (2) +#define CYAN (3) +#define RED (4) +#define MAGENTA (5) +#define YELLOW (6) +#define GRAY (7) +#define HIGH (8) +#define WHITE (HIGH | GRAY) + +void +HalVideoSetCurrentColorAttribute(BYTE bFg, BYTE bBg); + +void +HalVideoClearScreen(void); + +void +HalVideoGetCursorPosition(BYTE *pbLine, BYTE *pbCol); + +void +HalVideoSetCursorPosition(BYTE bLine, BYTE bCol); + +void +HalVideoPutNullTerminatedString(BYTE *s); + +void +HalVideoInitialize(BIOS_HARDWARE_BLOCK *phw); + +void +HalVideoPrint(CHAR *szFormat, ...); + +// +// Keyboard driver +// +#define KB_IRQ (1) +typedef WORD KEYCODE; + +typedef struct _INTERRUPT_STATE +{ + // The register contents at the time of the exception. + // We save these explicitly. + ULONG gs; + ULONG fs; + ULONG es; + ULONG ds; + ULONG ebp; + ULONG edi; + ULONG esi; + ULONG edx; + ULONG ecx; + ULONG ebx; + ULONG eax; + + // We explicitly push the interrupt number. + // This makes it easy for the handler function to determine + // which interrupt occurred. + ULONG uIntNum; + + // This may be pushed by the processor; if not, we push + // a dummy error code, so the stack layout is the same + // for every type of interrupt. + ULONG uErrorCode; + + // These are always pushed on the stack by the processor. + ULONG eip; + ULONG cs; + ULONG eflags; +} +INTERRUPT_STATE; + +typedef void (*INTERRUPT_HANDLER)(INTERRUPT_STATE *pState); + +void HalInitializeInterrupts(void); +void HalInterruptInstallHandler(ULONG uIntNum, INTERRUPT_HANDLER p); +void HalInterruptDisable(); +void HalInterruptEnable(); + +void HalIoDelay(); + +void HalTimerInt(INTERRUPT_STATE *p); +void HalKeyboardInt(INTERRUPT_STATE *p); + +extern UINT64 g_ullTimeStampCounter; +ULONG HalReadTimestampCounter(void); + +#endif // HAL_H |
