Changeset f245145 in mainline for kernel/genarch/src/drivers/ega/ega.c
- Timestamp:
- 2009-01-04T14:07:27Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a45752d
- Parents:
- 44ff4fb
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ega/ega.c
r44ff4fb rf245145 27 27 */ 28 28 29 /** @addtogroup ia3229 /** @addtogroup genarch_drivers 30 30 * @{ 31 31 */ … … 35 35 */ 36 36 37 #include < arch/drivers/ega.h>37 #include <genarch/drivers/ega/ega.h> 38 38 #include <putchar.h> 39 39 #include <mm/page.h> … … 61 61 static uint8_t *videoram; 62 62 static uint8_t *backbuf; 63 static ioport_t ega_base; 63 64 64 65 static void ega_putchar(chardev_t *d, const char ch); … … 71 72 static void ega_move_cursor(void); 72 73 73 void ega_init( void)74 void ega_init(ioport_t base, uintptr_t videoram_phys) 74 75 { 75 uint8_t hi, lo; 76 /* Initialize the software structure. */ 77 ega_base = base; 76 78 77 79 backbuf = (uint8_t *) malloc(SCREEN * 2, 0); … … 79 81 panic("Unable to allocate backbuffer.\n"); 80 82 81 videoram = (uint8_t *) hw_map( VIDEORAM, SCREEN * 2);82 outb(0x3d4, 0xe);83 hi = inb(0x3d5);84 outb(0x3d4, 0xf);85 lo = inb(0x3d5);86 ega_ cursor = (hi << 8) | lo;83 videoram = (uint8_t *) hw_map(videoram_phys, SCREEN * 2); 84 85 /* Clear the screen and set the cursor position. */ 86 memsetw(videoram, SCREEN, 0x0720); 87 memsetw(backbuf, SCREEN, 0x0720); 88 ega_move_cursor(); 87 89 88 90 chardev_initialize("ega_out", &ega_console, &ega_ops); 89 91 stdout = &ega_console; 90 92 91 ega_parea.pbase = VIDEORAM;93 ega_parea.pbase = videoram_phys; 92 94 ega_parea.vbase = (uintptr_t) videoram; 93 95 ega_parea.frames = 1; … … 99 101 sysinfo_set_item_val("fb.width", NULL, ROW); 100 102 sysinfo_set_item_val("fb.height", NULL, ROWS); 101 sysinfo_set_item_val("fb.address.physical", NULL, VIDEORAM); 103 sysinfo_set_item_val("fb.blinking", NULL, true); 104 sysinfo_set_item_val("fb.address.physical", NULL, videoram_phys); 102 105 } 103 106 … … 116 119 return; 117 120 118 memmove((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2); 119 memmove((void *) backbuf, (void *) (backbuf + ROW * 2), (SCREEN - ROW) * 2); 121 memmove((void *) videoram, (void *) (videoram + ROW * 2), 122 (SCREEN - ROW) * 2); 123 memmove((void *) backbuf, (void *) (backbuf + ROW * 2), 124 (SCREEN - ROW) * 2); 120 125 memsetw(videoram + (SCREEN - ROW) * 2, ROW, 0x0720); 121 126 memsetw(backbuf + (SCREEN - ROW) * 2, ROW, 0x0720); … … 155 160 void ega_move_cursor(void) 156 161 { 157 outb( 0x3d4, 0xe);158 outb( 0x3d5, (uint8_t) ((ega_cursor >> 8) & 0xff));159 outb( 0x3d4, 0xf);160 outb( 0x3d5, (uint8_t) (ega_cursor & 0xff));162 outb(ega_base + EGA_INDEX_REG, 0xe); 163 outb(ega_base + EGA_DATA_REG, (uint8_t) ((ega_cursor >> 8) & 0xff)); 164 outb(ega_base + EGA_INDEX_REG, 0xf); 165 outb(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff)); 161 166 } 162 167
Note:
See TracChangeset
for help on using the changeset viewer.