Rev 1339 | Rev 1347 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1339 | Rev 1343 | ||
|---|---|---|---|
| Line 26... | Line 26... | ||
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
27 | */ |
| 28 | 28 | ||
| 29 | #include "version.h" |
29 | #include "version.h" |
| 30 | #include <ipc.h> |
30 | #include <ipc.h> |
| - | 31 | #include <services.h> |
|
| 31 | #include <stdio.h> |
32 | #include <stdio.h> |
| 32 | #include <unistd.h> |
33 | #include <unistd.h> |
| 33 | #include <stdlib.h> |
34 | #include <stdlib.h> |
| 34 | #include <ns.h> |
35 | #include <ns.h> |
| 35 | #include <thread.h> |
36 | #include <thread.h> |
| Line 37... | Line 38... | ||
| 37 | #include <psthread.h> |
38 | #include <psthread.h> |
| 38 | #include <futex.h> |
39 | #include <futex.h> |
| 39 | #include <as.h> |
40 | #include <as.h> |
| 40 | #include <ddi.h> |
41 | #include <ddi.h> |
| 41 | #include <string.h> |
42 | #include <string.h> |
| - | 43 | #include <errno.h> |
|
| 42 | #include <kbd.h> |
44 | #include <kbd.h> |
| 43 | 45 | ||
| 44 | int a; |
46 | int a; |
| 45 | atomic_t ftx; |
47 | atomic_t ftx; |
| 46 | 48 | ||
| Line 200... | Line 202... | ||
| 200 | printf("----------------\n"); |
202 | printf("----------------\n"); |
| 201 | ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov", |
203 | ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov", |
| 202 | got_answer_2); |
204 | got_answer_2); |
| 203 | callid = ipc_wait_for_call(&data, NULL); |
205 | callid = ipc_wait_for_call(&data, NULL); |
| 204 | printf("Received ping\n"); |
206 | printf("Received ping\n"); |
| 205 | ipc_answer(callid, 0, 0, 0); |
207 | ipc_answer_fast(callid, 0, 0, 0); |
| 206 | } |
208 | } |
| 207 | // callid = ipc_wait_for_call(&data, NULL); |
209 | // callid = ipc_wait_for_call(&data, NULL); |
| 208 | } |
210 | } |
| 209 | 211 | ||
| 210 | static void test_connection_ipc(void) |
212 | static void test_connection_ipc(void) |
| Line 298... | Line 300... | ||
| 298 | int res; |
300 | int res; |
| 299 | ipcarg_t result; |
301 | ipcarg_t result; |
| 300 | int phoneid; |
302 | int phoneid; |
| 301 | 303 | ||
| 302 | printf("Test: Starting connect...\n"); |
304 | printf("Test: Starting connect...\n"); |
| 303 | while ((phoneid = ipc_connect_me_to(PHONE_NS, 30, 60)) < 0) { |
305 | while ((phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0)) < 0) { |
| 304 | }; |
306 | }; |
| 305 | 307 | ||
| 306 | printf("Test: Connected: %d\n", res); |
308 | printf("Test: Connected: %d\n", res); |
| 307 | printf("Test: pinging.\n"); |
309 | printf("Test: pinging.\n"); |
| 308 | while (1) { |
310 | while (1) { |
| Line 313... | Line 315... | ||
| 313 | 315 | ||
| 314 | printf("Test: Hangin up\n"); |
316 | printf("Test: Hangin up\n"); |
| 315 | ipc_hangup(phoneid); |
317 | ipc_hangup(phoneid); |
| 316 | } |
318 | } |
| 317 | 319 | ||
| - | 320 | static void test_pci() |
|
| - | 321 | { |
|
| - | 322 | int phone; |
|
| - | 323 | while ((phone = ipc_connect_me_to(PHONE_NS, SERVICE_PCI, 0)) < 0) |
|
| - | 324 | ; |
|
| - | 325 | printf("Connected to PCI service through phone %d.\n", phone); |
|
| - | 326 | } |
|
| - | 327 | ||
| 318 | static int test_as_send() |
328 | static int test_as_send() |
| 319 | { |
329 | { |
| 320 | char *as; |
330 | char *as; |
| 321 | int retval; |
331 | int retval; |
| 322 | ipcarg_t result; |
332 | ipcarg_t result; |
| Line 352... | Line 362... | ||
| 352 | // test_advanced_ipc(); |
362 | // test_advanced_ipc(); |
| 353 | // test_connection_ipc(); |
363 | // test_connection_ipc(); |
| 354 | // test_hangup(); |
364 | // test_hangup(); |
| 355 | // test_slam(); |
365 | // test_slam(); |
| 356 | // test_as_send(); |
366 | // test_as_send(); |
| - | 367 | test_pci(); |
|
| 357 | test_kbd(); |
368 | test_kbd(); |
| 358 | 369 | ||
| 359 | /* |
370 | /* |
| 360 | printf("Userspace task, taskid=%llX\n", task_get_id()); |
371 | printf("Userspace task, taskid=%llX\n", task_get_id()); |
| 361 | 372 | ||
| Line 375... | Line 386... | ||
| 375 | if ((tid = thread_create(utest, NULL, "utest")) != -1) { |
386 | if ((tid = thread_create(utest, NULL, "utest")) != -1) { |
| 376 | printf("Created thread tid=%d\n", tid); |
387 | printf("Created thread tid=%d\n", tid); |
| 377 | } |
388 | } |
| 378 | 389 | ||
| 379 | int i; |
390 | int i; |
| 380 | |
391 | |
| 381 | for (i = 0; i < 50000000; i++) |
392 | for (i = 0; i < 50000000; i++) |
| 382 | ; |
393 | ; |
| 383 | |
394 | |
| 384 | if (futex_up(&ftx) < 0) |
395 | if (futex_up(&ftx) < 0) |
| 385 | printf("Futex failed.\n"); |
396 | printf("Futex failed.\n"); |
| Line 398... | Line 409... | ||
| 398 | 409 | ||
| 399 | psthread_join(ptid); |
410 | psthread_join(ptid); |
| 400 | 411 | ||
| 401 | printf("Main thread exiting.\n"); |
412 | printf("Main thread exiting.\n"); |
| 402 | */ |
413 | */ |
| - | 414 | ||
| 403 | return 0; |
415 | return 0; |
| 404 | } |
416 | } |