dat.h (1450B)
1 #ifndef dat_h 2 #define dat_h 3 4 #include "oxytoxin.h" 5 6 /* vga */ 7 #define vga_width 80 8 #define vga_height 25 9 #define vga_start 0xb8000 10 #define vga_ctrl 0x3d4 11 #define vga_data 0x3d5 12 13 enum vga_color { 14 vga_color_black = 0, 15 vga_color_blue = 1, 16 vga_color_green = 2, 17 vga_color_cyan = 3, 18 vga_color_red = 4, 19 vga_color_magenta = 5, 20 vga_color_brown = 6, 21 vga_color_light_grey = 7, 22 vga_color_dark_grey = 8, 23 vga_color_light_blue = 9, 24 vga_color_light_green = 10, 25 vga_color_light_cyan = 11, 26 vga_color_light_red = 12, 27 vga_color_light_magenta = 13, 28 vga_color_light_brown = 14, 29 vga_color_white = 15, 30 }; 31 32 /* idt */ 33 typedef struct { 34 uint16_t isr_low; /* the lower 16 bits of the isr's address */ 35 uint16_t kernel_cs; /* the gdt segment selector that the cpu will load into cs before calling the isr */ 36 uint8_t reserved; /* set to zero */ 37 uint8_t attr; /* type and attributes; see the idt page */ 38 uint16_t isr_high; /* the higher 16 bits of the isr's address */ 39 } __attribute__((packed)) idt_entry_t; 40 41 typedef struct { 42 uint16_t limit; 43 uint32_t base; 44 } __attribute__((packed)) idtr_t; 45 46 typedef void (*int_handler)(); 47 48 #define icw_1 0x11 49 50 #define pic_1 0x20 51 #define pic_2 0xa0 52 #define pic_1_comm pic_1 53 #define pic_1_data (pic_1+1) 54 #define pic_2_comm pic_2 55 #define pic_2_data (pic_2+1) 56 57 #define irq_0 0x20 58 #define irq_8 0x28 59 60 /* pit */ 61 #define pit_chan0 0x40 62 #define pit_comm 0x43 63 #define pit_base_freq 1193182 64 65 #endif /* dat_h */