dat.h (1427B)
1 #ifndef DAT_H 2 #define DAT_H 3 4 /* vga */ 5 #define VGA_WIDTH 80 6 #define VGA_HEIGHT 25 7 #define VGA_START 0xB8000 8 #define VGA_CTRL 0x3D4 9 #define VGA_DATA 0x3D5 10 11 enum vga_color { 12 VGA_COLOR_BLACK = 0, 13 VGA_COLOR_BLUE = 1, 14 VGA_COLOR_GREEN = 2, 15 VGA_COLOR_CYAN = 3, 16 VGA_COLOR_RED = 4, 17 VGA_COLOR_MAGENTA = 5, 18 VGA_COLOR_BROWN = 6, 19 VGA_COLOR_LIGHT_GREY = 7, 20 VGA_COLOR_DARK_GREY = 8, 21 VGA_COLOR_LIGHT_BLUE = 9, 22 VGA_COLOR_LIGHT_GREEN = 10, 23 VGA_COLOR_LIGHT_CYAN = 11, 24 VGA_COLOR_LIGHT_RED = 12, 25 VGA_COLOR_LIGHT_MAGENTA = 13, 26 VGA_COLOR_LIGHT_BROWN = 14, 27 VGA_COLOR_WHITE = 15, 28 }; 29 30 /* idt */ 31 typedef struct { 32 uint16_t isr_low; /* the lower 16 bits of the isr's address */ 33 uint16_t kernel_cs; /* the gdt segment selector that the cpu will load into cs before calling the isr */ 34 uint8_t reserved; /* set to zero */ 35 uint8_t attr; /* type and attributes; see the idt page */ 36 uint16_t isr_high; /* the higher 16 bits of the isr's address */ 37 } __attribute__((packed)) idt_entry_t; 38 39 typedef struct { 40 uint16_t limit; 41 uint32_t base; 42 } __attribute__((packed)) idtr_t; 43 44 typedef void (*int_handler)(); 45 46 #define ICW_1 0x11 47 48 #define PIC_1 0x20 49 #define PIC_2 0xa0 50 #define PIC_1_COMM PIC_1 51 #define PIC_1_DATA (PIC_1+1) 52 #define PIC_2_COMM PIC_2 53 #define PIC_2_DATA (PIC_2+1) 54 55 #define IRQ_0 0x20 56 #define IRQ_8 0x28 57 58 /* pit */ 59 #define PIT_CHAN0 0x40 60 #define PIT_COMM 0x43 61 #define PIT_BASE_FREQ 1193182 62 63 #endif /* DAT_H */