fns.h (1042B)
1 #ifndef FNS_H 2 #define FNS_H 3 4 /* input/output ports */ 5 extern void outb(uint16_t port, uint8_t val); 6 extern void outw(uint16_t port, uint16_t val); 7 8 extern uint8_t inb(uint16_t port); 9 extern uint16_t inw(uint16_t port); 10 11 extern void io_wait(void); 12 13 /* vga */ 14 static inline uint8_t vga_entry_color(enum vga_color fg, enum vga_color bg) { 15 return fg | bg << 4; 16 } 17 18 static inline uint16_t vga_entry(unsigned char uc, uint8_t color) { 19 return (uint16_t) uc | (uint16_t) color << 8; 20 } 21 22 /* vga cursor */ 23 void vga_cursor_enable(uint8_t s, uint8_t e); 24 void vga_cursor_disable(void); 25 void vga_cursor_update(int x, int y); 26 uint16_t vga_cursor_get_pos(void); 27 28 /* tty */ 29 void tty_init(void); 30 void tty_set_color(uint8_t color); 31 void tty_clear(void); 32 void tty_putchar(char c); 33 void tty_write(const char* data, size_t size); 34 35 /* gdt */ 36 extern void gdt_init(void); 37 38 /* idt */ 39 void idt_register(unsigned char vec, int_handler handler); 40 void idt_init(void); 41 42 /* pit */ 43 void pit_init(uint32_t freq); 44 void pit_sleep(uint32_t ticks_to_wait); 45 46 #endif /* FNS_H */