Changeset 04a73cdf in mainline


Ignore:
Timestamp:
2006-05-17T14:05:01Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04552a80
Parents:
afa6e74
Message:

Sync with kernel.
Add ipc_wait_for_call_timeout() and ipc_trywait_for_call().
Modify ipc_wait_for_call() to be unconditional.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • fb/fb.c

    rafa6e74 r04a73cdf  
    164164                static int vfb_no=1;
    165165
    166                 callid = ipc_wait_for_call(&call, 0);
     166                callid = ipc_wait_for_call(&call);
    167167        //      printf("%s:Call phone=%lX..", NAME, call.in_phone_hash);
    168168                switch (IPC_GET_METHOD(call)&((1<<METHOD_WIDTH)-1)) {
  • init/init.c

    rafa6e74 r04a73cdf  
    180180                printf(".");
    181181        printf("\n");
    182         ipc_wait_for_call(&data, NULL);
     182        ipc_wait_for_call(&data);
    183183        printf("Received call???\n");
    184184}
     
    204204                ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov",
    205205                               got_answer_2);
    206                 callid = ipc_wait_for_call(&data, NULL);
     206                callid = ipc_wait_for_call(&data);
    207207                printf("Received ping\n");
    208208                ipc_answer_fast(callid, 0, 0, 0);
     
    244244        printf("Newphid: %d\n", phoneid);
    245245        for (i=0; i < 1000; i++) {
    246                 if ((callid=ipc_wait_for_call(&data, IPC_WAIT_NONBLOCKING)))
     246                if ((callid=ipc_trywait_for_call(&data)))
    247247                        printf("callid: %d\n");
    248248        }
     
    267267       
    268268        for (i=0; i < 1000; i++) {
    269                 if ((callid=ipc_wait_for_call(&data, IPC_WAIT_NONBLOCKING)))
     269                if ((callid=ipc_trywait_for_call(&data)))
    270270                        printf("callid: %d\n");
    271271        }
     
    276276        ipc_call_async_2(PHONE_NS, NS_PING, 1, 0xbeefbee2,
    277277                         "Pong1", got_answer);
    278         ipc_wait_for_call(&data, 0);
     278        ipc_wait_for_call(&data);
    279279}
    280280
     
    395395//      test_as_send();
    396396//      test_pci();
    397 //      test_kbd();
     397        test_kbd();
    398398//      test_fb();
    399399
  • kbd/generic/kbd.c

    rafa6e74 r04a73cdf  
    7979       
    8080        while (1) {
    81                 callid = ipc_wait_for_call(&call, 0);
     81                callid = ipc_wait_for_call(&call);
    8282        //      printf("%s:Call phone=%lX..", NAME, call.in_phone_hash);
    8383                switch (IPC_GET_METHOD(call)) {
  • libc/generic/ipc.c

    rafa6e74 r04a73cdf  
    3535#include <unistd.h>
    3636#include <futex.h>
     37#include <kernel/synch/synch.h>
    3738
    3839/** Structure used for keeping track of sent async msgs
     
    252253
    253254
    254 /** Wait for IPC call and return
     255/** Unconditionally wait for an IPC call.
    255256 *
    256257 * - dispatch ASYNC reoutines in the background
    257  * @param data Space where the message is stored
    258  * @return Callid or 0 if nothing available and started with
    259  *         IPC_WAIT_NONBLOCKING
    260  */
    261 ipc_callid_t ipc_wait_for_call(ipc_call_t *call, int flags)
     258 * @param call Space where the message is stored
     259 * @return Callid of the answer.
     260 */
     261ipc_callid_t ipc_wait_for_call(ipc_call_t *call)
    262262{
    263263        ipc_callid_t callid;
     
    266266                try_dispatch_queued_calls();
    267267
    268                 callid = __SYSCALL2(SYS_IPC_WAIT, (sysarg_t)call, flags);
     268                callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, SYNCH_NO_TIMEOUT, SYNCH_BLOCKING);
     269                /* Handle received answers */
     270                if (callid & IPC_CALLID_ANSWERED)
     271                        handle_answer(callid, call);
     272        } while (callid & IPC_CALLID_ANSWERED);
     273
     274        return callid;
     275}
     276
     277/** Wait some time for an IPC call.
     278 *
     279 * - dispatch ASYNC reoutines in the background
     280 * @param call Space where the message is stored
     281 * @param usec Timeout in microseconds.
     282 * @return Callid of the answer.
     283 */
     284ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *call, uint32_t usec)
     285{
     286        ipc_callid_t callid;
     287
     288        do {
     289                try_dispatch_queued_calls();
     290
     291                callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, SYNCH_BLOCKING);
     292                /* Handle received answers */
     293                if (callid & IPC_CALLID_ANSWERED)
     294                        handle_answer(callid, call);
     295        } while (callid & IPC_CALLID_ANSWERED);
     296
     297        return callid;
     298}
     299
     300/** Check if there is an IPC call waiting to be picked up.
     301 *
     302 * - dispatch ASYNC reoutines in the background
     303 * @param call Space where the message is stored
     304 * @return Callid of the answer.
     305 */
     306ipc_callid_t ipc_trywait_for_call(ipc_call_t *call)
     307{
     308        ipc_callid_t callid;
     309
     310        do {
     311                try_dispatch_queued_calls();
     312
     313                callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t)call, SYNCH_NO_TIMEOUT, SYNCH_NON_BLOCKING);
    269314                /* Handle received answers */
    270315                if (callid & IPC_CALLID_ANSWERED)
  • libc/include/ipc/ipc.h

    rafa6e74 r04a73cdf  
    5454extern int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1,
    5555                         ipcarg_t *result);
    56 extern ipc_callid_t ipc_wait_for_call(ipc_call_t *data, int flags);
     56extern ipc_callid_t ipc_wait_for_call(ipc_call_t *data);
     57extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *data, uint32_t usec);
     58extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data);
     59
    5760extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
    5861                           ipcarg_t arg2);
  • ns/ns.c

    rafa6e74 r04a73cdf  
    9292               
    9393        while (1) {
    94                 callid = ipc_wait_for_call(&call, 0);
     94                callid = ipc_wait_for_call(&call);
    9595//              printf("NS: Call in_phone_hash=%lX...", call.in_phone_hash);
    9696                switch (IPC_GET_METHOD(call)) {
  • pci/pci.c

    rafa6e74 r04a73cdf  
    6666                int retval;
    6767
    68                 callid = ipc_wait_for_call(&call, 0);
     68                callid = ipc_wait_for_call(&call);
    6969                switch(IPC_GET_METHOD(call)) {
    7070                case IPC_M_CONNECT_ME_TO:
Note: See TracChangeset for help on using the changeset viewer.