Changeset e4f8c77 in mainline for kernel/genarch/src/drivers/ega/ega.c


Ignore:
Timestamp:
2011-07-13T22:39:18Z (13 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e6910c8
Parents:
5974661 (diff), 8ecef91 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge libposix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/ega/ega.c

    r5974661 re4f8c77  
    6464        IRQ_SPINLOCK_DECLARE(lock);
    6565       
     66        parea_t parea;
     67       
    6668        uint32_t cursor;
    6769        uint8_t *addr;
     
    7072} ega_instance_t;
    7173
    72 static void ega_putchar(outdev_t *, wchar_t, bool);
     74static void ega_putchar(outdev_t *, wchar_t);
    7375static void ega_redraw(outdev_t *);
    7476
     
    437439 * This function takes care of scrolling.
    438440 */
    439 static void ega_check_cursor(ega_instance_t *instance, bool silent)
     441static void ega_check_cursor(ega_instance_t *instance)
    440442{
    441443        if (instance->cursor < EGA_SCREEN)
     
    448450            EGA_COLS, EMPTY_CHAR);
    449451       
    450         if (!silent) {
     452        if ((!instance->parea.mapped) || (console_override)) {
    451453                memmove((void *) instance->addr,
    452454                    (void *) (instance->addr + EGA_COLS * 2),
     
    459461}
    460462
    461 static void ega_show_cursor(ega_instance_t *instance, bool silent)
    462 {
    463         if (!silent) {
     463static void ega_show_cursor(ega_instance_t *instance)
     464{
     465        if ((!instance->parea.mapped) || (console_override)) {
    464466                pio_write_8(instance->base + EGA_INDEX_REG, 0x0a);
    465467                uint8_t stat = pio_read_8(instance->base + EGA_DATA_REG);
     
    469471}
    470472
    471 static void ega_move_cursor(ega_instance_t *instance, bool silent)
    472 {
    473         if (!silent) {
     473static void ega_move_cursor(ega_instance_t *instance)
     474{
     475        if ((!instance->parea.mapped) || (console_override)) {
    474476                pio_write_8(instance->base + EGA_INDEX_REG, 0x0e);
    475477                pio_write_8(instance->base + EGA_DATA_REG,
     
    481483}
    482484
    483 static void ega_sync_cursor(ega_instance_t *instance, bool silent)
    484 {
    485         if (!silent) {
     485static void ega_sync_cursor(ega_instance_t *instance)
     486{
     487        if ((!instance->parea.mapped) || (console_override)) {
    486488                pio_write_8(instance->base + EGA_INDEX_REG, 0x0e);
    487489                uint8_t hi = pio_read_8(instance->base + EGA_DATA_REG);
     
    503505            EGA_SCREEN - instance->cursor, EMPTY_CHAR);
    504506       
    505         if (!silent)
     507        if ((!instance->parea.mapped) || (console_override))
    506508                memsetw(instance->addr + instance->cursor * 2,
    507509                    EGA_SCREEN - instance->cursor, EMPTY_CHAR);
    508510       
    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
     516static void ega_display_char(ega_instance_t *instance, wchar_t ch)
    515517{
    516518        uint16_t index = ega_oem_glyph(ch);
     
    529531        instance->backbuf[instance->cursor * 2 + 1] = style;
    530532       
    531         if (!silent) {
     533        if ((!instance->parea.mapped) || (console_override)) {
    532534                instance->addr[instance->cursor * 2] = glyph;
    533535                instance->addr[instance->cursor * 2 + 1] = style;
     
    535537}
    536538
    537 static void ega_putchar(outdev_t *dev, wchar_t ch, bool silent)
     539static void ega_putchar(outdev_t *dev, wchar_t ch)
    538540{
    539541        ega_instance_t *instance = (ega_instance_t *) dev->data;
     
    555557                break;
    556558        default:
    557                 ega_display_char(instance, ch, silent);
     559                ega_display_char(instance, ch);
    558560                instance->cursor++;
    559561                break;
    560562        }
    561         ega_check_cursor(instance, silent);
    562         ega_move_cursor(instance, silent);
     563        ega_check_cursor(instance);
     564        ega_move_cursor(instance);
    563565       
    564566        irq_spinlock_unlock(&instance->lock, true);
     
    572574       
    573575        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);
    576578       
    577579        irq_spinlock_unlock(&instance->lock, true);
     
    612614        }
    613615       
     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       
    614623        /* Synchronize the back buffer and cursor position. */
    615624        memcpy(instance->backbuf, instance->addr, EGA_VRAM_SIZE);
    616         ega_sync_cursor(instance, silent);
     625        ega_sync_cursor(instance);
    617626       
    618627        if (!fb_exported) {
    619628                /*
    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.
    622632                 */
    623633                sysinfo_set_item_val("fb", NULL, true);
Note: See TracChangeset for help on using the changeset viewer.