Changes in kernel/genarch/src/drivers/ega/ega.c [39e1b9a:28a5ebd] in mainline
- File:
-
- 1 edited
-
kernel/genarch/src/drivers/ega/ega.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ega/ega.c
r39e1b9a r28a5ebd 42 42 #include <typedefs.h> 43 43 #include <arch/asm.h> 44 #include <mem w.h>44 #include <mem.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;72 71 } ega_instance_t; 73 72 74 static void ega_ write(outdev_t *, const char *, size_t);73 static void ega_putuchar(outdev_t *, char32_t); 75 74 static void ega_redraw(outdev_t *); 76 75 77 76 static outdev_operations_t egadev_ops = { 78 .write = ega_ write,77 .write = ega_putuchar, 79 78 .redraw = ega_redraw, 80 79 .scroll_up = NULL, … … 539 538 } 540 539 541 static void _putuchar(ega_instance_t *instance, char32_t ch) 542 { 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 543 546 switch (ch) { 544 547 case '\n': … … 561 564 ega_check_cursor(instance); 562 565 ega_move_cursor(instance); 563 } 564 565 static void ega_write(outdev_t *dev, const char *s, size_t n) 566 567 irq_spinlock_unlock(&instance->lock, true); 568 } 569 570 static void ega_redraw(outdev_t *dev) 566 571 { 567 572 ega_instance_t *instance = (ega_instance_t *) dev->data; … … 569 574 irq_spinlock_lock(&instance->lock, true); 570 575 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);576 577 irq_spinlock_unlock(&instance->lock, true);578 }579 580 static void ega_redraw_internal(ega_instance_t *instance)581 {582 576 memcpy(instance->addr, instance->backbuf, EGA_VRAM_SIZE); 583 577 ega_move_cursor(instance); 584 578 ega_show_cursor(instance); 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); 579 593 580 irq_spinlock_unlock(&instance->lock, true); 594 }595 596 /** EGA was mapped or unmapped.597 *598 * @param arg EGA instance599 */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 }609 581 } 610 582 … … 649 621 instance->parea.unpriv = false; 650 622 instance->parea.mapped = false; 651 instance->parea.mapped_changed = ega_mapped_changed;652 instance->parea.arg = (void *) instance;653 623 ddi_parea_register(&instance->parea); 654 624
Note:
See TracChangeset
for help on using the changeset viewer.
