Rev 3994 | Rev 4177 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3994 | Rev 4093 | ||
|---|---|---|---|
| Line 58... | Line 58... | ||
| 58 | static uint32_t ega_cursor; |
58 | static uint32_t ega_cursor; |
| 59 | static uint8_t *videoram; |
59 | static uint8_t *videoram; |
| 60 | static uint8_t *backbuf; |
60 | static uint8_t *backbuf; |
| 61 | static ioport8_t *ega_base; |
61 | static ioport8_t *ega_base; |
| 62 | 62 | ||
| - | 63 | #define SPACE 0x20 |
|
| 63 | #define EMPTY_CHAR 0x0720 |
64 | #define STYLE 0x07 |
| 64 | 65 | ||
| 65 | chardev_t ega_console; |
66 | #define EMPTY_CHAR (STYLE << 8 | SPACE) |
| 66 | 67 | ||
| 67 | /* |
68 | /* |
| 68 | * This function takes care of scrolling. |
69 | * This function takes care of scrolling. |
| 69 | */ |
70 | */ |
| 70 | static void ega_check_cursor(void) |
71 | static void ega_check_cursor(void) |
| Line 121... | Line 122... | ||
| 121 | } |
122 | } |
| 122 | 123 | ||
| 123 | static void ega_display_char(char ch, bool silent) |
124 | static void ega_display_char(char ch, bool silent) |
| 124 | { |
125 | { |
| 125 | backbuf[ega_cursor * 2] = ch; |
126 | backbuf[ega_cursor * 2] = ch; |
| - | 127 | backbuf[ega_cursor * 2 + 1] = STYLE; |
|
| 126 | 128 | ||
| 127 | if (!silent) |
129 | if (!silent) { |
| 128 | videoram[ega_cursor * 2] = ch; |
130 | videoram[ega_cursor * 2] = ch; |
| - | 131 | videoram[ega_cursor * 2 + 1] = STYLE; |
|
| - | 132 | } |
|
| 129 | } |
133 | } |
| 130 | 134 | ||
| 131 | static void ega_putchar(chardev_t *dev __attribute__((unused)), const char ch, bool silent) |
135 | static void ega_putchar(outdev_t *dev __attribute__((unused)), const char ch, bool silent) |
| 132 | { |
136 | { |
| 133 | ipl_t ipl; |
137 | ipl_t ipl; |
| 134 | 138 | ||
| 135 | ipl = interrupts_disable(); |
139 | ipl = interrupts_disable(); |
| 136 | spinlock_lock(&egalock); |
140 | spinlock_lock(&egalock); |
| Line 158... | Line 162... | ||
| 158 | 162 | ||
| 159 | spinlock_unlock(&egalock); |
163 | spinlock_unlock(&egalock); |
| 160 | interrupts_restore(ipl); |
164 | interrupts_restore(ipl); |
| 161 | } |
165 | } |
| 162 | 166 | ||
| - | 167 | static outdev_t ega_console; |
|
| 163 | static chardev_operations_t ega_ops = { |
168 | static outdev_operations_t ega_ops = { |
| 164 | .write = ega_putchar |
169 | .write = ega_putchar |
| 165 | }; |
170 | }; |
| 166 | 171 | ||
| 167 | void ega_init(ioport8_t *base, uintptr_t videoram_phys) |
172 | void ega_init(ioport8_t *base, uintptr_t videoram_phys) |
| 168 | { |
173 | { |
| Line 177... | Line 182... | ||
| 177 | 182 | ||
| 178 | /* Synchronize the back buffer and cursor position. */ |
183 | /* Synchronize the back buffer and cursor position. */ |
| 179 | memcpy(backbuf, videoram, EGA_VRAM_SIZE); |
184 | memcpy(backbuf, videoram, EGA_VRAM_SIZE); |
| 180 | ega_sync_cursor(); |
185 | ega_sync_cursor(); |
| 181 | 186 | ||
| 182 | chardev_initialize("ega_out", &ega_console, &ega_ops); |
187 | outdev_initialize("ega", &ega_console, &ega_ops); |
| 183 | stdout = &ega_console; |
188 | stdout = &ega_console; |
| 184 | 189 | ||
| 185 | sysinfo_set_item_val("fb", NULL, true); |
190 | sysinfo_set_item_val("fb", NULL, true); |
| 186 | sysinfo_set_item_val("fb.kind", NULL, 2); |
191 | sysinfo_set_item_val("fb.kind", NULL, 2); |
| 187 | sysinfo_set_item_val("fb.width", NULL, EGA_COLS); |
192 | sysinfo_set_item_val("fb.width", NULL, EGA_COLS); |