Changeset ffa2c8ef in mainline for uspace/srv/hid


Ignore:
Timestamp:
2011-01-29T11:36:08Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46b881c
Parents:
64d2b10
Message:

do not intermix low-level IPC methods with async framework methods

Location:
uspace/srv/hid
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/adb_mouse/adb_dev.c

    r64d2b10 rffa2c8ef  
    3434 */
    3535
    36 #include <ipc/ipc.h>
    3736#include <ipc/adb.h>
    3837#include <async.h>
     
    6867
    6968        /* NB: The callback connection is slotted for removal */
    70         sysarg_t taskhash;
    71         sysarg_t phonehash;
    72         if (ipc_connect_to_me(dev_phone, 0, 0, 0, &taskhash, &phonehash) != 0) {
     69        if (async_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) {
    7370                printf(NAME ": Failed to create callback from device\n");
    7471                return false;
    7572        }
    76 
    77         async_new_connection(taskhash, phonehash, 0, NULL, adb_dev_events);
    78 
     73       
    7974        return 0;
    8075}
     
    10095                        retval = ENOENT;
    10196                }
    102                 ipc_answer_0(callid, retval);
     97                async_answer_0(callid, retval);
    10398        }
    10499}
  • uspace/srv/hid/adb_mouse/adb_mouse.c

    r64d2b10 rffa2c8ef  
    3939 */
    4040
    41 #include <ipc/ipc.h>
    4241#include <ipc/mouse.h>
    4342#include <stdio.h>
     
    9897        int retval;
    9998
    100         ipc_answer_0(iid, EOK);
     99        async_answer_0(iid, EOK);
    101100
    102101        while (1) {
     
    105104                case IPC_M_PHONE_HUNGUP:
    106105                        if (client_phone != -1) {
    107                                 ipc_hangup(client_phone);
     106                                async_hangup(client_phone);
    108107                                client_phone = -1;
    109108                        }
    110109
    111                         ipc_answer_0(callid, EOK);
     110                        async_answer_0(callid, EOK);
    112111                        return;
    113112                case IPC_M_CONNECT_TO_ME:
     
    122121                        retval = EINVAL;
    123122                }
    124                 ipc_answer_0(callid, retval);
     123                async_answer_0(callid, retval);
    125124        }
    126125}
  • uspace/srv/hid/char_mouse/char_mouse.c

    r64d2b10 rffa2c8ef  
    3939 */
    4040
    41 #include <ipc/ipc.h>
    4241#include <ipc/mouse.h>
    4342#include <stdio.h>
     
    8382        int retval;
    8483
    85         ipc_answer_0(iid, EOK);
     84        async_answer_0(iid, EOK);
    8685
    8786        while (1) {
     
    9089                case IPC_M_PHONE_HUNGUP:
    9190                        if (client_phone != -1) {
    92                                 ipc_hangup(client_phone);
     91                                async_hangup(client_phone);
    9392                                client_phone = -1;
    9493                        }
    9594
    96                         ipc_answer_0(callid, EOK);
     95                        async_answer_0(callid, EOK);
    9796                        return;
    9897                case IPC_M_CONNECT_TO_ME:
     
    107106                        retval = EINVAL;
    108107                }
    109                 ipc_answer_0(callid, retval);
     108                async_answer_0(callid, retval);
    110109        }
    111110}
  • uspace/srv/hid/char_mouse/chardev.c

    r64d2b10 rffa2c8ef  
    3434 */
    3535
    36 #include <ipc/ipc.h>
    3736#include <ipc/char.h>
    3837#include <async.h>
     
    7069
    7170        /* NB: The callback connection is slotted for removal */
    72         sysarg_t taskhash;
    73         sysarg_t phonehash;
    74         if (ipc_connect_to_me(dev_phone, 0, 0, 0, &taskhash, &phonehash) != 0) {
     71        if (async_connect_to_me(dev_phone, 0, 0, 0, chardev_events) != 0) {
    7572                printf(NAME ": Failed to create callback from device\n");
    7673                return false;
    7774        }
    78 
    79         async_new_connection(taskhash, phonehash, 0, NULL, chardev_events);
    8075
    8176        return 0;
     
    115110                        retval = ENOENT;
    116111                }
    117                 ipc_answer_0(callid, retval);
     112                async_answer_0(callid, retval);
    118113        }
    119114}
  • uspace/srv/hid/console/console.c

    r64d2b10 rffa2c8ef  
    3434
    3535#include <libc.h>
    36 #include <ipc/ipc.h>
    3736#include <ipc/kbd.h>
    3837#include <io/keycode.h>
     
    117116static void curs_hide_sync(void)
    118117{
    119         ipc_call_sync_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);
     118        async_req_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);
    120119}
    121120
     
    132131static void screen_yield(void)
    133132{
    134         ipc_call_sync_0_0(fb_info.phone, FB_SCREEN_YIELD);
     133        async_req_0_0(fb_info.phone, FB_SCREEN_YIELD);
    135134}
    136135
    137136static void screen_reclaim(void)
    138137{
    139         ipc_call_sync_0_0(fb_info.phone, FB_SCREEN_RECLAIM);
     138        async_req_0_0(fb_info.phone, FB_SCREEN_RECLAIM);
    140139}
    141140
    142141static void kbd_yield(void)
    143142{
    144         ipc_call_sync_0_0(kbd_phone, KBD_YIELD);
     143        async_req_0_0(kbd_phone, KBD_YIELD);
    145144}
    146145
    147146static void kbd_reclaim(void)
    148147{
    149         ipc_call_sync_0_0(kbd_phone, KBD_RECLAIM);
     148        async_req_0_0(kbd_phone, KBD_RECLAIM);
    150149}
    151150
     
    438437                        retval = ENOENT;
    439438                }
    440                 ipc_answer_0(callid, retval);
     439                async_answer_0(callid, retval);
    441440        }
    442441}
     
    473472                }
    474473
    475                 ipc_answer_0(callid, retval);
     474                async_answer_0(callid, retval);
    476475        }
    477476}
     
    484483       
    485484        if (rc != EOK) {
    486                 ipc_answer_0(rid, rc);
     485                async_answer_0(rid, rc);
    487486                return;
    488487        }
     
    499498       
    500499        gcons_notify_char(cons->index);
    501         ipc_answer_1(rid, EOK, size);
     500        async_answer_1(rid, EOK, size);
    502501       
    503502        free(buf);
     
    509508        size_t size;
    510509        if (!async_data_read_receive(&callid, &size)) {
    511                 ipc_answer_0(callid, EINVAL);
    512                 ipc_answer_0(rid, EINVAL);
     510                async_answer_0(callid, EINVAL);
     511                async_answer_0(rid, EINVAL);
    513512                return;
    514513        }
     
    516515        char *buf = (char *) malloc(size);
    517516        if (buf == NULL) {
    518                 ipc_answer_0(callid, ENOMEM);
    519                 ipc_answer_0(rid, ENOMEM);
     517                async_answer_0(callid, ENOMEM);
     518                async_answer_0(rid, ENOMEM);
    520519                return;
    521520        }
     
    535534        if (pos == size) {
    536535                (void) async_data_read_finalize(callid, buf, size);
    537                 ipc_answer_1(rid, EOK, size);
     536                async_answer_1(rid, EOK, size);
    538537                free(buf);
    539538        } else {
     
    553552recheck:
    554553        if (keybuffer_pop(&cons->keybuffer, &ev)) {
    555                 ipc_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c);
     554                async_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c);
    556555        } else {
    557556                fibril_condvar_wait(&input_cv, &input_mutex);
     
    579578       
    580579        if (cons == NULL) {
    581                 ipc_answer_0(iid, ENOENT);
     580                async_answer_0(iid, ENOENT);
    582581                return;
    583582        }
     
    598597       
    599598        /* Accept the connection */
    600         ipc_answer_0(iid, EOK);
     599        async_answer_0(iid, EOK);
    601600       
    602601        while (true) {
     
    658657                        rc = ccap_fb_to_con(fb_info.color_cap, &arg1);
    659658                        if (rc != EOK) {
    660                                 ipc_answer_0(callid, rc);
     659                                async_answer_0(callid, rc);
    661660                                continue;
    662661                        }
     
    702701                        break;
    703702                }
    704                 ipc_answer_3(callid, EOK, arg1, arg2, arg3);
     703                async_answer_3(callid, EOK, arg1, arg2, arg3);
    705704        }
    706705}
     
    727726       
    728727        /* NB: The callback connection is slotted for removal */
    729         sysarg_t taskhash;
    730         sysarg_t phonehash;
    731         if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &taskhash,
    732             &phonehash) != 0) {
     728        if (async_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, keyboard_events)
     729            != 0) {
    733730                printf(NAME ": Failed to create callback from input device\n");
    734731                return false;
    735732        }
    736        
    737         async_new_connection(taskhash, phonehash, 0, NULL, keyboard_events);
    738733       
    739734        /* Connect to mouse device */
     
    752747        }
    753748       
    754         if (ipc_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, &taskhash,
    755             &phonehash) != 0) {
     749        if (async_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, mouse_events)
     750            != 0) {
    756751                printf(NAME ": Failed to create callback from mouse device\n");
    757752                mouse_phone = -1;
     
    759754        }
    760755       
    761         async_new_connection(taskhash, phonehash, 0, NULL, mouse_events);
    762756skip_mouse:
    763757       
  • uspace/srv/hid/console/gcons.c

    r64d2b10 rffa2c8ef  
    3434
    3535#include <ipc/fb.h>
    36 #include <ipc/ipc.h>
    3736#include <async.h>
    3837#include <stdio.h>
  • uspace/srv/hid/fb/ega.c

    r64d2b10 rffa2c8ef  
    3939#include <align.h>
    4040#include <async.h>
    41 #include <ipc/ipc.h>
    4241#include <errno.h>
    4342#include <stdio.h>
     
    4645#include <as.h>
    4746#include <ipc/fb.h>
    48 #include <ipc/ipc.h>
    4947#include <ipc/ns.h>
    5048#include <ipc/services.h>
     
    262260       
    263261        if (client_connected) {
    264                 ipc_answer_0(iid, ELIMIT);
     262                async_answer_0(iid, ELIMIT);
    265263                return;
    266264        }
     
    268266        /* Accept connection */
    269267        client_connected = 1;
    270         ipc_answer_0(iid, EOK);
     268        async_answer_0(iid, EOK);
    271269       
    272270        while (true) {
     
    296294                case IPC_M_PHONE_HUNGUP:
    297295                        client_connected = 0;
    298                         ipc_answer_0(callid, EOK);
     296                        async_answer_0(callid, EOK);
    299297                       
    300298                        /* Exit thread */
     
    332330                        break;
    333331                case FB_GET_CSIZE:
    334                         ipc_answer_2(callid, EOK, scr_width, scr_height);
     332                        async_answer_2(callid, EOK, scr_width, scr_height);
    335333                        continue;
    336334                case FB_GET_COLOR_CAP:
    337                         ipc_answer_1(callid, EOK, FB_CCAP_INDEXED);
     335                        async_answer_1(callid, EOK, FB_CCAP_INDEXED);
    338336                        continue;
    339337                case FB_CLEAR:
     
    440438                        retval = EINVAL;
    441439                }
    442                 ipc_answer_0(callid, retval);
     440                async_answer_0(callid, retval);
    443441        }
    444442}
  • uspace/srv/hid/fb/fb.c

    r64d2b10 rffa2c8ef  
    4747#include <as.h>
    4848#include <ipc/fb.h>
    49 #include <ipc/ipc.h>
    5049#include <ipc/ns.h>
    5150#include <ipc/services.h>
     
    10891088                        void *dest = as_get_mappable_page(IPC_GET_ARG2(*call));
    10901089                        shm_size = IPC_GET_ARG2(*call);
    1091                         if (ipc_answer_1(callid, EOK, (sysarg_t) dest)) {
     1090                        if (async_answer_1(callid, EOK, (sysarg_t) dest)) {
    10921091                                shm_id = 0;
    10931092                                return false;
     
    11661165       
    11671166        if (handled)
    1168                 ipc_answer_0(callid, retval);
     1167                async_answer_0(callid, retval);
    11691168        return handled;
    11701169}
     
    14451444        }
    14461445        if (handled)
    1447                 ipc_answer_0(callid, retval);
     1446                async_answer_0(callid, retval);
    14481447        return handled;
    14491448}
     
    14981497       
    14991498        if (handled)
    1500                 ipc_answer_0(callid, retval);
     1499                async_answer_0(callid, retval);
    15011500        return handled;
    15021501       
     
    15821581       
    15831582        if (client_connected) {
    1584                 ipc_answer_0(iid, ELIMIT);
     1583                async_answer_0(iid, ELIMIT);
    15851584                return;
    15861585        }
     
    15881587        /* Accept connection */
    15891588        client_connected = true;
    1590         ipc_answer_0(iid, EOK);
     1589        async_answer_0(iid, EOK);
    15911590       
    15921591        while (true) {
     
    16411640                                break;
    16421641                        }
    1643                         ipc_answer_0(callid, EOK);
     1642                        async_answer_0(callid, EOK);
    16441643                       
    16451644                        draw_char(vport, ch, col, row);
     
    16741673                        break;
    16751674                case FB_GET_CSIZE:
    1676                         ipc_answer_2(callid, EOK, vport->cols, vport->rows);
     1675                        async_answer_2(callid, EOK, vport->cols, vport->rows);
    16771676                        continue;
    16781677                case FB_GET_COLOR_CAP:
    1679                         ipc_answer_1(callid, EOK, FB_CCAP_RGB);
     1678                        async_answer_1(callid, EOK, FB_CCAP_RGB);
    16801679                        continue;
    16811680                case FB_SCROLL:
     
    17421741                        break;
    17431742                case FB_GET_RESOLUTION:
    1744                         ipc_answer_2(callid, EOK, screen.xres, screen.yres);
     1743                        async_answer_2(callid, EOK, screen.xres, screen.yres);
    17451744                        continue;
    17461745                case FB_POINTER_MOVE:
     
    17561755                        retval = ENOENT;
    17571756                }
    1758                 ipc_answer_0(callid, retval);
     1757                async_answer_0(callid, retval);
    17591758        }
    17601759}
  • uspace/srv/hid/fb/main.c

    r64d2b10 rffa2c8ef  
    2727 */
    2828
    29 #include <ipc/ipc.h>
    3029#include <ipc/services.h>
    3130#include <ipc/ns.h>
     
    5251       
    5352        dest = as_get_mappable_page(IPC_GET_ARG2(*call));
    54         if (ipc_answer_1(callid, EOK, (sysarg_t) dest) == 0) {
     53        if (async_answer_1(callid, EOK, (sysarg_t) dest) == 0) {
    5554                if (*area)
    5655                        as_area_destroy(*area);
  • uspace/srv/hid/fb/serial_console.c

    r64d2b10 rffa2c8ef  
    3939
    4040#include <stdio.h>
    41 #include <ipc/ipc.h>
    4241#include <async.h>
    4342#include <ipc/fb.h>
  • uspace/srv/hid/fb/serial_console.h

    r64d2b10 rffa2c8ef  
    3939#define FB_SERIAL_CONSOLE_H_
    4040
    41 #include <ipc/ipc.h>
     41#include <sys/types.h>
     42#include <ipc/common.h>
    4243
    4344typedef void (*putc_function_t)(char);
  • uspace/srv/hid/kbd/generic/kbd.c

    r64d2b10 rffa2c8ef  
    3636 */
    3737
    38 #include <ipc/ipc.h>
    3938#include <ipc/services.h>
    4039#include <ipc/kbd.h>
     
    173172        int retval;
    174173
    175         ipc_answer_0(iid, EOK);
     174        async_answer_0(iid, EOK);
    176175
    177176        while (1) {
     
    180179                case IPC_M_PHONE_HUNGUP:
    181180                        if (client_phone != -1) {
    182                                 ipc_hangup(client_phone);
     181                                async_hangup(client_phone);
    183182                                client_phone = -1;
    184183                        }
    185184                       
    186                         ipc_answer_0(callid, EOK);
     185                        async_answer_0(callid, EOK);
    187186                        return;
    188187                case IPC_M_CONNECT_TO_ME:
     
    205204                        retval = EINVAL;
    206205                }
    207                 ipc_answer_0(callid, retval);
     206                async_answer_0(callid, retval);
    208207        }       
    209208}
  • uspace/srv/hid/kbd/port/adb.c

    r64d2b10 rffa2c8ef  
    3535 */
    3636
    37 #include <ipc/ipc.h>
    3837#include <ipc/adb.h>
    3938#include <async.h>
  • uspace/srv/hid/kbd/port/chardev.c

    r64d2b10 rffa2c8ef  
    3535 */
    3636
    37 #include <ipc/ipc.h>
    3837#include <ipc/char.h>
    3938#include <async.h>
     
    9190
    9291        /* NB: The callback connection is slotted for removal */
    93         sysarg_t taskhash;
    94         sysarg_t phonehash;
    95         if (ipc_connect_to_me(dev_phone, 0, 0, 0, &taskhash, &phonehash) != 0) {
     92        if (async_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events) != 0) {
    9693                printf(NAME ": Failed to create callback from device\n");
    9794                return -1;
    9895        }
    99 
    100         async_new_connection(taskhash, phonehash, 0, NULL, kbd_port_events);
    10196
    10297        return 0;
     
    136131                        retval = ENOENT;
    137132                }
    138                 ipc_answer_0(callid, retval);
     133                async_answer_0(callid, retval);
    139134        }
    140135}
  • uspace/srv/hid/kbd/port/gxemul.c

    r64d2b10 rffa2c8ef  
    3535 */
    3636
    37 #include <ipc/ipc.h>
    3837#include <async.h>
    3938#include <sysinfo.h>
  • uspace/srv/hid/kbd/port/msim.c

    r64d2b10 rffa2c8ef  
    3535 */
    3636
    37 #include <ipc/ipc.h>
    3837#include <async.h>
    3938#include <sysinfo.h>
  • uspace/srv/hid/kbd/port/ns16550.c

    r64d2b10 rffa2c8ef  
    3535 */
    3636
    37 #include <ipc/ipc.h>
    3837#include <ipc/irc.h>
    3938#include <async.h>
  • uspace/srv/hid/kbd/port/pl050.c

    r64d2b10 rffa2c8ef  
    3737#include <ddi.h>
    3838#include <libarch/ddi.h>
    39 #include <ipc/ipc.h>
    4039#include <async.h>
    4140#include <unistd.h>
  • uspace/srv/hid/kbd/port/z8530.c

    r64d2b10 rffa2c8ef  
    3535 */
    3636
    37 #include <ipc/ipc.h>
    3837#include <ipc/irc.h>
    3938#include <async.h>
  • uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c

    r64d2b10 rffa2c8ef  
    4242#include <io/console.h>
    4343#include <vfs/vfs.h>
    44 #include <ipc/ipc.h>
    4544#include <ipc/mouse.h>
    4645#include <async.h>
     
    140139
    141140        async_set_interrupt_received(s3c24xx_ts_irq_handler);
    142         ipc_register_irq(inr, device_assign_devno(), 0, &ts_irq_code);
     141        register_irq(inr, device_assign_devno(), 0, &ts_irq_code);
    143142
    144143        s3c24xx_ts_wait_for_int_mode(ts, updn_down);
     
    377376        int retval;
    378377
    379         ipc_answer_0(iid, EOK);
     378        async_answer_0(iid, EOK);
    380379
    381380        while (1) {
     
    384383                case IPC_M_PHONE_HUNGUP:
    385384                        if (ts->client_phone != -1) {
    386                                 ipc_hangup(ts->client_phone);
     385                                async_hangup(ts->client_phone);
    387386                                ts->client_phone = -1;
    388387                        }
    389388
    390                         ipc_answer_0(callid, EOK);
     389                        async_answer_0(callid, EOK);
    391390                        return;
    392391                case IPC_M_CONNECT_TO_ME:
     
    401400                        retval = EINVAL;
    402401                }
    403                 ipc_answer_0(callid, retval);
     402                async_answer_0(callid, retval);
    404403        }
    405404}
Note: See TracChangeset for help on using the changeset viewer.