Rev 1754 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1754 | Rev 1780 | ||
|---|---|---|---|
| Line 51... | Line 51... | ||
| 51 | * The EGA driver. |
51 | * The EGA driver. |
| 52 | * Simple and short. Function for displaying characters and "scrolling". |
52 | * Simple and short. Function for displaying characters and "scrolling". |
| 53 | */ |
53 | */ |
| 54 | 54 | ||
| 55 | SPINLOCK_INITIALIZE(egalock); |
55 | SPINLOCK_INITIALIZE(egalock); |
| 56 | static __u32 ega_cursor; |
56 | static uint32_t ega_cursor; |
| 57 | static __u8 *videoram; |
57 | static uint8_t *videoram; |
| 58 | 58 | ||
| 59 | static void ega_putchar(chardev_t *d, const char ch); |
59 | static void ega_putchar(chardev_t *d, const char ch); |
| 60 | 60 | ||
| 61 | chardev_t ega_console; |
61 | chardev_t ega_console; |
| 62 | static chardev_operations_t ega_ops = { |
62 | static chardev_operations_t ega_ops = { |
| Line 65... | Line 65... | ||
| 65 | 65 | ||
| 66 | void ega_move_cursor(void); |
66 | void ega_move_cursor(void); |
| 67 | 67 | ||
| 68 | void ega_init(void) |
68 | void ega_init(void) |
| 69 | { |
69 | { |
| 70 | __u8 hi, lo; |
70 | uint8_t hi, lo; |
| 71 | 71 | ||
| 72 | videoram = (__u8 *) hw_map(VIDEORAM, SCREEN * 2); |
72 | videoram = (uint8_t *) hw_map(VIDEORAM, SCREEN * 2); |
| 73 | outb(0x3d4, 0xe); |
73 | outb(0x3d4, 0xe); |
| 74 | hi = inb(0x3d5); |
74 | hi = inb(0x3d5); |
| 75 | outb(0x3d4, 0xf); |
75 | outb(0x3d4, 0xf); |
| 76 | lo = inb(0x3d5); |
76 | lo = inb(0x3d5); |
| 77 | ega_cursor = (hi << 8) | lo; |
77 | ega_cursor = (hi << 8) | lo; |
| Line 102... | Line 102... | ||
| 102 | { |
102 | { |
| 103 | if (ega_cursor < SCREEN) |
103 | if (ega_cursor < SCREEN) |
| 104 | return; |
104 | return; |
| 105 | 105 | ||
| 106 | memcpy((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2); |
106 | memcpy((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2); |
| 107 | memsetw((__address) (videoram + (SCREEN - ROW) * 2), ROW, 0x0720); |
107 | memsetw((uintptr_t) (videoram + (SCREEN - ROW) * 2), ROW, 0x0720); |
| 108 | ega_cursor = ega_cursor - ROW; |
108 | ega_cursor = ega_cursor - ROW; |
| 109 | } |
109 | } |
| 110 | 110 | ||
| 111 | void ega_putchar(chardev_t *d, const char ch) |
111 | void ega_putchar(chardev_t *d, const char ch) |
| 112 | { |
112 | { |