Changeset a35b458 in mainline for uspace/srv/hid/output/port/ega.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 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:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/output/port/ega.c

    r3061bc1 ra35b458  
    4747        sysarg_t cols;
    4848        sysarg_t rows;
    49        
     49
    5050        uint8_t style_normal;
    5151        uint8_t style_inverted;
    52        
     52
    5353        size_t size;
    5454        uint8_t *addr;
     
    6060{
    6161        uint8_t attr = 0;
    62        
     62
    6363        switch (attrs.type) {
    6464        case CHAR_ATTR_STYLE:
     
    8181                attr = ((attrs.val.index.bgcolor & 7) << 4) |
    8282                    (attrs.val.index.fgcolor & 7);
    83                
     83
    8484                if (attrs.val.index.attr & CATTR_BRIGHT)
    8585                        attr |= 0x08;
    86                
     86
    8787                break;
    8888        case CHAR_ATTR_RGB:
     
    9191                break;
    9292        }
    93        
     93
    9494        return attr;
    9595}
     
    105105{
    106106        uint8_t glyph;
    107        
     107
    108108        if (ascii_check(field->ch))
    109109                glyph = field->ch;
    110110        else
    111111                glyph = '?';
    112        
     112
    113113        uint8_t attr = attrs_attr(field->attrs);
    114        
     114
    115115        ega.addr[FB_POS(col, row)] = glyph;
    116116        ega.addr[FB_POS(col, row) + 1] = attr;
     
    143143        /* Cursor position */
    144144        uint16_t cursor = row * ega.cols + col;
    145        
     145
    146146        pio_write_8(EGA_IO_BASE, 0x0e);
    147147        pio_write_8(EGA_IO_BASE + 1, (cursor >> 8) & 0xff);
    148148        pio_write_8(EGA_IO_BASE, 0x0f);
    149149        pio_write_8(EGA_IO_BASE + 1, cursor & 0xff);
    150        
     150
    151151        /* Cursor visibility */
    152152        pio_write_8(EGA_IO_BASE, 0x0a);
    153153        uint8_t stat = pio_read_8(EGA_IO_BASE + 1);
    154        
     154
    155155        pio_write_8(EGA_IO_BASE, 0x0a);
    156        
     156
    157157        if (visible)
    158158                pio_write_8(EGA_IO_BASE + 1, stat & (~(1 << 5)));
     
    165165        charfield_t *field =
    166166            chargrid_charfield_at(dev->backbuf, col, row);
    167        
     167
    168168        draw_char(field, col, row);
    169169}
     
    189189        if (rc != EOK)
    190190                present = false;
    191        
     191
    192192        if (!present)
    193193                return ENOENT;
    194        
     194
    195195        sysarg_t kind;
    196196        rc = sysinfo_get_value("fb.kind", &kind);
    197197        if (rc != EOK)
    198198                kind = (sysarg_t) -1;
    199        
     199
    200200        if (kind != 2)
    201201                return EINVAL;
    202        
     202
    203203        sysarg_t paddr;
    204204        rc = sysinfo_get_value("fb.address.physical", &paddr);
    205205        if (rc != EOK)
    206206                return rc;
    207        
     207
    208208        rc = sysinfo_get_value("fb.width", &ega.cols);
    209209        if (rc != EOK)
    210210                return rc;
    211        
     211
    212212        rc = sysinfo_get_value("fb.height", &ega.rows);
    213213        if (rc != EOK)
    214214                return rc;
    215        
     215
    216216        rc = pio_enable((void*)EGA_IO_BASE, EGA_IO_SIZE, NULL);
    217217        if (rc != EOK)
    218218                return rc;
    219        
     219
    220220        ega.size = (ega.cols * ega.rows) << 1;
    221221        ega.addr = AS_AREA_ANY;
    222        
     222
    223223        rc = physmem_map(paddr,
    224224            ALIGN_UP(ega.size, PAGE_SIZE) >> PAGE_WIDTH,
     
    226226        if (rc != EOK)
    227227                return rc;
    228        
     228
    229229        sysarg_t blinking;
    230230        rc = sysinfo_get_value("fb.blinking", &blinking);
    231231        if (rc != EOK)
    232232                blinking = false;
    233        
     233
    234234        ega.style_normal = 0xf0;
    235235        ega.style_inverted = 0x0f;
    236        
     236
    237237        if (blinking) {
    238238                ega.style_normal &= 0x77;
    239239                ega.style_inverted &= 0x77;
    240240        }
    241        
     241
    242242        outdev_t *dev = outdev_register(&ega_ops, (void *) &ega);
    243243        if (dev == NULL) {
     
    245245                return EINVAL;
    246246        }
    247        
     247
    248248        return EOK;
    249249}
Note: See TracChangeset for help on using the changeset viewer.