-
Notifications
You must be signed in to change notification settings - Fork 5
/
plat.h
35 lines (25 loc) · 925 Bytes
/
plat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef PLAT_H
#define PLAT_H
#define IRQ_PIT 0
#define IRQ_PS2 1
#include "x86.h"
void pic_init(void);
void pic_send_EOI(uint32_t);
void pic_disable(void);
void pit_init(uint32_t frequency);
void irq_install_handler(int irq, void (*handler)(void));
#define plat_reboot() out8(0x64, 0xFE)
#define plat_hide_cursor() out16(0x3D4,0x200A)
void irq_register_handler(int irq, void (*handler)(x86_iframe_t*));
void irq_unregister_handler(int irq);
void handle_platform_irq(x86_iframe_t* frame);
void sys_key_handler(x86_iframe_t* frame);
void sys_tick_handler(x86_iframe_t* frame);
extern void terminal_init();
extern void terminal_putchar(char c);
extern void terminal_putchar_color(char c, uint8_t text_color, uint8_t background_color);
extern void terminal_tick_init(uint8_t n);
extern void terminal_keypress_init(uint8_t n);
extern void terminal_tick(char c);
extern void terminal_keypress(uint8_t scan_code);
#endif