Subversion Repositories HelenOS-historic

Rev

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

Rev 1049 Rev 1061
Line 142... Line 142...
142
{
142
{
143
    int res;
143
    int res;
144
    unsigned long long taskid;
144
    unsigned long long taskid;
145
    ipc_callid_t callid;
145
    ipc_callid_t callid;
146
    ipc_call_t data;
146
    ipc_call_t data;
-
 
147
    int i;
147
 
148
 
148
    printf("Asking 0 to connect to me...\n");
149
    printf("Asking 0 to connect to me...\n");
149
    res = ipc_connect_to_me(0, 1, 2, &taskid);
150
    res = ipc_connect_to_me(0, 1, 2, &taskid);
150
    printf("Result: %d - taskid: %Q\n", res, taskid);
151
    printf("Result: %d - taskid: %Q\n", res, taskid);
151
//  while (1) {
152
    for (i=0; i < 100; i++) {
152
        printf("----------------\n");
153
        printf("----------------\n");
153
        ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov",
154
        ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov",
154
                   got_answer_2);
155
                   got_answer_2);
155
        callid = ipc_wait_for_call(&data, NULL);
156
        callid = ipc_wait_for_call(&data, NULL);
156
        printf("Received ping\n");
157
        printf("Received ping\n");
157
        ipc_answer(callid, 0, 0, 0);
158
        ipc_answer(callid, 0, 0, 0);
158
//  }
159
    }
159
        callid = ipc_wait_for_call(&data, NULL);
160
    callid = ipc_wait_for_call(&data, NULL);
-
 
161
}
-
 
162
 
-
 
163
static void test_connection_ipc(void)
-
 
164
{
-
 
165
    int res;
-
 
166
    ipcarg_t result;
-
 
167
 
-
 
168
    printf("Starting connect...\n");
-
 
169
    res = ipc_connect_me_to(PHONE_NS, 10, 20);
-
 
170
    printf("Connected: %d\n", res);
-
 
171
    printf("pinging.\n");
-
 
172
    res = ipc_call_sync(res, NS_PING, 0xbeef,&result);
-
 
173
    printf("Retval: %d - received: %P\n", res, result);
-
 
174
   
160
}
175
}
161
 
176
 
162
int main(int argc, char *argv[])
177
int main(int argc, char *argv[])
163
{
178
{
164
    version_print();
179
    version_print();
165
 
180
 
166
/*  test_printf(); */
181
/*  test_printf(); */
167
//  test_ping();
182
//  test_ping();
168
//  test_async_ipc();
183
//  test_async_ipc();
169
    test_advanced_ipc();
184
//  test_advanced_ipc();
-
 
185
    test_connection_ipc();
170
    return 0;
186
    return 0;
171
}
187
}