Changeset c214a65 in mainline for kernel/genarch/src/drivers/ega/ega.c
- Timestamp:
- 2009-02-27T13:30:20Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dbaaf0a
- Parents:
- c1f7f6ea
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ega/ega.c
rc1f7f6ea rc214a65 80 80 } 81 81 82 static void ega_show_cursor(void) 83 { 84 pio_write_8(ega_base + EGA_INDEX_REG, 0x0a); 85 uint8_t stat = pio_read_8(ega_base + EGA_DATA_REG); 86 pio_write_8(ega_base + EGA_INDEX_REG, 0x0a); 87 pio_write_8(ega_base + EGA_DATA_REG, stat & (~(1 << 5))); 88 } 89 82 90 static void ega_move_cursor(void) 83 91 { 84 pio_write_8(ega_base + EGA_INDEX_REG, 0x e);92 pio_write_8(ega_base + EGA_INDEX_REG, 0x0e); 85 93 pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) ((ega_cursor >> 8) & 0xff)); 86 pio_write_8(ega_base + EGA_INDEX_REG, 0x f);94 pio_write_8(ega_base + EGA_INDEX_REG, 0x0f); 87 95 pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff)); 96 } 97 98 static void ega_sync_cursor(void) 99 { 100 pio_write_8(ega_base + EGA_INDEX_REG, 0x0e); 101 uint8_t hi = pio_read_8(ega_base + EGA_DATA_REG); 102 pio_write_8(ega_base + EGA_INDEX_REG, 0x0f); 103 uint8_t lo = pio_read_8(ega_base + EGA_DATA_REG); 104 105 ega_cursor = (hi << 8) | lo; 106 if ((ega_cursor % EGA_COLS) != 0) 107 ega_cursor = (ega_cursor + EGA_COLS) - ega_cursor % EGA_COLS; 108 109 ega_check_cursor(); 110 ega_move_cursor(); 111 ega_show_cursor(); 88 112 } 89 113 … … 143 167 videoram = (uint8_t *) hw_map(videoram_phys, EGA_VRAM_SIZE); 144 168 145 /* Clear the screen and set the cursor position. */ 146 memsetw(videoram, EGA_SCREEN, 0x0720); 147 memsetw(backbuf, EGA_SCREEN, 0x0720); 148 ega_move_cursor(); 169 /* Synchronize the back buffer and cursor position. */ 170 memcpy(backbuf, videoram, EGA_VRAM_SIZE); 171 ega_sync_cursor(); 149 172 150 173 chardev_initialize("ega_out", &ega_console, &ega_ops); … … 163 186 memcpy(videoram, backbuf, EGA_VRAM_SIZE); 164 187 ega_move_cursor(); 188 ega_show_cursor(); 165 189 } 166 190
Note:
See TracChangeset
for help on using the changeset viewer.