Changeset 0cc4313 in mainline for uspace/srv/console/gcons.c


Ignore:
Timestamp:
2007-11-22T15:50:24Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d40a8ff
Parents:
8498915
Message:

Modify the async framework to make use of all six syscall arguments.
Supply user-friendly macros as in previous cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/console/gcons.c

    r8498915 r0cc4313  
    8282static void vp_switch(int vp)
    8383{
    84         async_msg(fbphone,FB_VIEWPORT_SWITCH, vp);
     84        async_msg_1(fbphone,FB_VIEWPORT_SWITCH, vp);
    8585}
    8686
    8787/** Create view port */
    88 static int vp_create(unsigned int x, unsigned int y,
    89                      unsigned int width, unsigned int height)
    90 {
    91         return async_req_2(fbphone, FB_VIEWPORT_CREATE,
    92                            (x << 16) | y, (width << 16) | height, NULL, NULL);
     88static int vp_create(unsigned int x, unsigned int y, unsigned int width,
     89    unsigned int height)
     90{
     91        return async_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y,
     92            (width << 16) | height);
    9393}
    9494
    9595static void clear(void)
    9696{
    97         async_msg(fbphone, FB_CLEAR, 0);
     97        async_msg_0(fbphone, FB_CLEAR);
    9898}
    9999
     
    119119        if (ic_pixmaps[state] != -1)
    120120                async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum],
    121                         ic_pixmaps[state]);
     121                    ic_pixmaps[state]);
    122122
    123123        if (state != CONS_DISCONNECTED && state != CONS_KERNEL &&
     
    141141                        redraw_state(i);
    142142                if (animation != -1)
    143                         async_msg(fbphone, FB_ANIM_START, animation);
     143                        async_msg_1(fbphone, FB_ANIM_START, animation);
    144144        } else {
    145145                if (console_state[active_console] == CONS_DISCONNECTED_SEL)
     
    225225
    226226        if (animation != -1)
    227                 async_msg(fbphone, FB_ANIM_STOP, animation);
     227                async_msg_1(fbphone, FB_ANIM_STOP, animation);
    228228
    229229        active_console = KERNEL_CONSOLE; /* Set to kernel console */
     
    317317        /* Create area */
    318318        shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
    319                 MAP_ANONYMOUS, 0, 0);
     319            MAP_ANONYMOUS, 0, 0);
    320320        if (shm == MAP_FAILED)
    321321                return;
     
    323323        memcpy(shm, logo, size);
    324324        /* Send area */
    325         rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
    326                 NULL);
     325        rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);
    327326        if (rc)
    328327                goto exit;
    329         rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
    330                 PROTO_READ, NULL, NULL, NULL);
     328        rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
     329            PROTO_READ);
    331330        if (rc)
    332331                goto drop;
     
    335334drop:
    336335        /* Drop area */
    337         async_msg(fbphone, FB_DROP_SHM, 0);
     336        async_msg_0(fbphone, FB_DROP_SHM);
    338337exit:       
    339338        /* Remove area */
     
    357356        clear();
    358357        draw_pixmap(_binary_helenos_ppm_start,
    359                 (size_t) &_binary_helenos_ppm_size, xres - 66, 2);
     358            (size_t) &_binary_helenos_ppm_size, xres - 66, 2);
    360359        draw_pixmap(_binary_nameic_ppm_start,
    361                 (size_t) &_binary_nameic_ppm_size, 5, 17);
    362 
    363         for (i = 0;i < CONSOLE_COUNT; i++)
     360            (size_t) &_binary_nameic_ppm_size, 5, 17);
     361
     362        for (i = 0; i < CONSOLE_COUNT; i++)
    364363                redraw_state(i);
    365364        vp_switch(console_vp);
     
    380379        /* Create area */
    381380        shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
    382                 MAP_ANONYMOUS, 0, 0);
     381            MAP_ANONYMOUS, 0, 0);
    383382        if (shm == MAP_FAILED)
    384383                return -1;
     
    386385        memcpy(shm, data, size);
    387386        /* Send area */
    388         rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
    389                 NULL);
     387        rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);
    390388        if (rc)
    391389                goto exit;
    392         rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
    393                 PROTO_READ, NULL, NULL, NULL);
     390        rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
     391            PROTO_READ);
    394392        if (rc)
    395393                goto drop;
    396394
    397395        /* Obtain pixmap */
    398         rc = async_req(fbphone, FB_SHM2PIXMAP, 0, NULL);
     396        rc = async_req_0_0(fbphone, FB_SHM2PIXMAP);
    399397        if (rc < 0)
    400398                goto drop;
     
    402400drop:
    403401        /* Drop area */
    404         async_msg(fbphone, FB_DROP_SHM, 0);
     402        async_msg_0(fbphone, FB_DROP_SHM);
    405403exit:       
    406404        /* Remove area */
     
    424422        int pm;
    425423
    426         an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE],
    427                 NULL);
     424        an = async_req_1_0(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE]);
    428425        if (an < 0)
    429426                return;
    430427
    431428        pm = make_pixmap(_binary_anim_1_ppm_start,
    432                 (int) &_binary_anim_1_ppm_size);
     429            (int) &_binary_anim_1_ppm_size);
    433430        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    434431
    435432        pm = make_pixmap(_binary_anim_2_ppm_start,
    436                 (int) &_binary_anim_2_ppm_size);
     433            (int) &_binary_anim_2_ppm_size);
    437434        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    438435
    439436        pm = make_pixmap(_binary_anim_3_ppm_start,
    440                 (int) &_binary_anim_3_ppm_size);
     437            (int) &_binary_anim_3_ppm_size);
    441438        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    442439
    443440        pm = make_pixmap(_binary_anim_4_ppm_start,
    444                 (int) &_binary_anim_4_ppm_size);
     441            (int) &_binary_anim_4_ppm_size);
    445442        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    446443
    447         async_msg(fbphone, FB_ANIM_START, an);
     444        async_msg_1(fbphone, FB_ANIM_START, an);
    448445
    449446        animation = an;
     
    468465        fbphone = phone;
    469466
    470         rc = async_req_2(phone, FB_GET_RESOLUTION, 0, 0, &xres, &yres);
     467        rc = async_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres);
    471468        if (rc)
    472469                return;
     
    478475        /* Align width & height to character size */
    479476        console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP,
    480                 ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
    481                 ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
     477            ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
     478            ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
    482479        if (console_vp < 0)
    483480                return;
     
    487484        for (i = 0; i < CONSOLE_COUNT; i++) {
    488485                cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN +
    489                         i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
    490                         STATUS_WIDTH, STATUS_HEIGHT);
     486                    i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
     487                    STATUS_WIDTH, STATUS_HEIGHT);
    491488                if (cstatus_vp[i] < 0)
    492489                        return;
     
    497494        /* Initialize icons */
    498495        ic_pixmaps[CONS_SELECTED] =
    499                 make_pixmap(_binary_cons_selected_ppm_start,
    500                 (int) &_binary_cons_selected_ppm_size);
     496            make_pixmap(_binary_cons_selected_ppm_start,
     497            (int) &_binary_cons_selected_ppm_size);
    501498        ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start,
    502                 (int) &_binary_cons_idle_ppm_size);
     499            (int) &_binary_cons_idle_ppm_size);
    503500        ic_pixmaps[CONS_HAS_DATA] =
    504                 make_pixmap(_binary_cons_has_data_ppm_start,
    505                 (int) &_binary_cons_has_data_ppm_size);
     501            make_pixmap(_binary_cons_has_data_ppm_start,
     502            (int) &_binary_cons_has_data_ppm_size);
    506503        ic_pixmaps[CONS_DISCONNECTED] =
    507                 make_pixmap(_binary_cons_idle_ppm_start,
    508                 (int) &_binary_cons_idle_ppm_size);
     504            make_pixmap(_binary_cons_idle_ppm_start,
     505            (int) &_binary_cons_idle_ppm_size);
    509506        ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
    510                 (int) &_binary_cons_kernel_ppm_size);
     507            (int) &_binary_cons_kernel_ppm_size);
    511508        ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
    512509       
Note: See TracChangeset for help on using the changeset viewer.