oxytoxin

unix-like kernel
git clone git://git.evenfri.xyz/oxytoxin.git
Log | Files | Refs | README | LICENSE

fns.h (1065B)


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