Changeset a35b458 in mainline for kernel/genarch/src/drivers/ega/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
  • kernel/genarch/src/drivers/ega/ega.c

    r3061bc1 ra35b458  
    6363typedef struct {
    6464        IRQ_SPINLOCK_DECLARE(lock);
    65        
     65
    6666        parea_t parea;
    67        
     67
    6868        uint32_t cursor;
    6969        uint8_t *addr;
     
    8686        if ((ch >= 0x0000) && (ch <= 0x007f))
    8787                return ch;
    88        
     88
    8989        if (ch == 0x00a0)
    9090                return 255;
    91        
     91
    9292        if (ch == 0x00a1)
    9393                return 173;
    94        
     94
    9595        if ((ch >= 0x00a2) && (ch <= 0x00a3))
    9696                return (ch - 7);
    97        
     97
    9898        if (ch == 0x00a5)
    9999                return 157;
    100        
     100
    101101        if (ch == 0x00aa)
    102102                return 166;
    103        
     103
    104104        if (ch == 0x00ab)
    105105                return 174;
    106        
     106
    107107        if (ch == 0x00ac)
    108108                return 170;
    109        
     109
    110110        if (ch == 0x00b0)
    111111                return 248;
    112        
     112
    113113        if (ch == 0x00b1)
    114114                return 241;
    115        
     115
    116116        if (ch == 0x00b2)
    117117                return 253;
    118        
     118
    119119        if (ch == 0x00b5)
    120120                return 230;
    121        
     121
    122122        if (ch == 0x00b7)
    123123                return 250;
    124        
     124
    125125        if (ch == 0x00ba)
    126126                return 167;
    127        
     127
    128128        if (ch == 0x00bb)
    129129                return 175;
    130        
     130
    131131        if (ch == 0x00bc)
    132132                return 172;
    133        
     133
    134134        if (ch == 0x00bd)
    135135                return 171;
    136        
     136
    137137        if (ch == 0x00bf)
    138138                return 168;
    139        
     139
    140140        if ((ch >= 0x00c4) && (ch <= 0x00c5))
    141141                return (ch - 54);
    142        
     142
    143143        if (ch == 0x00c6)
    144144                return 146;
    145        
     145
    146146        if (ch == 0x00c7)
    147147                return 128;
    148        
     148
    149149        if (ch == 0x00c9)
    150150                return 144;
    151        
     151
    152152        if (ch == 0x00d1)
    153153                return 165;
    154        
     154
    155155        if (ch == 0x00d6)
    156156                return 153;
    157        
     157
    158158        if (ch == 0x00dc)
    159159                return 154;
    160        
     160
    161161        if (ch == 0x00df)
    162162                return 225;
    163        
     163
    164164        if (ch == 0x00e0)
    165165                return 133;
    166        
     166
    167167        if (ch == 0x00e1)
    168168                return 160;
    169        
     169
    170170        if (ch == 0x00e2)
    171171                return 131;
    172        
     172
    173173        if (ch == 0x00e4)
    174174                return 132;
    175        
     175
    176176        if (ch == 0x00e5)
    177177                return 134;
    178        
     178
    179179        if (ch == 0x00e6)
    180180                return 145;
    181        
     181
    182182        if (ch == 0x00e7)
    183183                return 135;
    184        
     184
    185185        if (ch == 0x00e8)
    186186                return 138;
    187        
     187
    188188        if (ch == 0x00e9)
    189189                return 130;
    190        
     190
    191191        if ((ch >= 0x00ea) && (ch <= 0x00eb))
    192192                return (ch - 98);
    193        
     193
    194194        if (ch == 0x00ec)
    195195                return 141;
    196        
     196
    197197        if (ch == 0x00ed)
    198198                return 161;
    199        
     199
    200200        if (ch == 0x00ee)
    201201                return 140;
    202        
     202
    203203        if (ch == 0x00ef)
    204204                return 139;
    205        
     205
    206206        if (ch == 0x00f1)
    207207                return 164;
    208        
     208
    209209        if (ch == 0x00f2)
    210210                return 149;
    211        
     211
    212212        if (ch == 0x00f3)
    213213                return 162;
    214        
     214
    215215        if (ch == 0x00f4)
    216216                return 147;
    217        
     217
    218218        if (ch == 0x00f6)
    219219                return 148;
    220        
     220
    221221        if (ch == 0x00f7)
    222222                return 246;
    223        
     223
    224224        if (ch == 0x00f9)
    225225                return 151;
    226        
     226
    227227        if (ch == 0x00fa)
    228228                return 163;
    229        
     229
    230230        if (ch == 0x00fb)
    231231                return 150;
    232        
     232
    233233        if (ch == 0x00fc)
    234234                return 129;
    235        
     235
    236236        if (ch == 0x00ff)
    237237                return 152;
    238        
     238
    239239        if (ch == 0x0192)
    240240                return 159;
    241        
     241
    242242        if (ch == 0x0393)
    243243                return 226;
    244        
     244
    245245        if (ch == 0x0398)
    246246                return 233;
    247        
     247
    248248        if (ch == 0x03a3)
    249249                return 228;
    250        
     250
    251251        if (ch == 0x03a6)
    252252                return 232;
    253        
     253
    254254        if (ch == 0x03a9)
    255255                return 234;
    256        
     256
    257257        if (ch == 0x03b1)
    258258                return 224;
    259        
     259
    260260        if (ch == 0x03b4)
    261261                return 235;
    262        
     262
    263263        if (ch == 0x03b5)
    264264                return 238;
    265        
     265
    266266        if (ch == 0x03c0)
    267267                return 227;
    268        
     268
    269269        if (ch == 0x03c3)
    270270                return 229;
    271        
     271
    272272        if (ch == 0x03c4)
    273273                return 231;
    274        
     274
    275275        if (ch == 0x03c6)
    276276                return 237;
    277        
     277
    278278        if (ch == 0x207f)
    279279                return 252;
    280        
     280
    281281        if (ch == 0x20a7)
    282282                return 158;
    283        
     283
    284284        if (ch == 0x2219)
    285285                return 249;
    286        
     286
    287287        if (ch == 0x221a)
    288288                return 251;
    289        
     289
    290290        if (ch == 0x221e)
    291291                return 236;
    292        
     292
    293293        if (ch == 0x2229)
    294294                return 239;
    295        
     295
    296296        if (ch == 0x2248)
    297297                return 247;
    298        
     298
    299299        if (ch == 0x2261)
    300300                return 240;
    301        
     301
    302302        if (ch == 0x2264)
    303303                return 243;
    304        
     304
    305305        if (ch == 0x2265)
    306306                return 242;
    307        
     307
    308308        if (ch == 0x2310)
    309309                return 169;
    310        
     310
    311311        if ((ch >= 0x2320) && (ch <= 0x2321))
    312312                return (ch - 8748);
    313        
     313
    314314        if (ch == 0x2500)
    315315                return 196;
    316        
     316
    317317        if (ch == 0x2502)
    318318                return 179;
    319        
     319
    320320        if (ch == 0x250c)
    321321                return 218;
    322        
     322
    323323        if (ch == 0x2510)
    324324                return 191;
    325        
     325
    326326        if (ch == 0x2514)
    327327                return 192;
    328        
     328
    329329        if (ch == 0x2518)
    330330                return 217;
    331        
     331
    332332        if (ch == 0x251c)
    333333                return 195;
    334        
     334
    335335        if (ch == 0x2524)
    336336                return 180;
    337        
     337
    338338        if (ch == 0x252c)
    339339                return 194;
    340        
     340
    341341        if (ch == 0x2534)
    342342                return 193;
    343        
     343
    344344        if (ch == 0x253c)
    345345                return 197;
    346        
     346
    347347        if (ch == 0x2550)
    348348                return 205;
    349        
     349
    350350        if (ch == 0x2551)
    351351                return 186;
    352        
     352
    353353        if ((ch >= 0x2552) && (ch <= 0x2553))
    354354                return (ch - 9341);
    355        
     355
    356356        if (ch == 0x2554)
    357357                return 201;
    358        
     358
    359359        if (ch == 0x2555)
    360360                return 184;
    361        
     361
    362362        if (ch == 0x2556)
    363363                return 183;
    364        
     364
    365365        if (ch == 0x2557)
    366366                return 187;
    367        
     367
    368368        if (ch == 0x2558)
    369369                return 212;
    370        
     370
    371371        if (ch == 0x2559)
    372372                return 211;
    373        
     373
    374374        if (ch == 0x255a)
    375375                return 200;
    376        
     376
    377377        if (ch == 0x255b)
    378378                return 190;
    379        
     379
    380380        if (ch == 0x255c)
    381381                return 189;
    382        
     382
    383383        if (ch == 0x255d)
    384384                return 188;
    385        
     385
    386386        if ((ch >= 0x255e) && (ch <= 0x255f))
    387387                return (ch - 9368);
    388        
     388
    389389        if (ch == 0x2560)
    390390                return 204;
    391        
     391
    392392        if ((ch >= 0x2561) && (ch <= 0x2562))
    393393                return (ch - 9388);
    394        
     394
    395395        if (ch == 0x2563)
    396396                return 185;
    397        
     397
    398398        if ((ch >= 0x2564) && (ch <= 0x2565))
    399399                return (ch - 9363);
    400        
     400
    401401        if (ch == 0x2566)
    402402                return 203;
    403        
     403
    404404        if ((ch >= 0x2567) && (ch <= 0x2568))
    405405                return (ch - 9368);
    406        
     406
    407407        if (ch == 0x2569)
    408408                return 202;
    409        
     409
    410410        if (ch == 0x256a)
    411411                return 216;
    412        
     412
    413413        if (ch == 0x256b)
    414414                return 215;
    415        
     415
    416416        if (ch == 0x256c)
    417417                return 206;
    418        
     418
    419419        if (ch == 0x2580)
    420420                return 223;
    421        
     421
    422422        if (ch == 0x2584)
    423423                return 220;
    424        
     424
    425425        if (ch == 0x2588)
    426426                return 219;
    427        
     427
    428428        if (ch == 0x258c)
    429429                return 221;
    430        
     430
    431431        if (ch == 0x2590)
    432432                return 222;
    433        
     433
    434434        if ((ch >= 0x2591) && (ch <= 0x2593))
    435435                return (ch - 9441);
    436        
     436
    437437        return 256;
    438438}
     
    445445        if (instance->cursor < EGA_SCREEN)
    446446                return;
    447        
     447
    448448        memmove((void *) instance->backbuf,
    449449            (void *) (instance->backbuf + EGA_COLS * 2),
     
    451451        memsetw(instance->backbuf + (EGA_SCREEN - EGA_COLS) * 2,
    452452            EGA_COLS, EMPTY_CHAR);
    453        
     453
    454454        if ((!instance->parea.mapped) || (console_override)) {
    455455                memmove((void *) instance->addr,
     
    459459                    EGA_COLS, EMPTY_CHAR);
    460460        }
    461        
     461
    462462        instance->cursor = instance->cursor - EGA_COLS;
    463463}
     
    492492                pio_write_8(instance->base + EGA_INDEX_REG, 0x0f);
    493493                uint8_t lo = pio_read_8(instance->base + EGA_DATA_REG);
    494                
     494
    495495                instance->cursor = (hi << 8) | lo;
    496496        } else
    497497                instance->cursor = 0;
    498        
     498
    499499        if (instance->cursor >= EGA_SCREEN)
    500500                instance->cursor = 0;
    501        
     501
    502502        if ((instance->cursor % EGA_COLS) != 0)
    503503                instance->cursor =
    504504                    (instance->cursor + EGA_COLS) - instance->cursor % EGA_COLS;
    505        
     505
    506506        memsetw(instance->backbuf + instance->cursor * 2,
    507507            EGA_SCREEN - instance->cursor, EMPTY_CHAR);
    508        
     508
    509509        if ((!instance->parea.mapped) || (console_override))
    510510                memsetw(instance->addr + instance->cursor * 2,
    511511                    EGA_SCREEN - instance->cursor, EMPTY_CHAR);
    512        
     512
    513513        ega_check_cursor(instance);
    514514        ega_move_cursor(instance);
     
    521521        uint8_t glyph;
    522522        uint8_t style;
    523        
     523
    524524        if ((index >> 8)) {
    525525                glyph = U_SPECIAL;
     
    529529                style = STYLE;
    530530        }
    531        
     531
    532532        instance->backbuf[instance->cursor * 2] = glyph;
    533533        instance->backbuf[instance->cursor * 2 + 1] = style;
    534        
     534
    535535        if ((!instance->parea.mapped) || (console_override)) {
    536536                instance->addr[instance->cursor * 2] = glyph;
     
    542542{
    543543        ega_instance_t *instance = (ega_instance_t *) dev->data;
    544        
     544
    545545        irq_spinlock_lock(&instance->lock, true);
    546        
     546
    547547        switch (ch) {
    548548        case '\n':
     
    565565        ega_check_cursor(instance);
    566566        ega_move_cursor(instance);
    567        
     567
    568568        irq_spinlock_unlock(&instance->lock, true);
    569569}
     
    572572{
    573573        ega_instance_t *instance = (ega_instance_t *) dev->data;
    574        
     574
    575575        irq_spinlock_lock(&instance->lock, true);
    576        
     576
    577577        memcpy(instance->addr, instance->backbuf, EGA_VRAM_SIZE);
    578578        ega_move_cursor(instance);
    579579        ega_show_cursor(instance);
    580        
     580
    581581        irq_spinlock_unlock(&instance->lock, true);
    582582}
     
    587587        if (!egadev)
    588588                return NULL;
    589        
     589
    590590        ega_instance_t *instance = malloc(sizeof(ega_instance_t), FRAME_ATOMIC);
    591591        if (!instance) {
     
    593593                return NULL;
    594594        }
    595        
     595
    596596        outdev_initialize("egadev", egadev, &egadev_ops);
    597597        egadev->data = instance;
    598        
     598
    599599        irq_spinlock_initialize(&instance->lock, "*ega.instance.lock");
    600        
     600
    601601        instance->base = base;
    602602        instance->addr = (uint8_t *) km_map(addr, EGA_VRAM_SIZE,
     
    608608                return NULL;
    609609        }
    610        
     610
    611611        instance->backbuf = (uint8_t *) malloc(EGA_VRAM_SIZE, 0);
    612612        if (!instance->backbuf) {
     
    616616                return NULL;
    617617        }
    618        
     618
    619619        link_initialize(&instance->parea.link);
    620620        instance->parea.pbase = addr;
     
    623623        instance->parea.mapped = false;
    624624        ddi_parea_register(&instance->parea);
    625        
     625
    626626        /* Synchronize the back buffer and cursor position. */
    627627        memcpy(instance->backbuf, instance->addr, EGA_VRAM_SIZE);
    628628        ega_sync_cursor(instance);
    629        
     629
    630630        if (!fb_exported) {
    631631                /*
     
    640640                sysinfo_set_item_val("fb.blinking", NULL, true);
    641641                sysinfo_set_item_val("fb.address.physical", NULL, addr);
    642                
     642
    643643                fb_exported = true;
    644644        }
    645        
     645
    646646        return egadev;
    647647}
Note: See TracChangeset for help on using the changeset viewer.