Rev 1279 | Rev 1339 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1279 | Rev 1330 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | #include <task.h> |
36 | #include <task.h> |
37 | #include <psthread.h> |
37 | #include <psthread.h> |
38 | #include <futex.h> |
38 | #include <futex.h> |
39 | #include <as.h> |
39 | #include <as.h> |
40 | #include <ddi.h> |
40 | #include <ddi.h> |
- | 41 | #include <string.h> |
|
41 | 42 | ||
42 | int a; |
43 | int a; |
43 | atomic_t ftx; |
44 | atomic_t ftx; |
44 | 45 | ||
45 | int __thread stage; |
46 | int __thread stage; |
Line 289... | Line 290... | ||
289 | psthread_schedule_next(); |
290 | psthread_schedule_next(); |
290 | printf("Pseudo thread exiting.\n"); |
291 | printf("Pseudo thread exiting.\n"); |
291 | return 0; |
292 | return 0; |
292 | } |
293 | } |
293 | 294 | ||
- | 295 | static int test_as_send() |
|
- | 296 | { |
|
- | 297 | char *as; |
|
- | 298 | int retval; |
|
- | 299 | ipcarg_t result; |
|
- | 300 | ||
- | 301 | as = as_area_create((void *)(1024*1024), 16384, AS_AREA_READ | AS_AREA_WRITE); |
|
- | 302 | if (!as) { |
|
- | 303 | printf("Error creating as.\n"); |
|
- | 304 | return 0; |
|
- | 305 | } |
|
- | 306 | ||
- | 307 | memcpy(as, "Hello world.\n", 14); |
|
- | 308 | ||
- | 309 | retval = ipc_call_sync_2(PHONE_NS, IPC_M_AS_SEND, 0, (sysarg_t) as, |
|
- | 310 | NULL, NULL); |
|
- | 311 | if (retval) { |
|
- | 312 | printf("AS_SEND failed.\n"); |
|
- | 313 | return 0; |
|
- | 314 | } |
|
- | 315 | printf("Done\n"); |
|
- | 316 | } |
|
- | 317 | ||
294 | int main(int argc, char *argv[]) |
318 | int main(int argc, char *argv[]) |
295 | { |
319 | { |
296 | pstid_t ptid; |
320 | pstid_t ptid; |
297 | int tid; |
321 | int tid; |
298 | 322 | ||
Line 304... | Line 328... | ||
304 | // test_async_ipc(); |
328 | // test_async_ipc(); |
305 | // test_advanced_ipc(); |
329 | // test_advanced_ipc(); |
306 | // test_connection_ipc(); |
330 | // test_connection_ipc(); |
307 | // test_hangup(); |
331 | // test_hangup(); |
308 | // test_slam(); |
332 | // test_slam(); |
- | 333 | test_as_send(); |
|
309 | 334 | /* |
|
310 | printf("Userspace task, taskid=%llX\n", task_get_id()); |
335 | printf("Userspace task, taskid=%llX\n", task_get_id()); |
311 | 336 | ||
312 | futex_initialize(&ftx, 1); |
337 | futex_initialize(&ftx, 1); |
313 | if (futex_down(&ftx) < 0) |
338 | if (futex_down(&ftx) < 0) |
314 | printf("Futex failed.\n"); |
339 | printf("Futex failed.\n"); |
Line 347... | Line 372... | ||
347 | printf("Main thread stage%d.\n", stage); |
372 | printf("Main thread stage%d.\n", stage); |
348 | 373 | ||
349 | psthread_join(ptid); |
374 | psthread_join(ptid); |
350 | 375 | ||
351 | printf("Main thread exiting.\n"); |
376 | printf("Main thread exiting.\n"); |
- | 377 | */ |
|
352 | return 0; |
378 | return 0; |
353 | } |
379 | } |