Changeset d2cc7e1 in mainline for uspace/srv/fb/serial_console.c


Ignore:
Timestamp:
2009-03-21T11:26:31Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0a5116db
Parents:
5b8c75a
Message:

Buffer console output with line granularity. Makes esp. msim/ski console faster. EGA-fb needs fixing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fb/serial_console.c

    r5b8c75a rd2cc7e1  
    244244}
    245245
     246int lastcol = 0;
     247int lastrow = 0;
     248
     249#define FB_WRITE_BUF_SIZE 256
     250static char fb_write_buf[FB_WRITE_BUF_SIZE];
     251
     252static void fb_write(ipc_callid_t rid, ipc_call_t *request)
     253{
     254        int row, col;
     255        ipc_callid_t callid;
     256        size_t len;
     257        size_t i;
     258
     259        row = IPC_GET_ARG1(*request);
     260        col = IPC_GET_ARG2(*request);
     261
     262        if ((col >= scr_width) || (row >= scr_height)) {
     263                ipc_answer_0(callid, EINVAL);
     264                ipc_answer_0(rid, EINVAL);
     265                return;
     266        }
     267
     268        if (!ipc_data_write_receive(&callid, &len)) {
     269                ipc_answer_0(callid, EINVAL);
     270                ipc_answer_0(rid, EINVAL);
     271                return;
     272        }
     273
     274        if (len > FB_WRITE_BUF_SIZE)
     275                len = FB_WRITE_BUF_SIZE;
     276        if (len >= scr_width - col)
     277                len = scr_width - col;
     278
     279        (void) ipc_data_write_finalize(callid, fb_write_buf, len);
     280
     281        if ((lastcol != col) || (lastrow != row))
     282                serial_goto(row, col);
     283
     284        for (i = 0; i < len; i++) {
     285                (*putc_function)(fb_write_buf[i]);
     286        }
     287
     288        lastcol = col + len;
     289        lastrow = row;
     290
     291        ipc_answer_1(rid, EOK, len);
     292}
     293
    246294/**
    247295 * Main function of the thread serving client connections.
     
    256304
    257305        char c;
    258         int lastcol = 0;
    259         int lastrow = 0;
    260306        int newcol;
    261307        int newrow;
     
    318364                        retval = 0;
    319365                        break;
     366                case FB_WRITE:
     367                        fb_write(callid, &call);
     368                       
     369                        /* Message already answered */
     370                        continue;
    320371                case FB_CURSOR_GOTO:
    321372                        newrow = IPC_GET_ARG1(call);
Note: See TracChangeset for help on using the changeset viewer.