Changeset 0a5116db in mainline for uspace/srv/fb/ega.c


Ignore:
Timestamp:
2009-03-21T22:02:10Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dc033a1
Parents:
d2cc7e1
Message:

Fix EGA.

File:
1 edited

Legend:

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

    rd2cc7e1 r0a5116db  
    232232}
    233233
     234#define FB_WRITE_BUF_SIZE 256
     235static char fb_write_buf[FB_WRITE_BUF_SIZE];
     236
     237static void fb_write(ipc_callid_t rid, ipc_call_t *request)
     238{
     239        int row, col;
     240        ipc_callid_t callid;
     241        size_t len;
     242        size_t i;
     243
     244        row = IPC_GET_ARG1(*request);
     245        col = IPC_GET_ARG2(*request);
     246
     247        if ((col >= scr_width) || (row >= scr_height)) {
     248                ipc_answer_0(callid, EINVAL);
     249                ipc_answer_0(rid, EINVAL);
     250                return;
     251        }
     252
     253        if (!ipc_data_write_receive(&callid, &len)) {
     254                ipc_answer_0(callid, EINVAL);
     255                ipc_answer_0(rid, EINVAL);
     256                return;
     257        }
     258
     259        if (len > FB_WRITE_BUF_SIZE)
     260                len = FB_WRITE_BUF_SIZE;
     261        if (len >= scr_width - col)
     262                len = scr_width - col;
     263
     264        (void) ipc_data_write_finalize(callid, fb_write_buf, len);
     265
     266        for (i = 0; i < len; i++) {
     267                printchar(fb_write_buf[i], row, col++);
     268        }
     269
     270        ipc_answer_1(rid, EOK, len);
     271}
     272
    234273static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall)
    235274{
     
    296335                        retval = 0;
    297336                        break;
     337                case FB_WRITE:
     338                        fb_write(callid, &call);
     339
     340                        /* Message already answered */
     341                        continue;
    298342                case FB_CURSOR_GOTO:
    299343                        row = IPC_GET_ARG1(call);
Note: See TracChangeset for help on using the changeset viewer.