Changeset 9979acb in mainline for kernel/genarch/src
- Timestamp:
- 2009-02-20T17:19:03Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c9b550b
- Parents:
- 5c06c1c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ega/ega.c
r5c06c1c r9979acb 27 27 */ 28 28 29 /** @addtogroup genarch_drivers 29 /** @addtogroup genarch_drivers 30 30 * @{ 31 31 */ … … 68 68 static void ega_check_cursor(void) 69 69 { 70 if (ega_cursor < SCREEN)70 if (ega_cursor < EGA_SCREEN) 71 71 return; 72 72 73 memmove((void *) videoram, (void *) (videoram + ROW* 2),74 ( SCREEN - ROW) * 2);75 memmove((void *) backbuf, (void *) (backbuf + ROW* 2),76 ( SCREEN - ROW) * 2);77 memsetw(videoram + ( SCREEN - ROW) * 2, ROW, 0x0720);78 memsetw(backbuf + ( SCREEN - ROW) * 2, ROW, 0x0720);79 ega_cursor = ega_cursor - ROW;73 memmove((void *) videoram, (void *) (videoram + EGA_COLS * 2), 74 (EGA_SCREEN - EGA_COLS) * 2); 75 memmove((void *) backbuf, (void *) (backbuf + EGA_COLS * 2), 76 (EGA_SCREEN - EGA_COLS) * 2); 77 memsetw(videoram + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, 0x0720); 78 memsetw(backbuf + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, 0x0720); 79 ega_cursor = ega_cursor - EGA_COLS; 80 80 } 81 81 … … 85 85 pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) ((ega_cursor >> 8) & 0xff)); 86 86 pio_write_8(ega_base + EGA_INDEX_REG, 0xf); 87 pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff)); 87 pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff)); 88 88 } 89 89 … … 105 105 switch (ch) { 106 106 case '\n': 107 ega_cursor = (ega_cursor + ROW) - ega_cursor % ROW;107 ega_cursor = (ega_cursor + EGA_COLS) - ega_cursor % EGA_COLS; 108 108 break; 109 109 case '\t': … … 111 111 break; 112 112 case '\b': 113 if (ega_cursor % ROW)113 if (ega_cursor % EGA_COLS) 114 114 ega_cursor--; 115 115 break; … … 134 134 void ega_init(ioport8_t *base, uintptr_t videoram_phys) 135 135 { 136 /* Initialize the software structure. */ 136 /* Initialize the software structure. */ 137 137 ega_base = base; 138 138 139 backbuf = (uint8_t *) malloc( SCREEN * 2, 0);139 backbuf = (uint8_t *) malloc(EGA_VRAM_SIZE, 0); 140 140 if (!backbuf) 141 141 panic("Unable to allocate backbuffer."); 142 142 143 videoram = (uint8_t *) hw_map(videoram_phys, SCREEN * 2);143 videoram = (uint8_t *) hw_map(videoram_phys, EGA_VRAM_SIZE); 144 144 145 145 /* Clear the screen and set the cursor position. */ 146 memsetw(videoram, SCREEN, 0x0720);147 memsetw(backbuf, SCREEN, 0x0720);146 memsetw(videoram, EGA_SCREEN, 0x0720); 147 memsetw(backbuf, EGA_SCREEN, 0x0720); 148 148 ega_move_cursor(); 149 149 … … 153 153 sysinfo_set_item_val("fb", NULL, true); 154 154 sysinfo_set_item_val("fb.kind", NULL, 2); 155 sysinfo_set_item_val("fb.width", NULL, ROW);156 sysinfo_set_item_val("fb.height", NULL, ROWS);155 sysinfo_set_item_val("fb.width", NULL, EGA_COLS); 156 sysinfo_set_item_val("fb.height", NULL, EGA_ROWS); 157 157 sysinfo_set_item_val("fb.blinking", NULL, true); 158 158 sysinfo_set_item_val("fb.address.physical", NULL, videoram_phys); … … 161 161 void ega_redraw(void) 162 162 { 163 memcpy(videoram, backbuf, SCREEN * 2);163 memcpy(videoram, backbuf, EGA_VRAM_SIZE); 164 164 ega_move_cursor(); 165 165 }
Note:
See TracChangeset
for help on using the changeset viewer.