Changes in kernel/genarch/src/drivers/ega/ega.c [28a5ebd:39e1b9a] in mainline
- File:
-
- 1 edited
-
kernel/genarch/src/drivers/ega/ega.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ega/ega.c
r28a5ebd r39e1b9a 42 42 #include <typedefs.h> 43 43 #include <arch/asm.h> 44 #include <mem .h>44 #include <memw.h> 45 45 #include <str.h> 46 46 #include <console/chardev.h> … … 69 69 uint8_t *backbuf; 70 70 ioport8_t *base; 71 mbstate_t mbstate; 71 72 } ega_instance_t; 72 73 73 static void ega_ putuchar(outdev_t *, char32_t);74 static void ega_write(outdev_t *, const char *, size_t); 74 75 static void ega_redraw(outdev_t *); 75 76 76 77 static outdev_operations_t egadev_ops = { 77 .write = ega_ putuchar,78 .write = ega_write, 78 79 .redraw = ega_redraw, 79 80 .scroll_up = NULL, … … 538 539 } 539 540 540 static void ega_putuchar(outdev_t *dev, char32_t ch) 541 { 542 ega_instance_t *instance = (ega_instance_t *) dev->data; 543 544 irq_spinlock_lock(&instance->lock, true); 545 541 static void _putuchar(ega_instance_t *instance, char32_t ch) 542 { 546 543 switch (ch) { 547 544 case '\n': … … 564 561 ega_check_cursor(instance); 565 562 ega_move_cursor(instance); 563 } 564 565 static void ega_write(outdev_t *dev, const char *s, size_t n) 566 { 567 ega_instance_t *instance = (ega_instance_t *) dev->data; 568 569 irq_spinlock_lock(&instance->lock, true); 570 571 size_t offset = 0; 572 char32_t ch; 573 574 while ((ch = str_decode_r(s, &offset, n, U_SPECIAL, &instance->mbstate))) 575 _putuchar(instance, ch); 566 576 567 577 irq_spinlock_unlock(&instance->lock, true); 568 578 } 569 579 570 static void ega_redraw(outdev_t *dev) 571 { 572 ega_instance_t *instance = (ega_instance_t *) dev->data; 573 574 irq_spinlock_lock(&instance->lock, true); 575 580 static void ega_redraw_internal(ega_instance_t *instance) 581 { 576 582 memcpy(instance->addr, instance->backbuf, EGA_VRAM_SIZE); 577 583 ega_move_cursor(instance); 578 584 ega_show_cursor(instance); 579 585 } 586 587 static void ega_redraw(outdev_t *dev) 588 { 589 ega_instance_t *instance = (ega_instance_t *) dev->data; 590 591 irq_spinlock_lock(&instance->lock, true); 592 ega_redraw_internal(instance); 580 593 irq_spinlock_unlock(&instance->lock, true); 594 } 595 596 /** EGA was mapped or unmapped. 597 * 598 * @param arg EGA instance 599 */ 600 static void ega_mapped_changed(void *arg) 601 { 602 ega_instance_t *instance = (ega_instance_t *) arg; 603 604 if (!instance->parea.mapped) { 605 irq_spinlock_lock(&instance->lock, true); 606 ega_redraw_internal(instance); 607 irq_spinlock_unlock(&instance->lock, true); 608 } 581 609 } 582 610 … … 621 649 instance->parea.unpriv = false; 622 650 instance->parea.mapped = false; 651 instance->parea.mapped_changed = ega_mapped_changed; 652 instance->parea.arg = (void *) instance; 623 653 ddi_parea_register(&instance->parea); 624 654
Note:
See TracChangeset
for help on using the changeset viewer.
