Rev 4343 | Rev 4347 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4343 | Rev 4345 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | #include <ipc/ns.h> |
49 | #include <ipc/ns.h> |
50 | #include <ipc/services.h> |
50 | #include <ipc/services.h> |
51 | #include <libarch/ddi.h> |
51 | #include <libarch/ddi.h> |
52 | #include <console/style.h> |
52 | #include <console/style.h> |
53 | #include <console/color.h> |
53 | #include <console/color.h> |
- | 54 | #include <sys/types.h> |
|
54 | 55 | ||
55 | #include "ega.h" |
56 | #include "ega.h" |
56 | #include "../console/screenbuffer.h" |
57 | #include "../console/screenbuffer.h" |
57 | #include "main.h" |
58 | #include "main.h" |
58 | 59 | ||
Line 61... | Line 62... | ||
61 | short *data; |
62 | short *data; |
62 | } saved_screen; |
63 | } saved_screen; |
63 | 64 | ||
64 | saved_screen saved_screens[MAX_SAVED_SCREENS]; |
65 | saved_screen saved_screens[MAX_SAVED_SCREENS]; |
65 | 66 | ||
66 | #define EGA_IO_ADDRESS 0x3d4 |
67 | #define EGA_IO_BASE ((ioport8_t *) 0x3d4) |
67 | #define EGA_IO_SIZE 2 |
68 | #define EGA_IO_SIZE 2 |
68 | 69 | ||
69 | int ega_normal_color = 0x0f; |
70 | int ega_normal_color = 0x0f; |
70 | int ega_inverted_color = 0xf0; |
71 | int ega_inverted_color = 0xf0; |
71 | 72 | ||
Line 97... | Line 98... | ||
97 | { |
98 | { |
98 | int ega_cursor; |
99 | int ega_cursor; |
99 | 100 | ||
100 | ega_cursor = col + scr_width * row; |
101 | ega_cursor = col + scr_width * row; |
101 | 102 | ||
102 | outb(EGA_IO_ADDRESS, 0xe); |
103 | pio_write_8(EGA_IO_BASE, 0xe); |
103 | outb(EGA_IO_ADDRESS + 1, (ega_cursor >> 8) & 0xff); |
104 | pio_write_8(EGA_IO_BASE + 1, (ega_cursor >> 8) & 0xff); |
104 | outb(EGA_IO_ADDRESS, 0xf); |
105 | pio_write_8(EGA_IO_BASE, 0xf); |
105 | outb(EGA_IO_ADDRESS + 1, ega_cursor & 0xff); |
106 | pio_write_8(EGA_IO_BASE + 1, ega_cursor & 0xff); |
106 | } |
107 | } |
107 | 108 | ||
108 | static void cursor_disable(void) |
109 | static void cursor_disable(void) |
109 | { |
110 | { |
110 | uint8_t stat; |
111 | uint8_t stat; |
111 | 112 | ||
112 | outb(EGA_IO_ADDRESS, 0xa); |
113 | pio_write_8(EGA_IO_BASE, 0xa); |
113 | stat=inb(EGA_IO_ADDRESS + 1); |
114 | stat = pio_read_8(EGA_IO_BASE + 1); |
114 | outb(EGA_IO_ADDRESS, 0xa); |
115 | pio_write_8(EGA_IO_BASE, 0xa); |
115 | outb(EGA_IO_ADDRESS + 1, stat | (1 << 5)); |
116 | pio_write_8(EGA_IO_BASE + 1, stat | (1 << 5)); |
116 | } |
117 | } |
117 | 118 | ||
118 | static void cursor_enable(void) |
119 | static void cursor_enable(void) |
119 | { |
120 | { |
120 | uint8_t stat; |
121 | uint8_t stat; |
121 | 122 | ||
122 | outb(EGA_IO_ADDRESS, 0xa); |
123 | pio_write_8(EGA_IO_BASE, 0xa); |
123 | stat=inb(EGA_IO_ADDRESS + 1); |
124 | stat = pio_read_8(EGA_IO_BASE + 1); |
124 | outb(EGA_IO_ADDRESS, 0xa); |
125 | pio_write_8(EGA_IO_BASE, 0xa); |
125 | outb(EGA_IO_ADDRESS + 1, stat & (~(1 << 5))); |
126 | pio_write_8(EGA_IO_BASE + 1, stat & (~(1 << 5))); |
126 | } |
127 | } |
127 | 128 | ||
128 | static void scroll(int rows) |
129 | static void scroll(int rows) |
129 | { |
130 | { |
130 | int i; |
131 | int i; |
Line 312... | Line 313... | ||
312 | } |
313 | } |
313 | scroll(i); |
314 | scroll(i); |
314 | retval = 0; |
315 | retval = 0; |
315 | break; |
316 | break; |
316 | case FB_CURSOR_VISIBILITY: |
317 | case FB_CURSOR_VISIBILITY: |
317 | if(IPC_GET_ARG1(call)) |
318 | if (IPC_GET_ARG1(call)) |
318 | cursor_enable(); |
319 | cursor_enable(); |
319 | else |
320 | else |
320 | cursor_disable(); |
321 | cursor_disable(); |
321 | retval = 0; |
322 | retval = 0; |
322 | break; |
323 | break; |
Line 378... | Line 379... | ||
378 | ega_inverted_color &= 0x77; |
379 | ega_inverted_color &= 0x77; |
379 | } |
380 | } |
380 | 381 | ||
381 | style = NORMAL_COLOR; |
382 | style = NORMAL_COLOR; |
382 | 383 | ||
383 | iospace_enable(task_get_id(), (void *) EGA_IO_ADDRESS, 2); |
384 | iospace_enable(task_get_id(), (void *) EGA_IO_BASE, 2); |
384 | 385 | ||
385 | sz = scr_width * scr_height * 2; |
386 | sz = scr_width * scr_height * 2; |
386 | scr_addr = as_get_mappable_page(sz); |
387 | scr_addr = as_get_mappable_page(sz); |
387 | 388 | ||
388 | if (physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >> |
389 | if (physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >> |
Line 393... | Line 394... | ||
393 | 394 | ||
394 | return 0; |
395 | return 0; |
395 | } |
396 | } |
396 | 397 | ||
397 | 398 | ||
398 | /** |
399 | /** |
399 | * @} |
400 | * @} |
400 | */ |
401 | */ |