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