Changes in kernel/genarch/src/drivers/ega/ega.c [da1bafb:b366a6f4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ega/ega.c
rda1bafb rb366a6f4 41 41 #include <mm/slab.h> 42 42 #include <arch/mm/page.h> 43 #include <synch/spinlock.h>44 43 #include <typedefs.h> 45 44 #include <arch/asm.h> … … 65 64 IRQ_SPINLOCK_DECLARE(lock); 66 65 66 parea_t parea; 67 67 68 uint32_t cursor; 68 69 uint8_t *addr; … … 71 72 } ega_instance_t; 72 73 73 static void ega_putchar(outdev_t *, wchar_t , bool);74 static void ega_putchar(outdev_t *, wchar_t); 74 75 static void ega_redraw(outdev_t *); 75 76 … … 438 439 * This function takes care of scrolling. 439 440 */ 440 static void ega_check_cursor(ega_instance_t *instance , bool silent)441 static void ega_check_cursor(ega_instance_t *instance) 441 442 { 442 443 if (instance->cursor < EGA_SCREEN) … … 449 450 EGA_COLS, EMPTY_CHAR); 450 451 451 if ( !silent) {452 if ((!instance->parea.mapped) || (console_override)) { 452 453 memmove((void *) instance->addr, 453 454 (void *) (instance->addr + EGA_COLS * 2), … … 460 461 } 461 462 462 static void ega_show_cursor(ega_instance_t *instance , bool silent)463 { 464 if ( !silent) {463 static void ega_show_cursor(ega_instance_t *instance) 464 { 465 if ((!instance->parea.mapped) || (console_override)) { 465 466 pio_write_8(instance->base + EGA_INDEX_REG, 0x0a); 466 467 uint8_t stat = pio_read_8(instance->base + EGA_DATA_REG); … … 470 471 } 471 472 472 static void ega_move_cursor(ega_instance_t *instance , bool silent)473 { 474 if ( !silent) {473 static void ega_move_cursor(ega_instance_t *instance) 474 { 475 if ((!instance->parea.mapped) || (console_override)) { 475 476 pio_write_8(instance->base + EGA_INDEX_REG, 0x0e); 476 477 pio_write_8(instance->base + EGA_DATA_REG, … … 482 483 } 483 484 484 static void ega_sync_cursor(ega_instance_t *instance , bool silent)485 { 486 if ( !silent) {485 static void ega_sync_cursor(ega_instance_t *instance) 486 { 487 if ((!instance->parea.mapped) || (console_override)) { 487 488 pio_write_8(instance->base + EGA_INDEX_REG, 0x0e); 488 489 uint8_t hi = pio_read_8(instance->base + EGA_DATA_REG); … … 504 505 EGA_SCREEN - instance->cursor, EMPTY_CHAR); 505 506 506 if ( !silent)507 if ((!instance->parea.mapped) || (console_override)) 507 508 memsetw(instance->addr + instance->cursor * 2, 508 509 EGA_SCREEN - instance->cursor, EMPTY_CHAR); 509 510 510 ega_check_cursor(instance , silent);511 ega_move_cursor(instance , silent);512 ega_show_cursor(instance , silent);513 } 514 515 static void ega_display_char(ega_instance_t *instance, wchar_t ch , bool silent)511 ega_check_cursor(instance); 512 ega_move_cursor(instance); 513 ega_show_cursor(instance); 514 } 515 516 static void ega_display_char(ega_instance_t *instance, wchar_t ch) 516 517 { 517 518 uint16_t index = ega_oem_glyph(ch); … … 530 531 instance->backbuf[instance->cursor * 2 + 1] = style; 531 532 532 if ( !silent) {533 if ((!instance->parea.mapped) || (console_override)) { 533 534 instance->addr[instance->cursor * 2] = glyph; 534 535 instance->addr[instance->cursor * 2 + 1] = style; … … 536 537 } 537 538 538 static void ega_putchar(outdev_t *dev, wchar_t ch , bool silent)539 static void ega_putchar(outdev_t *dev, wchar_t ch) 539 540 { 540 541 ega_instance_t *instance = (ega_instance_t *) dev->data; … … 556 557 break; 557 558 default: 558 ega_display_char(instance, ch , silent);559 ega_display_char(instance, ch); 559 560 instance->cursor++; 560 561 break; 561 562 } 562 ega_check_cursor(instance , silent);563 ega_move_cursor(instance , silent);563 ega_check_cursor(instance); 564 ega_move_cursor(instance); 564 565 565 566 irq_spinlock_unlock(&instance->lock, true); … … 573 574 574 575 memcpy(instance->addr, instance->backbuf, EGA_VRAM_SIZE); 575 ega_move_cursor(instance , silent);576 ega_show_cursor(instance , silent);576 ega_move_cursor(instance); 577 ega_show_cursor(instance); 577 578 578 579 irq_spinlock_unlock(&instance->lock, true); … … 613 614 } 614 615 616 link_initialize(&instance->parea.link); 617 instance->parea.pbase = addr; 618 instance->parea.frames = SIZE2FRAMES(EGA_VRAM_SIZE); 619 instance->parea.unpriv = false; 620 instance->parea.mapped = false; 621 ddi_parea_register(&instance->parea); 622 615 623 /* Synchronize the back buffer and cursor position. */ 616 624 memcpy(instance->backbuf, instance->addr, EGA_VRAM_SIZE); 617 ega_sync_cursor(instance , silent);625 ega_sync_cursor(instance); 618 626 619 627 if (!fb_exported) { 620 628 /* 621 * This is the necessary evil until the userspace driver is entirely 622 * self-sufficient. 629 * We export the kernel framebuffer for uspace usage. 630 * This is used in the case the uspace framebuffer 631 * driver is not self-sufficient. 623 632 */ 624 633 sysinfo_set_item_val("fb", NULL, true);
Note:
See TracChangeset
for help on using the changeset viewer.