Subversion Repositories HelenOS-historic

Rev

Rev 1259 | Rev 1285 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1259 Rev 1282
Line 2... Line 2...
2
#include <stdio.h>
2
#include <stdio.h>
3
#include <unistd.h>
3
#include <unistd.h>
4
#include <stdlib.h>
4
#include <stdlib.h>
5
#include <ns.h>
5
#include <ns.h>
6
#include <errno.h>
6
#include <errno.h>
-
 
7
/*
-
 
8
irq_cmd_t msim_cmds[1] = {
-
 
9
    { CMD_MEM_READ_1, (void *)0xB0000000, 0 }
-
 
10
};
7
 
11
 
-
 
12
irq_code_t msim_kbd = {
-
 
13
    1,
-
 
14
    msim_cmds
-
 
15
};
-
 
16
*/
8
static int service;
17
static int service;
9
 
18
 
10
int main(int argc, char **argv)
19
int main(int argc, char **argv)
11
{
20
{
12
    ipc_call_t call;
21
    ipc_call_t call;
13
    ipc_callid_t callid;
22
    ipc_callid_t callid;
14
   
23
   
15
    ipcarg_t retval, arg1, arg2;
24
    ipcarg_t retval, arg1, arg2;
16
 
25
 
17
    printf("NS:Name service started.\n");
26
    printf("NS:Name service started.\n");
18
//  ipc_register_irq(1);
27
//  ipc_register_irq(2, &msim_kbd);
19
    while (1) {
28
    while (1) {
20
        callid = ipc_wait_for_call(&call, 0);
29
        callid = ipc_wait_for_call(&call, 0);
21
        printf("NS:Call phone=%lX..", call.phoneid);
30
        printf("NS:Call phone=%lX..", call.phoneid);
22
        switch (IPC_GET_METHOD(call)) {
31
        switch (IPC_GET_METHOD(call)) {
23
        case IPC_M_INTERRUPT:
32
        case IPC_M_INTERRUPT:
24
            printf("GOT INTERRUPT\n");
33
            printf("GOT INTERRUPT: %c\n", IPC_GET_ARG2(call));
25
            break;
34
            break;
26
        case IPC_M_PHONE_HUNGUP:
35
        case IPC_M_PHONE_HUNGUP:
27
            printf("Phone hung up.\n");
36
            printf("Phone hung up.\n");
28
            retval = 0;
37
            retval = 0;
29
            break;
38
            break;
Line 56... Line 65...
56
        default:
65
        default:
57
            printf("Unknown method: %zd\n", IPC_GET_METHOD(call));
66
            printf("Unknown method: %zd\n", IPC_GET_METHOD(call));
58
            retval = ENOENT;
67
            retval = ENOENT;
59
            break;
68
            break;
60
        }
69
        }
61
        if (! (callid & IPC_CALLID_NOTIFICATION))
70
        if (! (callid & IPC_CALLID_NOTIFICATION)) {
-
 
71
            printf("Answerinh\n");
62
            ipc_answer(callid, retval, arg1, arg2);
72
            ipc_answer(callid, retval, arg1, arg2);
-
 
73
        }
63
    }
74
    }
64
}
75
}