Changeset 018f95a in mainline for arch/ia32/src/drivers/ega.c
- Timestamp:
- 2006-05-31T19:50:17Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 41d33ac
- Parents:
- 39031cc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/drivers/ega.c
r39031cc r018f95a 27 27 */ 28 28 29 #include <arch/ ega.h>29 #include <arch/drivers/ega.h> 30 30 #include <putchar.h> 31 31 #include <mm/page.h> … … 38 38 #include <console/chardev.h> 39 39 #include <console/console.h> 40 #include <sysinfo/sysinfo.h> 40 41 41 42 /* … … 46 47 SPINLOCK_INITIALIZE(egalock); 47 48 static __u32 ega_cursor; 49 static __u8 *videoram; 48 50 49 51 static void ega_putchar(chardev_t *d, const char ch); … … 59 61 { 60 62 __u8 hi, lo; 61 62 page_mapping_insert(AS_KERNEL, PA2KA(VIDEORAM), VIDEORAM, PAGE_NOT_CACHEABLE);63 outb(0x3d4, 0xe);63 64 videoram = (__u8 *) hw_map(VIDEORAM, SCREEN * 2); 65 outb(0x3d4, 0xe); 64 66 hi = inb(0x3d5); 65 outb(0x3d4, 0xf);67 outb(0x3d4, 0xf); 66 68 lo = inb(0x3d5); 67 ega_cursor = (hi <<8)|lo;69 ega_cursor = (hi << 8) | lo; 68 70 69 71 chardev_initialize("ega_out", &ega_console, &ega_ops); 70 72 stdout = &ega_console; 71 73 74 sysinfo_set_item_val("fb", NULL, true); 75 sysinfo_set_item_val("fb.kind", NULL, 2); 76 sysinfo_set_item_val("fb.width", NULL, ROW); 77 sysinfo_set_item_val("fb.height", NULL, ROWS); 78 sysinfo_set_item_val("fb.address.physical", NULL, VIDEORAM); 79 72 80 #ifndef CONFIG_FB 73 81 putchar('\n'); … … 77 85 static void ega_display_char(char ch) 78 86 { 79 __u8 *vram = (__u8 *) PA2KA(VIDEORAM); 80 81 vram[ega_cursor*2] = ch; 87 videoram[ega_cursor * 2] = ch; 82 88 } 83 89 … … 90 96 return; 91 97 92 memcpy((void *) PA2KA(VIDEORAM), (void *)(PA2KA(VIDEORAM) + ROW*2), (SCREEN - ROW)*2);93 memsetw( PA2KA(VIDEORAM) + (SCREEN - ROW)*2, ROW, 0x0720);98 memcpy((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2); 99 memsetw((__address) (videoram + (SCREEN - ROW) * 2), ROW, 0x0720); 94 100 ega_cursor = ega_cursor - ROW; 95 101 } … … 103 109 104 110 switch (ch) { 105 case '\n':106 ega_cursor = (ega_cursor + ROW) - ega_cursor % ROW;107 break;108 case '\t':109 ega_cursor = (ega_cursor + 8) - ega_cursor % 8;110 break;111 case '\b':112 if (ega_cursor % ROW)113 ega_cursor--;114 break;115 default:116 ega_display_char(ch);117 ega_cursor++;118 break;119 111 case '\n': 112 ega_cursor = (ega_cursor + ROW) - ega_cursor % ROW; 113 break; 114 case '\t': 115 ega_cursor = (ega_cursor + 8) - ega_cursor % 8; 116 break; 117 case '\b': 118 if (ega_cursor % ROW) 119 ega_cursor--; 120 break; 121 default: 122 ega_display_char(ch); 123 ega_cursor++; 124 break; 125 } 120 126 ega_check_cursor(); 121 127 ega_move_cursor(); … … 127 133 void ega_move_cursor(void) 128 134 { 129 outb(0x3d4, 0xe);130 outb(0x3d5, (ega_cursor>>8)&0xff);131 outb(0x3d4, 0xf);132 outb(0x3d5, ega_cursor&0xff);135 outb(0x3d4, 0xe); 136 outb(0x3d5, (ega_cursor >> 8) & 0xff); 137 outb(0x3d4, 0xf); 138 outb(0x3d5, ega_cursor & 0xff); 133 139 }
Note:
See TracChangeset
for help on using the changeset viewer.